diff --git a/include/occa/cBase.hpp b/include/occa/cBase.hpp index 887d0e089..5b5137ab7 100644 --- a/include/occa/cBase.hpp +++ b/include/occa/cBase.hpp @@ -231,6 +231,8 @@ OCCA_LFUNC void OCCA_RFUNC occaDeviceSetCompilerFlags(occaDevice device, OCCA_LFUNC const char* OCCA_RFUNC occaDeviceGetCompiler(occaDevice device); OCCA_LFUNC const char* OCCA_RFUNC occaDeviceGetCompilerEnvScript(occaDevice device); OCCA_LFUNC const char* OCCA_RFUNC occaDeviceGetCompilerFlags(occaDevice device); +OCCA_LFUNC int OCCA_RFUNC occaDeviceGetID(occaDevice device); +OCCA_LFUNC void OCCA_RFUNC occaDeviceGetDeviceList(int *n, occaDevice** devices); OCCA_LFUNC uintptr_t OCCA_RFUNC occaDeviceMemorySize(occaDevice device); diff --git a/src/cBase.cpp b/src/cBase.cpp index ba4d41980..45e277e7e 100644 --- a/src/cBase.cpp +++ b/src/cBase.cpp @@ -514,6 +514,22 @@ const char* OCCA_RFUNC occaDeviceGetCompilerFlags(occaDevice device) { return device_.getCompilerEnvScript().c_str(); } +int OCCA_RFUNC occaDeviceGetID(occaDevice device) { + occa::device device_((occa::device_v*) device); + return device_.id(); +} + +void OCCA_RFUNC occaDeviceGetDeviceList(int *n, occaDevice** devices) { + std::vector& deviceList = occa::getDeviceList(); + *n = deviceList.size(); + + *devices = (occaDevice*) malloc(sizeof(occaDevice)*(*n)); + + for (int i = 0; i < *n; i++) { + (*devices)[i] = (occaDevice) deviceList[i].getDHandle(); + } +} + uintptr_t OCCA_RFUNC occaDeviceMemorySize(occaDevice device) { occa::device device_((occa::device_v*) device); return device_.memorySize();