mirror of https://github.com/BOINC/boinc.git
client: don't start var names with __
This commit is contained in:
parent
247e6b096b
commit
34408c3122
|
@ -85,27 +85,27 @@ typedef int (__stdcall *ATI_STATUS) (CALdevicestatus*, CALdevice);
|
|||
typedef int (__stdcall *ATI_DEVICEOPEN) (CALdevice*, CALuint);
|
||||
typedef int (__stdcall *ATI_DEVICECLOSE) (CALdevice);
|
||||
|
||||
ATI_ATTRIBS __calDeviceGetAttribs = NULL;
|
||||
ATI_CLOSE __calShutdown = NULL;
|
||||
ATI_GDC __calDeviceGetCount = NULL;
|
||||
ATI_GDI __calInit = NULL;
|
||||
ATI_INFO __calDeviceGetInfo = NULL;
|
||||
ATI_VER __calGetVersion = NULL;
|
||||
ATI_STATUS __calDeviceGetStatus = NULL;
|
||||
ATI_DEVICEOPEN __calDeviceOpen = NULL;
|
||||
ATI_DEVICECLOSE __calDeviceClose = NULL;
|
||||
ATI_ATTRIBS p_calDeviceGetAttribs = NULL;
|
||||
ATI_CLOSE p_calShutdown = NULL;
|
||||
ATI_GDC p_calDeviceGetCount = NULL;
|
||||
ATI_GDI p_calInit = NULL;
|
||||
ATI_INFO p_calDeviceGetInfo = NULL;
|
||||
ATI_VER p_calGetVersion = NULL;
|
||||
ATI_STATUS p_calDeviceGetStatus = NULL;
|
||||
ATI_DEVICEOPEN p_calDeviceOpen = NULL;
|
||||
ATI_DEVICECLOSE p_calDeviceClose = NULL;
|
||||
|
||||
#else
|
||||
|
||||
int (*__calInit)();
|
||||
int (*__calGetVersion)(CALuint*, CALuint*, CALuint*);
|
||||
int (*__calDeviceGetCount)(CALuint*);
|
||||
int (*__calDeviceGetAttribs)(CALdeviceattribs*, CALuint);
|
||||
int (*__calShutdown)();
|
||||
int (*__calDeviceGetInfo)(CALdeviceinfo*, CALuint);
|
||||
int (*__calDeviceGetStatus)(CALdevicestatus*, CALdevice);
|
||||
int (*__calDeviceOpen)(CALdevice*, CALuint);
|
||||
int (*__calDeviceClose)(CALdevice);
|
||||
int (*p_calInit)();
|
||||
int (*p_calGetVersion)(CALuint*, CALuint*, CALuint*);
|
||||
int (*p_calDeviceGetCount)(CALuint*);
|
||||
int (*p_calDeviceGetAttribs)(CALdeviceattribs*, CALuint);
|
||||
int (*p_calShutdown)();
|
||||
int (*p_calDeviceGetInfo)(CALdeviceinfo*, CALuint);
|
||||
int (*p_calDeviceGetStatus)(CALdevicestatus*, CALdevice);
|
||||
int (*p_calDeviceOpen)(CALdevice*, CALuint);
|
||||
int (*p_calDeviceClose)(CALdevice);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -146,15 +146,15 @@ void COPROC_ATI::get(
|
|||
return;
|
||||
}
|
||||
|
||||
__calInit = (ATI_GDI)GetProcAddress(callib, "calInit" );
|
||||
__calGetVersion = (ATI_VER)GetProcAddress(callib, "calGetVersion" );
|
||||
__calDeviceGetCount = (ATI_GDC)GetProcAddress(callib, "calDeviceGetCount" );
|
||||
__calDeviceGetAttribs =(ATI_ATTRIBS)GetProcAddress(callib, "calDeviceGetAttribs" );
|
||||
__calShutdown = (ATI_CLOSE)GetProcAddress(callib, "calShutdown" );
|
||||
__calDeviceGetInfo = (ATI_INFO)GetProcAddress(callib, "calDeviceGetInfo" );
|
||||
__calDeviceGetStatus = (ATI_STATUS)GetProcAddress(callib, "calDeviceGetStatus" );
|
||||
__calDeviceOpen = (ATI_DEVICEOPEN)GetProcAddress(callib, "calDeviceOpen" );
|
||||
__calDeviceClose = (ATI_DEVICECLOSE)GetProcAddress(callib, "calDeviceClose" );
|
||||
p_calInit = (ATI_GDI)GetProcAddress(callib, "calInit" );
|
||||
p_calGetVersion = (ATI_VER)GetProcAddress(callib, "calGetVersion" );
|
||||
p_calDeviceGetCount = (ATI_GDC)GetProcAddress(callib, "calDeviceGetCount" );
|
||||
p_calDeviceGetAttribs =(ATI_ATTRIBS)GetProcAddress(callib, "calDeviceGetAttribs" );
|
||||
p_calShutdown = (ATI_CLOSE)GetProcAddress(callib, "calShutdown" );
|
||||
p_calDeviceGetInfo = (ATI_INFO)GetProcAddress(callib, "calDeviceGetInfo" );
|
||||
p_calDeviceGetStatus = (ATI_STATUS)GetProcAddress(callib, "calDeviceGetStatus" );
|
||||
p_calDeviceOpen = (ATI_DEVICEOPEN)GetProcAddress(callib, "calDeviceOpen" );
|
||||
p_calDeviceClose = (ATI_DEVICECLOSE)GetProcAddress(callib, "calDeviceClose" );
|
||||
|
||||
#else
|
||||
|
||||
|
@ -167,52 +167,52 @@ void COPROC_ATI::get(
|
|||
|
||||
atirt_detected = true;
|
||||
|
||||
__calInit = (int(*)()) dlsym(callib, "calInit");
|
||||
__calGetVersion = (int(*)(CALuint*, CALuint*, CALuint*)) dlsym(callib, "calGetVersion");
|
||||
__calDeviceGetCount = (int(*)(CALuint*)) dlsym(callib, "calDeviceGetCount");
|
||||
__calDeviceGetAttribs = (int(*)(CALdeviceattribs*, CALuint)) dlsym(callib, "calDeviceGetAttribs");
|
||||
__calShutdown = (int(*)()) dlsym(callib, "calShutdown");
|
||||
__calDeviceGetInfo = (int(*)(CALdeviceinfo*, CALuint)) dlsym(callib, "calDeviceGetInfo");
|
||||
__calDeviceGetStatus = (int(*)(CALdevicestatus*, CALdevice)) dlsym(callib, "calDeviceGetStatus");
|
||||
__calDeviceOpen = (int(*)(CALdevice*, CALuint)) dlsym(callib, "calDeviceOpen");
|
||||
__calDeviceClose = (int(*)(CALdevice)) dlsym(callib, "calDeviceClose");
|
||||
p_calInit = (int(*)()) dlsym(callib, "calInit");
|
||||
p_calGetVersion = (int(*)(CALuint*, CALuint*, CALuint*)) dlsym(callib, "calGetVersion");
|
||||
p_calDeviceGetCount = (int(*)(CALuint*)) dlsym(callib, "calDeviceGetCount");
|
||||
p_calDeviceGetAttribs = (int(*)(CALdeviceattribs*, CALuint)) dlsym(callib, "calDeviceGetAttribs");
|
||||
p_calShutdown = (int(*)()) dlsym(callib, "calShutdown");
|
||||
p_calDeviceGetInfo = (int(*)(CALdeviceinfo*, CALuint)) dlsym(callib, "calDeviceGetInfo");
|
||||
p_calDeviceGetStatus = (int(*)(CALdevicestatus*, CALdevice)) dlsym(callib, "calDeviceGetStatus");
|
||||
p_calDeviceOpen = (int(*)(CALdevice*, CALuint)) dlsym(callib, "calDeviceOpen");
|
||||
p_calDeviceClose = (int(*)(CALdevice)) dlsym(callib, "calDeviceClose");
|
||||
|
||||
#endif
|
||||
|
||||
if (!__calInit) {
|
||||
if (!p_calInit) {
|
||||
warnings.push_back("calInit() missing from CAL library");
|
||||
goto leave;
|
||||
}
|
||||
if (!__calGetVersion) {
|
||||
if (!p_calGetVersion) {
|
||||
warnings.push_back("calGetVersion() missing from CAL library");
|
||||
goto leave;
|
||||
}
|
||||
if (!__calDeviceGetCount) {
|
||||
if (!p_calDeviceGetCount) {
|
||||
warnings.push_back("calDeviceGetCount() missing from CAL library");
|
||||
goto leave;
|
||||
}
|
||||
if (!__calDeviceGetAttribs) {
|
||||
if (!p_calDeviceGetAttribs) {
|
||||
warnings.push_back("calDeviceGetAttribs() missing from CAL library");
|
||||
goto leave;
|
||||
}
|
||||
if (!__calDeviceGetInfo) {
|
||||
if (!p_calDeviceGetInfo) {
|
||||
warnings.push_back("calDeviceGetInfo() missing from CAL library");
|
||||
goto leave;
|
||||
}
|
||||
|
||||
retval = (*__calInit)();
|
||||
retval = (*p_calInit)();
|
||||
if (retval != CAL_RESULT_OK) {
|
||||
snprintf(buf, sizeof(buf), "calInit() returned %d", retval);
|
||||
warnings.push_back(buf);
|
||||
goto leave;
|
||||
}
|
||||
retval = (*__calDeviceGetCount)(&numDevices);
|
||||
retval = (*p_calDeviceGetCount)(&numDevices);
|
||||
if (retval != CAL_RESULT_OK) {
|
||||
snprintf(buf, sizeof(buf), "calDeviceGetCount() returned %d", retval);
|
||||
warnings.push_back(buf);
|
||||
goto leave;
|
||||
}
|
||||
retval = (*__calGetVersion)(&cal_major, &cal_minor, &cal_imp);
|
||||
retval = (*p_calGetVersion)(&cal_major, &cal_minor, &cal_imp);
|
||||
if (retval != CAL_RESULT_OK) {
|
||||
snprintf(buf, sizeof(buf), "calGetVersion() returned %d", retval);
|
||||
warnings.push_back(buf);
|
||||
|
@ -225,13 +225,13 @@ void COPROC_ATI::get(
|
|||
}
|
||||
|
||||
for (CALuint i=0; i<numDevices; i++) {
|
||||
retval = (*__calDeviceGetInfo)(&info, i);
|
||||
retval = (*p_calDeviceGetInfo)(&info, i);
|
||||
if (retval != CAL_RESULT_OK) {
|
||||
snprintf(buf, sizeof(buf), "calDeviceGetInfo() returned %d", retval);
|
||||
warnings.push_back(buf);
|
||||
goto leave;
|
||||
}
|
||||
retval = (*__calDeviceGetAttribs)(&attribs, i);
|
||||
retval = (*p_calDeviceGetAttribs)(&attribs, i);
|
||||
if (retval != CAL_RESULT_OK) {
|
||||
snprintf(buf, sizeof(buf), "calDeviceGetAttribs() returned %d", retval);
|
||||
warnings.push_back(buf);
|
||||
|
@ -383,7 +383,7 @@ void COPROC_ATI::get(
|
|||
|
||||
// shut down CAL, otherwise Lenovo won't be able to switch to low-power GPU
|
||||
//
|
||||
retval = (*__calShutdown)();
|
||||
retval = (*p_calShutdown)();
|
||||
|
||||
if (!ati_gpus.size()) {
|
||||
warnings.push_back("No ATI GPUs found");
|
||||
|
@ -467,20 +467,20 @@ static void get_available_ati_ram(COPROC_ATI &cc, vector<string>& warnings) {
|
|||
|
||||
st.struct_size = sizeof(CALdevicestatus);
|
||||
|
||||
if (!__calDeviceOpen) {
|
||||
if (!p_calDeviceOpen) {
|
||||
warnings.push_back("calDeviceOpen() missing from CAL library");
|
||||
return;
|
||||
}
|
||||
if (!__calDeviceGetStatus) {
|
||||
if (!p_calDeviceGetStatus) {
|
||||
warnings.push_back("calDeviceGetStatus() missing from CAL library");
|
||||
return;
|
||||
}
|
||||
if (!__calDeviceClose) {
|
||||
if (!p_calDeviceClose) {
|
||||
warnings.push_back("calDeviceClose() missing from CAL library");
|
||||
return;
|
||||
}
|
||||
|
||||
retval = (*__calDeviceOpen)(&dev, cc.device_num);
|
||||
retval = (*p_calDeviceOpen)(&dev, cc.device_num);
|
||||
if (retval) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"[coproc] calDeviceOpen(%d) returned %d", cc.device_num, retval
|
||||
|
@ -488,16 +488,16 @@ static void get_available_ati_ram(COPROC_ATI &cc, vector<string>& warnings) {
|
|||
warnings.push_back(buf);
|
||||
return;
|
||||
}
|
||||
retval = (*__calDeviceGetStatus)(&st, dev);
|
||||
retval = (*p_calDeviceGetStatus)(&st, dev);
|
||||
if (retval) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"[coproc] calDeviceGetStatus(%d) returned %d",
|
||||
cc.device_num, retval
|
||||
);
|
||||
warnings.push_back(buf);
|
||||
(*__calDeviceClose)(dev);
|
||||
(*p_calDeviceClose)(dev);
|
||||
return;
|
||||
}
|
||||
cc.available_ram = st.availLocalRAM*MEGA;
|
||||
(*__calDeviceClose)(dev);
|
||||
(*p_calDeviceClose)(dev);
|
||||
}
|
||||
|
|
|
@ -201,33 +201,33 @@ typedef int (__stdcall *CUDA_MA)(unsigned int*, size_t);
|
|||
typedef int (__stdcall *CUDA_MF)(unsigned int);
|
||||
typedef int (__stdcall *CUDA_MGI)(size_t*, size_t*);
|
||||
|
||||
CUDA_GDC __cuDeviceGetCount = NULL;
|
||||
CUDA_GDV __cuDriverGetVersion = NULL;
|
||||
CUDA_GDI __cuInit = NULL;
|
||||
CUDA_GDG __cuDeviceGet = NULL;
|
||||
CUDA_GDA __cuDeviceGetAttribute = NULL;
|
||||
CUDA_GDN __cuDeviceGetName = NULL;
|
||||
CUDA_GDM __cuDeviceTotalMem = NULL;
|
||||
CUDA_GDCC __cuDeviceComputeCapability = NULL;
|
||||
CUDA_CC __cuCtxCreate = NULL;
|
||||
CUDA_CD __cuCtxDestroy = NULL;
|
||||
CUDA_MA __cuMemAlloc = NULL;
|
||||
CUDA_MF __cuMemFree = NULL;
|
||||
CUDA_MGI __cuMemGetInfo = NULL;
|
||||
CUDA_GDC p_cuDeviceGetCount = NULL;
|
||||
CUDA_GDV p_cuDriverGetVersion = NULL;
|
||||
CUDA_GDI p_cuInit = NULL;
|
||||
CUDA_GDG p_cuDeviceGet = NULL;
|
||||
CUDA_GDA p_cuDeviceGetAttribute = NULL;
|
||||
CUDA_GDN p_cuDeviceGetName = NULL;
|
||||
CUDA_GDM p_cuDeviceTotalMem = NULL;
|
||||
CUDA_GDCC p_cuDeviceComputeCapability = NULL;
|
||||
CUDA_CC p_cuCtxCreate = NULL;
|
||||
CUDA_CD p_cuCtxDestroy = NULL;
|
||||
CUDA_MA p_cuMemAlloc = NULL;
|
||||
CUDA_MF p_cuMemFree = NULL;
|
||||
CUDA_MGI p_cuMemGetInfo = NULL;
|
||||
#else
|
||||
int (*__cuInit)(unsigned int);
|
||||
int (*__cuDeviceGetCount)(int*);
|
||||
int (*__cuDriverGetVersion)(int*);
|
||||
int (*__cuDeviceGet)(int*, int);
|
||||
int (*__cuDeviceGetAttribute)(int*, int, int);
|
||||
int (*__cuDeviceGetName)(char*, int, int);
|
||||
int (*__cuDeviceTotalMem)(size_t*, int);
|
||||
int (*__cuDeviceComputeCapability)(int*, int*, int);
|
||||
int (*__cuCtxCreate)(void**, unsigned int, unsigned int);
|
||||
int (*__cuCtxDestroy)(void*);
|
||||
int (*__cuMemAlloc)(unsigned int*, size_t);
|
||||
int (*__cuMemFree)(unsigned int);
|
||||
int (*__cuMemGetInfo)(size_t*, size_t*);
|
||||
int (*p_cuInit)(unsigned int);
|
||||
int (*p_cuDeviceGetCount)(int*);
|
||||
int (*p_cuDriverGetVersion)(int*);
|
||||
int (*p_cuDeviceGet)(int*, int);
|
||||
int (*p_cuDeviceGetAttribute)(int*, int, int);
|
||||
int (*p_cuDeviceGetName)(char*, int, int);
|
||||
int (*p_cuDeviceTotalMem)(size_t*, int);
|
||||
int (*p_cuDeviceComputeCapability)(int*, int*, int);
|
||||
int (*p_cuCtxCreate)(void**, unsigned int, unsigned int);
|
||||
int (*p_cuCtxDestroy)(void*);
|
||||
int (*p_cuMemAlloc)(unsigned int*, size_t);
|
||||
int (*p_cuMemFree)(unsigned int);
|
||||
int (*p_cuMemGetInfo)(size_t*, size_t*);
|
||||
#endif
|
||||
|
||||
// NVIDIA interfaces are documented here:
|
||||
|
@ -248,19 +248,19 @@ void COPROC_NVIDIA::get(
|
|||
warnings.push_back("No NVIDIA library found");
|
||||
return;
|
||||
}
|
||||
__cuDeviceGetCount = (CUDA_GDC)GetProcAddress( cudalib, "cuDeviceGetCount" );
|
||||
__cuDriverGetVersion = (CUDA_GDV)GetProcAddress( cudalib, "cuDriverGetVersion" );
|
||||
__cuInit = (CUDA_GDI)GetProcAddress( cudalib, "cuInit" );
|
||||
__cuDeviceGet = (CUDA_GDG)GetProcAddress( cudalib, "cuDeviceGet" );
|
||||
__cuDeviceGetAttribute = (CUDA_GDA)GetProcAddress( cudalib, "cuDeviceGetAttribute" );
|
||||
__cuDeviceGetName = (CUDA_GDN)GetProcAddress( cudalib, "cuDeviceGetName" );
|
||||
__cuDeviceTotalMem = (CUDA_GDM)GetProcAddress( cudalib, "cuDeviceTotalMem" );
|
||||
__cuDeviceComputeCapability = (CUDA_GDCC)GetProcAddress( cudalib, "cuDeviceComputeCapability" );
|
||||
__cuCtxCreate = (CUDA_CC)GetProcAddress( cudalib, "cuCtxCreate" );
|
||||
__cuCtxDestroy = (CUDA_CD)GetProcAddress( cudalib, "cuCtxDestroy" );
|
||||
__cuMemAlloc = (CUDA_MA)GetProcAddress( cudalib, "cuMemAlloc" );
|
||||
__cuMemFree = (CUDA_MF)GetProcAddress( cudalib, "cuMemFree" );
|
||||
__cuMemGetInfo = (CUDA_MGI)GetProcAddress( cudalib, "cuMemGetInfo" );
|
||||
p_cuDeviceGetCount = (CUDA_GDC)GetProcAddress( cudalib, "cuDeviceGetCount" );
|
||||
p_cuDriverGetVersion = (CUDA_GDV)GetProcAddress( cudalib, "cuDriverGetVersion" );
|
||||
p_cuInit = (CUDA_GDI)GetProcAddress( cudalib, "cuInit" );
|
||||
p_cuDeviceGet = (CUDA_GDG)GetProcAddress( cudalib, "cuDeviceGet" );
|
||||
p_cuDeviceGetAttribute = (CUDA_GDA)GetProcAddress( cudalib, "cuDeviceGetAttribute" );
|
||||
p_cuDeviceGetName = (CUDA_GDN)GetProcAddress( cudalib, "cuDeviceGetName" );
|
||||
p_cuDeviceTotalMem = (CUDA_GDM)GetProcAddress( cudalib, "cuDeviceTotalMem" );
|
||||
p_cuDeviceComputeCapability = (CUDA_GDCC)GetProcAddress( cudalib, "cuDeviceComputeCapability" );
|
||||
p_cuCtxCreate = (CUDA_CC)GetProcAddress( cudalib, "cuCtxCreate" );
|
||||
p_cuCtxDestroy = (CUDA_CD)GetProcAddress( cudalib, "cuCtxDestroy" );
|
||||
p_cuMemAlloc = (CUDA_MA)GetProcAddress( cudalib, "cuMemAlloc" );
|
||||
p_cuMemFree = (CUDA_MF)GetProcAddress( cudalib, "cuMemFree" );
|
||||
p_cuMemGetInfo = (CUDA_MGI)GetProcAddress( cudalib, "cuMemGetInfo" );
|
||||
|
||||
#ifndef SIM
|
||||
NvAPI_Initialize();
|
||||
|
@ -297,65 +297,65 @@ void* cudalib = NULL;
|
|||
warnings.push_back(buf);
|
||||
return;
|
||||
}
|
||||
__cuDeviceGetCount = (int(*)(int*)) dlsym(cudalib, "cuDeviceGetCount");
|
||||
__cuDriverGetVersion = (int(*)(int*)) dlsym( cudalib, "cuDriverGetVersion" );
|
||||
__cuInit = (int(*)(unsigned int)) dlsym( cudalib, "cuInit" );
|
||||
__cuDeviceGet = (int(*)(int*, int)) dlsym( cudalib, "cuDeviceGet" );
|
||||
__cuDeviceGetAttribute = (int(*)(int*, int, int)) dlsym( cudalib, "cuDeviceGetAttribute" );
|
||||
__cuDeviceGetName = (int(*)(char*, int, int)) dlsym( cudalib, "cuDeviceGetName" );
|
||||
__cuDeviceTotalMem = (int(*)(size_t*, int)) dlsym( cudalib, "cuDeviceTotalMem" );
|
||||
__cuDeviceComputeCapability = (int(*)(int*, int*, int)) dlsym( cudalib, "cuDeviceComputeCapability" );
|
||||
__cuCtxCreate = (int(*)(void**, unsigned int, unsigned int)) dlsym( cudalib, "cuCtxCreate" );
|
||||
__cuCtxDestroy = (int(*)(void*)) dlsym( cudalib, "cuCtxDestroy" );
|
||||
__cuMemAlloc = (int(*)(unsigned int*, size_t)) dlsym( cudalib, "cuMemAlloc" );
|
||||
__cuMemFree = (int(*)(unsigned int)) dlsym( cudalib, "cuMemFree" );
|
||||
__cuMemGetInfo = (int(*)(size_t*, size_t*)) dlsym( cudalib, "cuMemGetInfo" );
|
||||
p_cuDeviceGetCount = (int(*)(int*)) dlsym(cudalib, "cuDeviceGetCount");
|
||||
p_cuDriverGetVersion = (int(*)(int*)) dlsym( cudalib, "cuDriverGetVersion" );
|
||||
p_cuInit = (int(*)(unsigned int)) dlsym( cudalib, "cuInit" );
|
||||
p_cuDeviceGet = (int(*)(int*, int)) dlsym( cudalib, "cuDeviceGet" );
|
||||
p_cuDeviceGetAttribute = (int(*)(int*, int, int)) dlsym( cudalib, "cuDeviceGetAttribute" );
|
||||
p_cuDeviceGetName = (int(*)(char*, int, int)) dlsym( cudalib, "cuDeviceGetName" );
|
||||
p_cuDeviceTotalMem = (int(*)(size_t*, int)) dlsym( cudalib, "cuDeviceTotalMem" );
|
||||
p_cuDeviceComputeCapability = (int(*)(int*, int*, int)) dlsym( cudalib, "cuDeviceComputeCapability" );
|
||||
p_cuCtxCreate = (int(*)(void**, unsigned int, unsigned int)) dlsym( cudalib, "cuCtxCreate" );
|
||||
p_cuCtxDestroy = (int(*)(void*)) dlsym( cudalib, "cuCtxDestroy" );
|
||||
p_cuMemAlloc = (int(*)(unsigned int*, size_t)) dlsym( cudalib, "cuMemAlloc" );
|
||||
p_cuMemFree = (int(*)(unsigned int)) dlsym( cudalib, "cuMemFree" );
|
||||
p_cuMemGetInfo = (int(*)(size_t*, size_t*)) dlsym( cudalib, "cuMemGetInfo" );
|
||||
#endif
|
||||
|
||||
if (!__cuDriverGetVersion) {
|
||||
if (!p_cuDriverGetVersion) {
|
||||
warnings.push_back("cuDriverGetVersion() missing from NVIDIA library");
|
||||
goto leave;
|
||||
}
|
||||
if (!__cuInit) {
|
||||
if (!p_cuInit) {
|
||||
warnings.push_back("cuInit() missing from NVIDIA library");
|
||||
goto leave;
|
||||
}
|
||||
if (!__cuDeviceGetCount) {
|
||||
if (!p_cuDeviceGetCount) {
|
||||
warnings.push_back("cuDeviceGetCount() missing from NVIDIA library");
|
||||
goto leave;
|
||||
}
|
||||
if (!__cuDeviceGet) {
|
||||
if (!p_cuDeviceGet) {
|
||||
warnings.push_back("cuDeviceGet() missing from NVIDIA library");
|
||||
goto leave;
|
||||
}
|
||||
if (!__cuDeviceGetAttribute) {
|
||||
if (!p_cuDeviceGetAttribute) {
|
||||
warnings.push_back("cuDeviceGetAttribute() missing from NVIDIA library");
|
||||
goto leave;
|
||||
}
|
||||
if (!__cuDeviceTotalMem) {
|
||||
if (!p_cuDeviceTotalMem) {
|
||||
warnings.push_back("cuDeviceTotalMem() missing from NVIDIA library");
|
||||
goto leave;
|
||||
}
|
||||
if (!__cuDeviceComputeCapability) {
|
||||
if (!p_cuDeviceComputeCapability) {
|
||||
warnings.push_back("cuDeviceComputeCapability() missing from NVIDIA library");
|
||||
goto leave;
|
||||
}
|
||||
if (!__cuMemAlloc) {
|
||||
if (!p_cuMemAlloc) {
|
||||
warnings.push_back("cuMemAlloc() missing from NVIDIA library");
|
||||
goto leave;
|
||||
}
|
||||
if (!__cuMemFree) {
|
||||
if (!p_cuMemFree) {
|
||||
warnings.push_back("cuMemFree() missing from NVIDIA library");
|
||||
goto leave;
|
||||
}
|
||||
|
||||
retval = (*__cuInit)(0);
|
||||
retval = (*p_cuInit)(0);
|
||||
#ifdef __APPLE__
|
||||
// If system is just booting, CUDA driver may not be ready yet
|
||||
if (retval) {
|
||||
if (get_system_uptime() < 300) { // Retry only if system has been up for under 5 minutes
|
||||
for (int retryCount=0; retryCount<120; retryCount++) {
|
||||
retval = (*__cuInit)(0);
|
||||
retval = (*p_cuInit)(0);
|
||||
if (!retval) break;
|
||||
boinc_sleep(1.);
|
||||
continue;
|
||||
|
@ -370,7 +370,7 @@ void* cudalib = NULL;
|
|||
goto leave;
|
||||
}
|
||||
|
||||
retval = (*__cuDriverGetVersion)(&cuda_version);
|
||||
retval = (*p_cuDriverGetVersion)(&cuda_version);
|
||||
if (retval) {
|
||||
sprintf(buf, "cuDriverGetVersion() returned %d", retval);
|
||||
warnings.push_back(buf);
|
||||
|
@ -379,7 +379,7 @@ void* cudalib = NULL;
|
|||
|
||||
have_cuda = true;
|
||||
|
||||
retval = (*__cuDeviceGetCount)(&cuda_ndevs);
|
||||
retval = (*p_cuDeviceGetCount)(&cuda_ndevs);
|
||||
if (retval) {
|
||||
sprintf(buf, "cuDeviceGetCount() returned %d", retval);
|
||||
warnings.push_back(buf);
|
||||
|
@ -391,44 +391,44 @@ void* cudalib = NULL;
|
|||
for (j=0; j<cuda_ndevs; j++) {
|
||||
memset(&cc.prop, 0, sizeof(cc.prop));
|
||||
CUdevice device;
|
||||
retval = (*__cuDeviceGet)(&device, j);
|
||||
retval = (*p_cuDeviceGet)(&device, j);
|
||||
if (retval) {
|
||||
sprintf(buf, "cuDeviceGet(%d) returned %d", j, retval);
|
||||
warnings.push_back(buf);
|
||||
goto leave;
|
||||
}
|
||||
(*__cuDeviceGetName)(cc.prop.name, 256, device);
|
||||
(*p_cuDeviceGetName)(cc.prop.name, 256, device);
|
||||
if (retval) {
|
||||
sprintf(buf, "cuDeviceGetName(%d) returned %d", j, retval);
|
||||
warnings.push_back(buf);
|
||||
goto leave;
|
||||
}
|
||||
(*__cuDeviceComputeCapability)(&cc.prop.major, &cc.prop.minor, device);
|
||||
(*__cuDeviceTotalMem)(&global_mem, device);
|
||||
(*p_cuDeviceComputeCapability)(&cc.prop.major, &cc.prop.minor, device);
|
||||
(*p_cuDeviceTotalMem)(&global_mem, device);
|
||||
cc.prop.totalGlobalMem = (double) global_mem;
|
||||
(*__cuDeviceGetAttribute)(&itemp, CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK, device);
|
||||
(*p_cuDeviceGetAttribute)(&itemp, CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK, device);
|
||||
cc.prop.sharedMemPerBlock = (double) itemp;
|
||||
(*__cuDeviceGetAttribute)(&cc.prop.regsPerBlock, CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK, device);
|
||||
(*__cuDeviceGetAttribute)(&cc.prop.warpSize, CU_DEVICE_ATTRIBUTE_WARP_SIZE, device);
|
||||
(*__cuDeviceGetAttribute)(&itemp, CU_DEVICE_ATTRIBUTE_MAX_PITCH, device);
|
||||
(*p_cuDeviceGetAttribute)(&cc.prop.regsPerBlock, CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK, device);
|
||||
(*p_cuDeviceGetAttribute)(&cc.prop.warpSize, CU_DEVICE_ATTRIBUTE_WARP_SIZE, device);
|
||||
(*p_cuDeviceGetAttribute)(&itemp, CU_DEVICE_ATTRIBUTE_MAX_PITCH, device);
|
||||
cc.prop.memPitch = (double) itemp;
|
||||
retval = (*__cuDeviceGetAttribute)(&cc.prop.maxThreadsPerBlock, CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK, device);
|
||||
retval = (*__cuDeviceGetAttribute)(&cc.prop.maxThreadsDim[0], CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X, device);
|
||||
(*__cuDeviceGetAttribute)(&cc.prop.maxThreadsDim[1], CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y, device);
|
||||
(*__cuDeviceGetAttribute)(&cc.prop.maxThreadsDim[2], CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z, device);
|
||||
(*__cuDeviceGetAttribute)(&cc.prop.maxGridSize[0], CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X, device);
|
||||
(*__cuDeviceGetAttribute)(&cc.prop.maxGridSize[1], CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y, device);
|
||||
(*__cuDeviceGetAttribute)(&cc.prop.maxGridSize[2], CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z, device);
|
||||
(*__cuDeviceGetAttribute)(&cc.prop.clockRate, CU_DEVICE_ATTRIBUTE_CLOCK_RATE, device);
|
||||
(*__cuDeviceGetAttribute)(&itemp, CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY, device);
|
||||
retval = (*p_cuDeviceGetAttribute)(&cc.prop.maxThreadsPerBlock, CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK, device);
|
||||
retval = (*p_cuDeviceGetAttribute)(&cc.prop.maxThreadsDim[0], CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X, device);
|
||||
(*p_cuDeviceGetAttribute)(&cc.prop.maxThreadsDim[1], CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y, device);
|
||||
(*p_cuDeviceGetAttribute)(&cc.prop.maxThreadsDim[2], CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z, device);
|
||||
(*p_cuDeviceGetAttribute)(&cc.prop.maxGridSize[0], CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X, device);
|
||||
(*p_cuDeviceGetAttribute)(&cc.prop.maxGridSize[1], CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y, device);
|
||||
(*p_cuDeviceGetAttribute)(&cc.prop.maxGridSize[2], CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z, device);
|
||||
(*p_cuDeviceGetAttribute)(&cc.prop.clockRate, CU_DEVICE_ATTRIBUTE_CLOCK_RATE, device);
|
||||
(*p_cuDeviceGetAttribute)(&itemp, CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY, device);
|
||||
cc.prop.totalConstMem = (double) itemp;
|
||||
(*__cuDeviceGetAttribute)(&itemp, CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT, device);
|
||||
(*p_cuDeviceGetAttribute)(&itemp, CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT, device);
|
||||
cc.prop.textureAlignment = (double) itemp;
|
||||
(*__cuDeviceGetAttribute)(&cc.prop.deviceOverlap, CU_DEVICE_ATTRIBUTE_GPU_OVERLAP, device);
|
||||
(*__cuDeviceGetAttribute)(&cc.prop.multiProcessorCount, CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT, device);
|
||||
(*__cuDeviceGetAttribute)(&cc.pci_info.bus_id, CU_DEVICE_ATTRIBUTE_PCI_BUS_ID, device);
|
||||
(*__cuDeviceGetAttribute)(&cc.pci_info.device_id, CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID, device);
|
||||
(*__cuDeviceGetAttribute)(&cc.pci_info.domain_id, CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID, device);
|
||||
(*p_cuDeviceGetAttribute)(&cc.prop.deviceOverlap, CU_DEVICE_ATTRIBUTE_GPU_OVERLAP, device);
|
||||
(*p_cuDeviceGetAttribute)(&cc.prop.multiProcessorCount, CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT, device);
|
||||
(*p_cuDeviceGetAttribute)(&cc.pci_info.bus_id, CU_DEVICE_ATTRIBUTE_PCI_BUS_ID, device);
|
||||
(*p_cuDeviceGetAttribute)(&cc.pci_info.device_id, CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID, device);
|
||||
(*p_cuDeviceGetAttribute)(&cc.pci_info.domain_id, CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID, device);
|
||||
if (cc.prop.major <= 0) continue; // major == 0 means emulation
|
||||
if (cc.prop.major > 100) continue; // e.g. 9999 is an error
|
||||
#if defined(_WIN32) && !defined(SIM)
|
||||
|
@ -539,24 +539,24 @@ static void get_available_nvidia_ram(COPROC_NVIDIA &cc, vector<string>& warnings
|
|||
char buf[256];
|
||||
|
||||
cc.available_ram = cc.prop.totalGlobalMem;
|
||||
if (!__cuDeviceGet) {
|
||||
if (!p_cuDeviceGet) {
|
||||
warnings.push_back("cuDeviceGet() missing from NVIDIA library");
|
||||
return;
|
||||
}
|
||||
if (!__cuCtxCreate) {
|
||||
if (!p_cuCtxCreate) {
|
||||
warnings.push_back("cuCtxCreate() missing from NVIDIA library");
|
||||
return;
|
||||
}
|
||||
if (!__cuCtxDestroy) {
|
||||
if (!p_cuCtxDestroy) {
|
||||
warnings.push_back("cuCtxDestroy() missing from NVIDIA library");
|
||||
return;
|
||||
}
|
||||
if (!__cuMemGetInfo) {
|
||||
if (!p_cuMemGetInfo) {
|
||||
warnings.push_back("cuMemGetInfo() missing from NVIDIA library");
|
||||
return;
|
||||
}
|
||||
|
||||
retval = (*__cuDeviceGet)(&device, cc.device_num);
|
||||
retval = (*p_cuDeviceGet)(&device, cc.device_num);
|
||||
if (retval) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"[coproc] cuDeviceGet(%d) returned %d", cc.device_num, retval
|
||||
|
@ -564,7 +564,7 @@ static void get_available_nvidia_ram(COPROC_NVIDIA &cc, vector<string>& warnings
|
|||
warnings.push_back(buf);
|
||||
return;
|
||||
}
|
||||
retval = (*__cuCtxCreate)(&ctx, 0, device);
|
||||
retval = (*p_cuCtxCreate)(&ctx, 0, device);
|
||||
if (retval) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"[coproc] cuCtxCreate(%d) returned %d", cc.device_num, retval
|
||||
|
@ -572,16 +572,16 @@ static void get_available_nvidia_ram(COPROC_NVIDIA &cc, vector<string>& warnings
|
|||
warnings.push_back(buf);
|
||||
return;
|
||||
}
|
||||
retval = (*__cuMemGetInfo)(&memfree, &memtotal);
|
||||
retval = (*p_cuMemGetInfo)(&memfree, &memtotal);
|
||||
if (retval) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"[coproc] cuMemGetInfo(%d) returned %d", cc.device_num, retval
|
||||
);
|
||||
warnings.push_back(buf);
|
||||
(*__cuCtxDestroy)(ctx);
|
||||
(*p_cuCtxDestroy)(ctx);
|
||||
return;
|
||||
}
|
||||
(*__cuCtxDestroy)(ctx);
|
||||
(*p_cuCtxDestroy)(ctx);
|
||||
cc.available_ram = (double) memfree;
|
||||
}
|
||||
|
||||
|
@ -602,11 +602,11 @@ static void get_available_nvidia_ram(COPROC_NVIDIA &cc, vector<string>& warnings
|
|||
bool COPROC_NVIDIA::check_running_graphics_app() {
|
||||
int retval, j;
|
||||
bool change = false;
|
||||
if (!__cuDeviceGet) {
|
||||
if (!p_cuDeviceGet) {
|
||||
warnings.push_back("cuDeviceGet() missing from NVIDIA library");
|
||||
return;
|
||||
}
|
||||
if (!__cuDeviceGetAttribute) {
|
||||
if (!p_cuDeviceGetAttribute) {
|
||||
warnings.push_back("cuDeviceGetAttribute() missing from NVIDIA library");
|
||||
return;
|
||||
}
|
||||
|
@ -614,9 +614,9 @@ bool COPROC_NVIDIA::check_running_graphics_app() {
|
|||
for (j=0; j<count; j++) {
|
||||
bool new_val = true;
|
||||
int device, kernel_timeout;
|
||||
retval = (*__cuDeviceGet)(&device, j);
|
||||
retval = (*p_cuDeviceGet)(&device, j);
|
||||
if (!retval) {
|
||||
retval = (*__cuDeviceGetAttribute)(&kernel_timeout, CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT, device);
|
||||
retval = (*p_cuDeviceGetAttribute)(&kernel_timeout, CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT, device);
|
||||
if (!retval && !kernel_timeout) {
|
||||
new_val = false;
|
||||
}
|
||||
|
|
|
@ -57,35 +57,35 @@ typedef cl_int (__stdcall *CL_PLATFORMINFO) (cl_platform_id, cl_platform_info, s
|
|||
typedef cl_int (__stdcall *CL_DEVICEIDS)(cl_platform_id, cl_device_type, cl_uint, cl_device_id*, cl_uint*);
|
||||
typedef cl_int (__stdcall *CL_INFO) (cl_device_id, cl_device_info, size_t, void*, size_t*);
|
||||
|
||||
CL_PLATFORMIDS __clGetPlatformIDs = NULL;
|
||||
CL_PLATFORMINFO __clGetPlatformInfo = NULL;
|
||||
CL_DEVICEIDS __clGetDeviceIDs = NULL;
|
||||
CL_INFO __clGetDeviceInfo = NULL;
|
||||
CL_PLATFORMIDS p_clGetPlatformIDs = NULL;
|
||||
CL_PLATFORMINFO p_clGetPlatformInfo = NULL;
|
||||
CL_DEVICEIDS p_clGetDeviceIDs = NULL;
|
||||
CL_INFO p_clGetDeviceInfo = NULL;
|
||||
|
||||
#else
|
||||
|
||||
void* opencl_lib = NULL;
|
||||
|
||||
cl_int (*__clGetPlatformIDs)(
|
||||
cl_int (*p_clGetPlatformIDs)(
|
||||
cl_uint, // num_entries,
|
||||
cl_platform_id*, // platforms
|
||||
cl_uint * // num_platforms
|
||||
);
|
||||
cl_int (*__clGetPlatformInfo)(
|
||||
cl_int (*p_clGetPlatformInfo)(
|
||||
cl_platform_id, // platform
|
||||
cl_platform_info, // param_name
|
||||
size_t, // param_value_size
|
||||
void*, // param_value
|
||||
size_t* // param_value_size_ret
|
||||
);
|
||||
cl_int (*__clGetDeviceIDs)(
|
||||
cl_int (*p_clGetDeviceIDs)(
|
||||
cl_platform_id, // platform
|
||||
cl_device_type, // device_type
|
||||
cl_uint, // num_entries
|
||||
cl_device_id*, // devices
|
||||
cl_uint* // num_devices
|
||||
);
|
||||
cl_int (*__clGetDeviceInfo)(
|
||||
cl_int (*p_clGetDeviceInfo)(
|
||||
cl_device_id, // device
|
||||
cl_device_info, // param_name
|
||||
size_t, // param_value_size
|
||||
|
@ -175,10 +175,10 @@ void COPROCS::get_opencl(
|
|||
return;
|
||||
}
|
||||
|
||||
__clGetPlatformIDs = (CL_PLATFORMIDS)GetProcAddress( opencl_lib, "clGetPlatformIDs" );
|
||||
__clGetPlatformInfo = (CL_PLATFORMINFO)GetProcAddress( opencl_lib, "clGetPlatformInfo" );
|
||||
__clGetDeviceIDs = (CL_DEVICEIDS)GetProcAddress( opencl_lib, "clGetDeviceIDs" );
|
||||
__clGetDeviceInfo = (CL_INFO)GetProcAddress( opencl_lib, "clGetDeviceInfo" );
|
||||
p_clGetPlatformIDs = (CL_PLATFORMIDS)GetProcAddress( opencl_lib, "clGetPlatformIDs" );
|
||||
p_clGetPlatformInfo = (CL_PLATFORMINFO)GetProcAddress( opencl_lib, "clGetPlatformInfo" );
|
||||
p_clGetDeviceIDs = (CL_DEVICEIDS)GetProcAddress( opencl_lib, "clGetDeviceIDs" );
|
||||
p_clGetDeviceInfo = (CL_INFO)GetProcAddress( opencl_lib, "clGetDeviceInfo" );
|
||||
#else
|
||||
#ifdef __APPLE__
|
||||
opencl_lib = dlopen("/System/Library/Frameworks/OpenCL.framework/Versions/Current/OpenCL", RTLD_NOW);
|
||||
|
@ -193,30 +193,30 @@ void COPROCS::get_opencl(
|
|||
warnings.push_back(buf);
|
||||
return;
|
||||
}
|
||||
__clGetPlatformIDs = (cl_int(*)(cl_uint, cl_platform_id*, cl_uint*)) dlsym( opencl_lib, "clGetPlatformIDs" );
|
||||
__clGetPlatformInfo = (cl_int(*)(cl_platform_id, cl_platform_info, size_t, void*, size_t*)) dlsym( opencl_lib, "clGetPlatformInfo" );
|
||||
__clGetDeviceIDs = (cl_int(*)(cl_platform_id, cl_device_type, cl_uint, cl_device_id*, cl_uint*)) dlsym( opencl_lib, "clGetDeviceIDs" );
|
||||
__clGetDeviceInfo = (cl_int(*)(cl_device_id, cl_device_info, size_t, void*, size_t*)) dlsym( opencl_lib, "clGetDeviceInfo" );
|
||||
p_clGetPlatformIDs = (cl_int(*)(cl_uint, cl_platform_id*, cl_uint*)) dlsym( opencl_lib, "clGetPlatformIDs" );
|
||||
p_clGetPlatformInfo = (cl_int(*)(cl_platform_id, cl_platform_info, size_t, void*, size_t*)) dlsym( opencl_lib, "clGetPlatformInfo" );
|
||||
p_clGetDeviceIDs = (cl_int(*)(cl_platform_id, cl_device_type, cl_uint, cl_device_id*, cl_uint*)) dlsym( opencl_lib, "clGetDeviceIDs" );
|
||||
p_clGetDeviceInfo = (cl_int(*)(cl_device_id, cl_device_info, size_t, void*, size_t*)) dlsym( opencl_lib, "clGetDeviceInfo" );
|
||||
#endif
|
||||
|
||||
if (!__clGetPlatformIDs) {
|
||||
if (!p_clGetPlatformIDs) {
|
||||
warnings.push_back("clGetPlatformIDs() missing from OpenCL library");
|
||||
goto leave;
|
||||
}
|
||||
if (!__clGetPlatformInfo) {
|
||||
if (!p_clGetPlatformInfo) {
|
||||
warnings.push_back("clGetPlatformInfo() missing from OpenCL library");
|
||||
goto leave;
|
||||
}
|
||||
if (!__clGetDeviceIDs) {
|
||||
if (!p_clGetDeviceIDs) {
|
||||
warnings.push_back("clGetDeviceIDs() missing from OpenCL library");
|
||||
goto leave;
|
||||
}
|
||||
if (!__clGetDeviceInfo) {
|
||||
if (!p_clGetDeviceInfo) {
|
||||
warnings.push_back("clGetDeviceInfo() missing from OpenCL library");
|
||||
goto leave;
|
||||
}
|
||||
|
||||
ciErrNum = (*__clGetPlatformIDs)(MAX_OPENCL_PLATFORMS, platforms, &num_platforms);
|
||||
ciErrNum = (*p_clGetPlatformIDs)(MAX_OPENCL_PLATFORMS, platforms, &num_platforms);
|
||||
if ((ciErrNum != CL_SUCCESS) || (num_platforms == 0)) {
|
||||
warnings.push_back("clGetPlatformIDs() failed to return any OpenCL platforms");
|
||||
goto leave;
|
||||
|
@ -236,7 +236,7 @@ void COPROCS::get_opencl(
|
|||
}
|
||||
|
||||
for (platform_index=0; platform_index<num_platforms; ++platform_index) {
|
||||
ciErrNum = (*__clGetPlatformInfo)(
|
||||
ciErrNum = (*p_clGetPlatformInfo)(
|
||||
platforms[platform_index], CL_PLATFORM_VERSION,
|
||||
sizeof(platform_version), &platform_version, NULL
|
||||
);
|
||||
|
@ -249,7 +249,7 @@ void COPROCS::get_opencl(
|
|||
continue;
|
||||
}
|
||||
|
||||
ciErrNum = (*__clGetPlatformInfo)(
|
||||
ciErrNum = (*p_clGetPlatformInfo)(
|
||||
platforms[platform_index], CL_PLATFORM_VENDOR,
|
||||
sizeof(platform_vendor), &platform_vendor, NULL
|
||||
);
|
||||
|
@ -263,7 +263,7 @@ void COPROCS::get_opencl(
|
|||
|
||||
//////////// CPU //////////////
|
||||
|
||||
ciErrNum = (*__clGetDeviceIDs)(
|
||||
ciErrNum = (*p_clGetDeviceIDs)(
|
||||
platforms[platform_index], (CL_DEVICE_TYPE_CPU),
|
||||
MAX_COPROC_INSTANCES, devices, &num_devices
|
||||
);
|
||||
|
@ -301,7 +301,7 @@ void COPROCS::get_opencl(
|
|||
|
||||
//////////// GPUs and Accelerators //////////////
|
||||
|
||||
ciErrNum = (*__clGetDeviceIDs)(
|
||||
ciErrNum = (*p_clGetDeviceIDs)(
|
||||
platforms[platform_index],
|
||||
(CL_DEVICE_TYPE_GPU | CL_DEVICE_TYPE_ACCELERATOR),
|
||||
MAX_COPROC_INSTANCES, devices, &num_devices
|
||||
|
@ -666,7 +666,7 @@ cl_int COPROCS::get_opencl_info(
|
|||
cl_int ciErrNum;
|
||||
char buf[256];
|
||||
|
||||
ciErrNum = (*__clGetDeviceInfo)(prop.device_id, CL_DEVICE_NAME, sizeof(prop.name), prop.name, NULL);
|
||||
ciErrNum = (*p_clGetDeviceInfo)(prop.device_id, CL_DEVICE_NAME, sizeof(prop.name), prop.name, NULL);
|
||||
if ((ciErrNum != CL_SUCCESS) || (prop.name[0] == 0)) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"clGetDeviceInfo failed to get name for device %d",
|
||||
|
@ -676,7 +676,7 @@ cl_int COPROCS::get_opencl_info(
|
|||
return ciErrNum;
|
||||
}
|
||||
|
||||
ciErrNum = (*__clGetDeviceInfo)(prop.device_id, CL_DEVICE_VENDOR, sizeof(prop.vendor), prop.vendor, NULL);
|
||||
ciErrNum = (*p_clGetDeviceInfo)(prop.device_id, CL_DEVICE_VENDOR, sizeof(prop.vendor), prop.vendor, NULL);
|
||||
if ((ciErrNum != CL_SUCCESS) || (prop.vendor[0] == 0)) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"clGetDeviceInfo failed to get vendor for device %d",
|
||||
|
@ -686,7 +686,7 @@ cl_int COPROCS::get_opencl_info(
|
|||
return ciErrNum;
|
||||
}
|
||||
|
||||
ciErrNum = (*__clGetDeviceInfo)(prop.device_id, CL_DEVICE_VENDOR_ID, sizeof(prop.vendor_id), &prop.vendor_id, NULL);
|
||||
ciErrNum = (*p_clGetDeviceInfo)(prop.device_id, CL_DEVICE_VENDOR_ID, sizeof(prop.vendor_id), &prop.vendor_id, NULL);
|
||||
if (ciErrNum != CL_SUCCESS) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"clGetDeviceInfo failed to get vendor ID for device %d",
|
||||
|
@ -696,7 +696,7 @@ cl_int COPROCS::get_opencl_info(
|
|||
return ciErrNum;
|
||||
}
|
||||
|
||||
ciErrNum = (*__clGetDeviceInfo)(prop.device_id, CL_DEVICE_AVAILABLE, sizeof(prop.available), &prop.available, NULL);
|
||||
ciErrNum = (*p_clGetDeviceInfo)(prop.device_id, CL_DEVICE_AVAILABLE, sizeof(prop.available), &prop.available, NULL);
|
||||
if (ciErrNum != CL_SUCCESS) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"clGetDeviceInfo failed to get availability for device %d",
|
||||
|
@ -706,7 +706,7 @@ cl_int COPROCS::get_opencl_info(
|
|||
return ciErrNum;
|
||||
}
|
||||
|
||||
ciErrNum = (*__clGetDeviceInfo)(
|
||||
ciErrNum = (*p_clGetDeviceInfo)(
|
||||
prop.device_id, CL_DEVICE_HALF_FP_CONFIG,
|
||||
sizeof(prop.half_fp_config), &prop.half_fp_config, NULL
|
||||
);
|
||||
|
@ -723,7 +723,7 @@ cl_int COPROCS::get_opencl_info(
|
|||
}
|
||||
}
|
||||
|
||||
ciErrNum = (*__clGetDeviceInfo)(
|
||||
ciErrNum = (*p_clGetDeviceInfo)(
|
||||
prop.device_id, CL_DEVICE_SINGLE_FP_CONFIG,
|
||||
sizeof(prop.single_fp_config), &prop.single_fp_config, NULL
|
||||
);
|
||||
|
@ -736,7 +736,7 @@ cl_int COPROCS::get_opencl_info(
|
|||
return ciErrNum;
|
||||
}
|
||||
|
||||
ciErrNum = (*__clGetDeviceInfo)(
|
||||
ciErrNum = (*p_clGetDeviceInfo)(
|
||||
prop.device_id, CL_DEVICE_DOUBLE_FP_CONFIG,
|
||||
sizeof(prop.double_fp_config), &prop.double_fp_config, NULL
|
||||
);
|
||||
|
@ -753,7 +753,7 @@ cl_int COPROCS::get_opencl_info(
|
|||
}
|
||||
}
|
||||
|
||||
ciErrNum = (*__clGetDeviceInfo)(
|
||||
ciErrNum = (*p_clGetDeviceInfo)(
|
||||
prop.device_id, CL_DEVICE_ENDIAN_LITTLE, sizeof(prop.endian_little),
|
||||
&prop.endian_little, NULL
|
||||
);
|
||||
|
@ -766,7 +766,7 @@ cl_int COPROCS::get_opencl_info(
|
|||
return ciErrNum;
|
||||
}
|
||||
|
||||
ciErrNum = (*__clGetDeviceInfo)(
|
||||
ciErrNum = (*p_clGetDeviceInfo)(
|
||||
prop.device_id, CL_DEVICE_EXECUTION_CAPABILITIES,
|
||||
sizeof(prop.execution_capabilities), &prop.execution_capabilities, NULL
|
||||
);
|
||||
|
@ -779,7 +779,7 @@ cl_int COPROCS::get_opencl_info(
|
|||
return ciErrNum;
|
||||
}
|
||||
|
||||
ciErrNum = (*__clGetDeviceInfo)(
|
||||
ciErrNum = (*p_clGetDeviceInfo)(
|
||||
prop.device_id, CL_DEVICE_EXTENSIONS, sizeof(prop.extensions),
|
||||
prop.extensions, NULL
|
||||
);
|
||||
|
@ -792,7 +792,7 @@ cl_int COPROCS::get_opencl_info(
|
|||
return ciErrNum;
|
||||
}
|
||||
|
||||
ciErrNum = (*__clGetDeviceInfo)(
|
||||
ciErrNum = (*p_clGetDeviceInfo)(
|
||||
prop.device_id, CL_DEVICE_GLOBAL_MEM_SIZE,
|
||||
sizeof(prop.global_mem_size), &prop.global_mem_size, NULL
|
||||
);
|
||||
|
@ -805,7 +805,7 @@ cl_int COPROCS::get_opencl_info(
|
|||
return ciErrNum;
|
||||
}
|
||||
|
||||
ciErrNum = (*__clGetDeviceInfo)(
|
||||
ciErrNum = (*p_clGetDeviceInfo)(
|
||||
prop.device_id, CL_DEVICE_LOCAL_MEM_SIZE,
|
||||
sizeof(prop.local_mem_size), &prop.local_mem_size, NULL
|
||||
);
|
||||
|
@ -818,7 +818,7 @@ cl_int COPROCS::get_opencl_info(
|
|||
return ciErrNum;
|
||||
}
|
||||
|
||||
ciErrNum = (*__clGetDeviceInfo)(
|
||||
ciErrNum = (*p_clGetDeviceInfo)(
|
||||
prop.device_id, CL_DEVICE_MAX_CLOCK_FREQUENCY,
|
||||
sizeof(prop.max_clock_frequency), &prop.max_clock_frequency, NULL
|
||||
);
|
||||
|
@ -831,7 +831,7 @@ cl_int COPROCS::get_opencl_info(
|
|||
return ciErrNum;
|
||||
}
|
||||
|
||||
ciErrNum = (*__clGetDeviceInfo)(
|
||||
ciErrNum = (*p_clGetDeviceInfo)(
|
||||
prop.device_id, CL_DEVICE_MAX_COMPUTE_UNITS,
|
||||
sizeof(prop.max_compute_units), &prop.max_compute_units, NULL
|
||||
);
|
||||
|
@ -844,7 +844,7 @@ cl_int COPROCS::get_opencl_info(
|
|||
return ciErrNum;
|
||||
}
|
||||
|
||||
ciErrNum = (*__clGetDeviceInfo)(prop.device_id, CL_DEVICE_VERSION, sizeof(prop.opencl_device_version), prop.opencl_device_version, NULL);
|
||||
ciErrNum = (*p_clGetDeviceInfo)(prop.device_id, CL_DEVICE_VERSION, sizeof(prop.opencl_device_version), prop.opencl_device_version, NULL);
|
||||
if (ciErrNum != CL_SUCCESS) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"clGetDeviceInfo failed to get OpenCL version supported by device %d",
|
||||
|
@ -854,7 +854,7 @@ cl_int COPROCS::get_opencl_info(
|
|||
return ciErrNum;
|
||||
}
|
||||
|
||||
ciErrNum = (*__clGetDeviceInfo)(prop.device_id, CL_DRIVER_VERSION, sizeof(prop.opencl_driver_version), prop.opencl_driver_version, NULL);
|
||||
ciErrNum = (*p_clGetDeviceInfo)(prop.device_id, CL_DRIVER_VERSION, sizeof(prop.opencl_driver_version), prop.opencl_driver_version, NULL);
|
||||
if (ciErrNum != CL_SUCCESS) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"clGetDeviceInfo failed to get OpenCL driver version for device %d",
|
||||
|
@ -867,7 +867,7 @@ cl_int COPROCS::get_opencl_info(
|
|||
// Nvidia Specific Extensions
|
||||
if (strstr(prop.extensions, "cl_nv_device_attribute_query") != NULL) {
|
||||
|
||||
ciErrNum = (*__clGetDeviceInfo)(prop.device_id, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV, sizeof(prop.nv_compute_capability_major), &prop.nv_compute_capability_major, NULL);
|
||||
ciErrNum = (*p_clGetDeviceInfo)(prop.device_id, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV, sizeof(prop.nv_compute_capability_major), &prop.nv_compute_capability_major, NULL);
|
||||
if (ciErrNum != CL_SUCCESS) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"clGetDeviceInfo failed to get CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV for device %d",
|
||||
|
@ -877,7 +877,7 @@ cl_int COPROCS::get_opencl_info(
|
|||
return ciErrNum;
|
||||
}
|
||||
|
||||
ciErrNum = (*__clGetDeviceInfo)(prop.device_id, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV, sizeof(prop.nv_compute_capability_minor), &prop.nv_compute_capability_minor, NULL);
|
||||
ciErrNum = (*p_clGetDeviceInfo)(prop.device_id, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV, sizeof(prop.nv_compute_capability_minor), &prop.nv_compute_capability_minor, NULL);
|
||||
if (ciErrNum != CL_SUCCESS) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"clGetDeviceInfo failed to get CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV for device %d",
|
||||
|
@ -892,7 +892,7 @@ cl_int COPROCS::get_opencl_info(
|
|||
// AMD Specific Extensions
|
||||
if (strstr(prop.extensions, "cl_amd_device_attribute_query") != NULL) {
|
||||
|
||||
ciErrNum = (*__clGetDeviceInfo)(prop.device_id, CL_DEVICE_BOARD_NAME_AMD, sizeof(buf), buf, NULL);
|
||||
ciErrNum = (*p_clGetDeviceInfo)(prop.device_id, CL_DEVICE_BOARD_NAME_AMD, sizeof(buf), buf, NULL);
|
||||
if (strlen(buf) && ciErrNum == CL_SUCCESS) {
|
||||
safe_strcpy(prop.name, buf);
|
||||
} else if (ciErrNum != CL_SUCCESS) {
|
||||
|
@ -904,7 +904,7 @@ cl_int COPROCS::get_opencl_info(
|
|||
return ciErrNum;
|
||||
}
|
||||
|
||||
ciErrNum = (*__clGetDeviceInfo)(prop.device_id, CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD, sizeof(prop.amd_simd_per_compute_unit), &prop.amd_simd_per_compute_unit, NULL);
|
||||
ciErrNum = (*p_clGetDeviceInfo)(prop.device_id, CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD, sizeof(prop.amd_simd_per_compute_unit), &prop.amd_simd_per_compute_unit, NULL);
|
||||
if (ciErrNum != CL_SUCCESS) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"clGetDeviceInfo failed to get CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD for device %d",
|
||||
|
@ -914,7 +914,7 @@ cl_int COPROCS::get_opencl_info(
|
|||
return ciErrNum;
|
||||
}
|
||||
|
||||
ciErrNum = (*__clGetDeviceInfo)(prop.device_id, CL_DEVICE_SIMD_WIDTH_AMD, sizeof(prop.amd_simd_width), &prop.amd_simd_width, NULL);
|
||||
ciErrNum = (*p_clGetDeviceInfo)(prop.device_id, CL_DEVICE_SIMD_WIDTH_AMD, sizeof(prop.amd_simd_width), &prop.amd_simd_width, NULL);
|
||||
if (ciErrNum != CL_SUCCESS) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"clGetDeviceInfo failed to get CL_DEVICE_SIMD_WIDTH_AMD for device %d",
|
||||
|
@ -924,7 +924,7 @@ cl_int COPROCS::get_opencl_info(
|
|||
return ciErrNum;
|
||||
}
|
||||
|
||||
ciErrNum = (*__clGetDeviceInfo)(prop.device_id, CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD, sizeof(prop.amd_simd_instruction_width), &prop.amd_simd_instruction_width, NULL);
|
||||
ciErrNum = (*p_clGetDeviceInfo)(prop.device_id, CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD, sizeof(prop.amd_simd_instruction_width), &prop.amd_simd_instruction_width, NULL);
|
||||
if (ciErrNum != CL_SUCCESS) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"clGetDeviceInfo failed to get CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD for device %d",
|
||||
|
|
Loading…
Reference in New Issue