Added a function for checking whether CUDA-capable devices are available

This commit is contained in:
jpekkila
2019-08-08 20:35:02 +03:00
parent 8a9099d75e
commit e79e1207f2
2 changed files with 16 additions and 0 deletions

View File

@@ -19,6 +19,7 @@
// #include "astaroth_defines.h"
#include "astaroth.h"
#include "errchk.h"
#include "math_utils.h" // int3 + int3
#define AC_GEN_STR(X) #X
@@ -51,6 +52,17 @@ acQuit(void)
return acNodeDestroy(nodes[0]);
}
AcResult
acCheckDeviceAvailability(void)
{
int device_count; // Separate from num_devices to avoid side effects
ERRCHK_CUDA_ALWAYS(cudaGetDeviceCount(&device_count));
if (device_count > 0)
return AC_SUCCESS;
else
return AC_FAILURE;
}
AcResult
acSynchronize(void)
{