The source code and dockerfile for the GSW2024 AI Lab.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
 
 

33 lines
604 B

#include "utility.h"
#include <cuda_runtime.h>
size_t getFreeCudaMemory() {
size_t freeMemory;
size_t totalMemory;
cudaMemGetInfo(&freeMemory, &totalMemory);
return freeMemory;
}
size_t getTotalCudaMemory() {
size_t freeMemory;
size_t totalMemory;
cudaMemGetInfo(&freeMemory, &totalMemory);
return totalMemory;
}
bool resetCudaDevice() {
cudaError_t result = cudaDeviceReset();
return (result == cudaSuccess);
}
int getRuntimeCudaVersion() {
int result = -1;
cudaError_t errorResult = cudaRuntimeGetVersion(&result);
if (errorResult != cudaSuccess) {
return -1;
}
return result;
}