its working now

This commit is contained in:
Osman Faruk Bayram 2025-08-27 01:18:05 +03:00
parent 347d5c6554
commit eacee11566
2 changed files with 44 additions and 27 deletions

20
main.cu
View file

@ -1,13 +1,13 @@
#include <unistd.h>
#include <iostream>
#include "cuda.h"
int main(){
size_t mf, ma;
cudaMemGetInfo(&mf, &ma);
std::cout << "Free memory (mb): " << mf/1024/1024 << std::endl;
std::cout << "Total memory (mb): " << ma/1024/1024 << std::endl;
return 0;
int main() {
size_t free_t, total_t;
cudaError_t err;
err = cudaMemGetInfo(&free_t, &total_t);
if (err != cudaSuccess) { printf("cudaMalloc d_steps_arr error: %s\n", cudaGetErrorString(err)); return 1; }
std::cout << "Free mem: " << free_t / (1024 * 1024) << " MB Total mem: " << total_t / (1024 * 1024) << " MB" << std::endl;
std::cout << "Free mem: " << free_t / (1024 * 1024 * 1024) << " GB Total mem: " << total_t / (1024 * 1024 * 1024) << " GB" << std::endl;
return 0;
}