Blender V2.61 - r43446
|
00001 /* 00002 * Copyright 2011, Blender Foundation. 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #include <stdlib.h> 00020 00021 #include "util_cuda.h" 00022 #include "util_debug.h" 00023 #include "util_dynlib.h" 00024 #include "util_path.h" 00025 #include "util_string.h" 00026 00027 /* function defininitions */ 00028 00029 tcuInit *cuInit; 00030 tcuDriverGetVersion *cuDriverGetVersion; 00031 tcuDeviceGet *cuDeviceGet; 00032 tcuDeviceGetCount *cuDeviceGetCount; 00033 tcuDeviceGetName *cuDeviceGetName; 00034 tcuDeviceComputeCapability *cuDeviceComputeCapability; 00035 tcuDeviceTotalMem *cuDeviceTotalMem; 00036 tcuDeviceGetProperties *cuDeviceGetProperties; 00037 tcuDeviceGetAttribute *cuDeviceGetAttribute; 00038 tcuCtxCreate *cuCtxCreate; 00039 tcuCtxDestroy *cuCtxDestroy; 00040 tcuCtxAttach *cuCtxAttach; 00041 tcuCtxDetach *cuCtxDetach; 00042 tcuCtxPushCurrent *cuCtxPushCurrent; 00043 tcuCtxPopCurrent *cuCtxPopCurrent; 00044 tcuCtxGetDevice *cuCtxGetDevice; 00045 tcuCtxSynchronize *cuCtxSynchronize; 00046 tcuModuleLoad *cuModuleLoad; 00047 tcuModuleLoadData *cuModuleLoadData; 00048 tcuModuleLoadDataEx *cuModuleLoadDataEx; 00049 tcuModuleLoadFatBinary *cuModuleLoadFatBinary; 00050 tcuModuleUnload *cuModuleUnload; 00051 tcuModuleGetFunction *cuModuleGetFunction; 00052 tcuModuleGetGlobal *cuModuleGetGlobal; 00053 tcuModuleGetTexRef *cuModuleGetTexRef; 00054 tcuModuleGetSurfRef *cuModuleGetSurfRef; 00055 tcuMemGetInfo *cuMemGetInfo; 00056 tcuMemAlloc *cuMemAlloc; 00057 tcuMemAllocPitch *cuMemAllocPitch; 00058 tcuMemFree *cuMemFree; 00059 tcuMemGetAddressRange *cuMemGetAddressRange; 00060 tcuMemAllocHost *cuMemAllocHost; 00061 tcuMemFreeHost *cuMemFreeHost; 00062 tcuMemHostAlloc *cuMemHostAlloc; 00063 tcuMemHostGetDevicePointer *cuMemHostGetDevicePointer; 00064 tcuMemHostGetFlags *cuMemHostGetFlags; 00065 tcuMemcpyHtoD *cuMemcpyHtoD; 00066 tcuMemcpyDtoH *cuMemcpyDtoH; 00067 tcuMemcpyDtoD *cuMemcpyDtoD; 00068 tcuMemcpyDtoA *cuMemcpyDtoA; 00069 tcuMemcpyAtoD *cuMemcpyAtoD; 00070 tcuMemcpyHtoA *cuMemcpyHtoA; 00071 tcuMemcpyAtoH *cuMemcpyAtoH; 00072 tcuMemcpyAtoA *cuMemcpyAtoA; 00073 tcuMemcpy2D *cuMemcpy2D; 00074 tcuMemcpy2DUnaligned *cuMemcpy2DUnaligned; 00075 tcuMemcpy3D *cuMemcpy3D; 00076 tcuMemcpyHtoDAsync *cuMemcpyHtoDAsync; 00077 tcuMemcpyDtoHAsync *cuMemcpyDtoHAsync; 00078 tcuMemcpyDtoDAsync *cuMemcpyDtoDAsync; 00079 tcuMemcpyHtoAAsync *cuMemcpyHtoAAsync; 00080 tcuMemcpyAtoHAsync *cuMemcpyAtoHAsync; 00081 tcuMemcpy2DAsync *cuMemcpy2DAsync; 00082 tcuMemcpy3DAsync *cuMemcpy3DAsync; 00083 tcuMemsetD8 *cuMemsetD8; 00084 tcuMemsetD16 *cuMemsetD16; 00085 tcuMemsetD32 *cuMemsetD32; 00086 tcuMemsetD2D8 *cuMemsetD2D8; 00087 tcuMemsetD2D16 *cuMemsetD2D16; 00088 tcuMemsetD2D32 *cuMemsetD2D32; 00089 tcuFuncSetBlockShape *cuFuncSetBlockShape; 00090 tcuFuncSetSharedSize *cuFuncSetSharedSize; 00091 tcuFuncGetAttribute *cuFuncGetAttribute; 00092 tcuFuncSetCacheConfig *cuFuncSetCacheConfig; 00093 tcuArrayCreate *cuArrayCreate; 00094 tcuArrayGetDescriptor *cuArrayGetDescriptor; 00095 tcuArrayDestroy *cuArrayDestroy; 00096 tcuArray3DCreate *cuArray3DCreate; 00097 tcuArray3DGetDescriptor *cuArray3DGetDescriptor; 00098 tcuTexRefCreate *cuTexRefCreate; 00099 tcuTexRefDestroy *cuTexRefDestroy; 00100 tcuTexRefSetArray *cuTexRefSetArray; 00101 tcuTexRefSetAddress *cuTexRefSetAddress; 00102 tcuTexRefSetAddress2D *cuTexRefSetAddress2D; 00103 tcuTexRefSetFormat *cuTexRefSetFormat; 00104 tcuTexRefSetAddressMode *cuTexRefSetAddressMode; 00105 tcuTexRefSetFilterMode *cuTexRefSetFilterMode; 00106 tcuTexRefSetFlags *cuTexRefSetFlags; 00107 tcuTexRefGetAddress *cuTexRefGetAddress; 00108 tcuTexRefGetArray *cuTexRefGetArray; 00109 tcuTexRefGetAddressMode *cuTexRefGetAddressMode; 00110 tcuTexRefGetFilterMode *cuTexRefGetFilterMode; 00111 tcuTexRefGetFormat *cuTexRefGetFormat; 00112 tcuTexRefGetFlags *cuTexRefGetFlags; 00113 tcuSurfRefSetArray *cuSurfRefSetArray; 00114 tcuSurfRefGetArray *cuSurfRefGetArray; 00115 tcuParamSetSize *cuParamSetSize; 00116 tcuParamSeti *cuParamSeti; 00117 tcuParamSetf *cuParamSetf; 00118 tcuParamSetv *cuParamSetv; 00119 tcuParamSetTexRef *cuParamSetTexRef; 00120 tcuLaunch *cuLaunch; 00121 tcuLaunchGrid *cuLaunchGrid; 00122 tcuLaunchGridAsync *cuLaunchGridAsync; 00123 tcuEventCreate *cuEventCreate; 00124 tcuEventRecord *cuEventRecord; 00125 tcuEventQuery *cuEventQuery; 00126 tcuEventSynchronize *cuEventSynchronize; 00127 tcuEventDestroy *cuEventDestroy; 00128 tcuEventElapsedTime *cuEventElapsedTime; 00129 tcuStreamCreate *cuStreamCreate; 00130 tcuStreamQuery *cuStreamQuery; 00131 tcuStreamSynchronize *cuStreamSynchronize; 00132 tcuStreamDestroy *cuStreamDestroy; 00133 tcuGraphicsUnregisterResource *cuGraphicsUnregisterResource; 00134 tcuGraphicsSubResourceGetMappedArray *cuGraphicsSubResourceGetMappedArray; 00135 tcuGraphicsResourceGetMappedPointer *cuGraphicsResourceGetMappedPointer; 00136 tcuGraphicsResourceSetMapFlags *cuGraphicsResourceSetMapFlags; 00137 tcuGraphicsMapResources *cuGraphicsMapResources; 00138 tcuGraphicsUnmapResources *cuGraphicsUnmapResources; 00139 tcuGetExportTable *cuGetExportTable; 00140 tcuCtxSetLimit *cuCtxSetLimit; 00141 tcuCtxGetLimit *cuCtxGetLimit; 00142 tcuGLCtxCreate *cuGLCtxCreate; 00143 tcuGraphicsGLRegisterBuffer *cuGraphicsGLRegisterBuffer; 00144 tcuGraphicsGLRegisterImage *cuGraphicsGLRegisterImage; 00145 tcuCtxSetCurrent *cuCtxSetCurrent; 00146 00147 CCL_NAMESPACE_BEGIN 00148 00149 /* utility macros */ 00150 #define CUDA_LIBRARY_FIND_CHECKED(name) \ 00151 name = (t##name*)dynamic_library_find(lib, #name); 00152 00153 #define CUDA_LIBRARY_FIND(name) \ 00154 name = (t##name*)dynamic_library_find(lib, #name); \ 00155 assert(name); 00156 00157 #define CUDA_LIBRARY_FIND_V2(name) \ 00158 name = (t##name*)dynamic_library_find(lib, #name "_v2"); \ 00159 assert(name); 00160 00161 /* initialization function */ 00162 00163 bool cuLibraryInit() 00164 { 00165 static bool initialized = false; 00166 static bool result = false; 00167 00168 if(initialized) 00169 return result; 00170 00171 initialized = true; 00172 00173 /* library paths */ 00174 #ifdef _WIN32 00175 /* expected in c:/windows/system or similar, no path needed */ 00176 const char *path = "nvcuda.dll"; 00177 #elif defined(__APPLE__) 00178 /* default installation path */ 00179 const char *path = "/usr/local/cuda/lib/libcuda.dylib"; 00180 #else 00181 const char *path = "libcuda.so"; 00182 #endif 00183 00184 /* load library */ 00185 DynamicLibrary *lib = dynamic_library_open(path); 00186 00187 if(lib == NULL) 00188 return false; 00189 00190 /* detect driver version */ 00191 int driver_version = 1000; 00192 00193 CUDA_LIBRARY_FIND_CHECKED(cuDriverGetVersion); 00194 if(cuDriverGetVersion) 00195 cuDriverGetVersion(&driver_version); 00196 00197 /* we require version 4.0 */ 00198 if(driver_version < 4000) 00199 return false; 00200 00201 /* fetch all function pointers */ 00202 CUDA_LIBRARY_FIND(cuInit); 00203 CUDA_LIBRARY_FIND(cuDeviceGet); 00204 CUDA_LIBRARY_FIND(cuDeviceGetCount); 00205 CUDA_LIBRARY_FIND(cuDeviceGetName); 00206 CUDA_LIBRARY_FIND(cuDeviceComputeCapability); 00207 CUDA_LIBRARY_FIND(cuDeviceTotalMem); 00208 CUDA_LIBRARY_FIND(cuDeviceGetProperties); 00209 CUDA_LIBRARY_FIND(cuDeviceGetAttribute); 00210 CUDA_LIBRARY_FIND(cuCtxCreate); 00211 CUDA_LIBRARY_FIND(cuCtxDestroy); 00212 CUDA_LIBRARY_FIND(cuCtxAttach); 00213 CUDA_LIBRARY_FIND(cuCtxDetach); 00214 CUDA_LIBRARY_FIND(cuCtxPushCurrent); 00215 CUDA_LIBRARY_FIND(cuCtxPopCurrent); 00216 CUDA_LIBRARY_FIND(cuCtxGetDevice); 00217 CUDA_LIBRARY_FIND(cuCtxSynchronize); 00218 CUDA_LIBRARY_FIND(cuModuleLoad); 00219 CUDA_LIBRARY_FIND(cuModuleLoadData); 00220 CUDA_LIBRARY_FIND(cuModuleUnload); 00221 CUDA_LIBRARY_FIND(cuModuleGetFunction); 00222 CUDA_LIBRARY_FIND(cuModuleGetGlobal); 00223 CUDA_LIBRARY_FIND(cuModuleGetTexRef); 00224 CUDA_LIBRARY_FIND(cuMemGetInfo); 00225 CUDA_LIBRARY_FIND(cuMemAlloc); 00226 CUDA_LIBRARY_FIND(cuMemAllocPitch); 00227 CUDA_LIBRARY_FIND(cuMemFree); 00228 CUDA_LIBRARY_FIND(cuMemGetAddressRange); 00229 CUDA_LIBRARY_FIND(cuMemAllocHost); 00230 CUDA_LIBRARY_FIND(cuMemFreeHost); 00231 CUDA_LIBRARY_FIND(cuMemHostAlloc); 00232 CUDA_LIBRARY_FIND(cuMemHostGetDevicePointer); 00233 CUDA_LIBRARY_FIND(cuMemcpyHtoD); 00234 CUDA_LIBRARY_FIND(cuMemcpyDtoH); 00235 CUDA_LIBRARY_FIND(cuMemcpyDtoD); 00236 CUDA_LIBRARY_FIND(cuMemcpyDtoA); 00237 CUDA_LIBRARY_FIND(cuMemcpyAtoD); 00238 CUDA_LIBRARY_FIND(cuMemcpyHtoA); 00239 CUDA_LIBRARY_FIND(cuMemcpyAtoH); 00240 CUDA_LIBRARY_FIND(cuMemcpyAtoA); 00241 CUDA_LIBRARY_FIND(cuMemcpy2D); 00242 CUDA_LIBRARY_FIND(cuMemcpy2DUnaligned); 00243 CUDA_LIBRARY_FIND(cuMemcpy3D); 00244 CUDA_LIBRARY_FIND(cuMemcpyHtoDAsync); 00245 CUDA_LIBRARY_FIND(cuMemcpyDtoHAsync); 00246 CUDA_LIBRARY_FIND(cuMemcpyHtoAAsync); 00247 CUDA_LIBRARY_FIND(cuMemcpyAtoHAsync); 00248 CUDA_LIBRARY_FIND(cuMemcpy2DAsync); 00249 CUDA_LIBRARY_FIND(cuMemcpy3DAsync); 00250 CUDA_LIBRARY_FIND(cuMemsetD8); 00251 CUDA_LIBRARY_FIND(cuMemsetD16); 00252 CUDA_LIBRARY_FIND(cuMemsetD32); 00253 CUDA_LIBRARY_FIND(cuMemsetD2D8); 00254 CUDA_LIBRARY_FIND(cuMemsetD2D16); 00255 CUDA_LIBRARY_FIND(cuMemsetD2D32); 00256 CUDA_LIBRARY_FIND(cuFuncSetBlockShape); 00257 CUDA_LIBRARY_FIND(cuFuncSetSharedSize); 00258 CUDA_LIBRARY_FIND(cuFuncGetAttribute); 00259 CUDA_LIBRARY_FIND(cuArrayCreate); 00260 CUDA_LIBRARY_FIND(cuArrayGetDescriptor); 00261 CUDA_LIBRARY_FIND(cuArrayDestroy); 00262 CUDA_LIBRARY_FIND(cuArray3DCreate); 00263 CUDA_LIBRARY_FIND(cuArray3DGetDescriptor); 00264 CUDA_LIBRARY_FIND(cuTexRefCreate); 00265 CUDA_LIBRARY_FIND(cuTexRefDestroy); 00266 CUDA_LIBRARY_FIND(cuTexRefSetArray); 00267 CUDA_LIBRARY_FIND(cuTexRefSetAddress); 00268 CUDA_LIBRARY_FIND(cuTexRefSetAddress2D); 00269 CUDA_LIBRARY_FIND(cuTexRefSetFormat); 00270 CUDA_LIBRARY_FIND(cuTexRefSetAddressMode); 00271 CUDA_LIBRARY_FIND(cuTexRefSetFilterMode); 00272 CUDA_LIBRARY_FIND(cuTexRefSetFlags); 00273 CUDA_LIBRARY_FIND(cuTexRefGetAddress); 00274 CUDA_LIBRARY_FIND(cuTexRefGetArray); 00275 CUDA_LIBRARY_FIND(cuTexRefGetAddressMode); 00276 CUDA_LIBRARY_FIND(cuTexRefGetFilterMode); 00277 CUDA_LIBRARY_FIND(cuTexRefGetFormat); 00278 CUDA_LIBRARY_FIND(cuTexRefGetFlags); 00279 CUDA_LIBRARY_FIND(cuParamSetSize); 00280 CUDA_LIBRARY_FIND(cuParamSeti); 00281 CUDA_LIBRARY_FIND(cuParamSetf); 00282 CUDA_LIBRARY_FIND(cuParamSetv); 00283 CUDA_LIBRARY_FIND(cuParamSetTexRef); 00284 CUDA_LIBRARY_FIND(cuLaunch); 00285 CUDA_LIBRARY_FIND(cuLaunchGrid); 00286 CUDA_LIBRARY_FIND(cuLaunchGridAsync); 00287 CUDA_LIBRARY_FIND(cuEventCreate); 00288 CUDA_LIBRARY_FIND(cuEventRecord); 00289 CUDA_LIBRARY_FIND(cuEventQuery); 00290 CUDA_LIBRARY_FIND(cuEventSynchronize); 00291 CUDA_LIBRARY_FIND(cuEventDestroy); 00292 CUDA_LIBRARY_FIND(cuEventElapsedTime); 00293 CUDA_LIBRARY_FIND(cuStreamCreate); 00294 CUDA_LIBRARY_FIND(cuStreamQuery); 00295 CUDA_LIBRARY_FIND(cuStreamSynchronize); 00296 CUDA_LIBRARY_FIND(cuStreamDestroy); 00297 00298 /* cuda 2.1 */ 00299 CUDA_LIBRARY_FIND(cuModuleLoadDataEx); 00300 CUDA_LIBRARY_FIND(cuModuleLoadFatBinary); 00301 CUDA_LIBRARY_FIND(cuGLCtxCreate); 00302 CUDA_LIBRARY_FIND(cuGraphicsGLRegisterBuffer); 00303 CUDA_LIBRARY_FIND(cuGraphicsGLRegisterImage); 00304 00305 /* cuda 2.3 */ 00306 CUDA_LIBRARY_FIND(cuMemHostGetFlags); 00307 CUDA_LIBRARY_FIND(cuGraphicsGLRegisterBuffer); 00308 CUDA_LIBRARY_FIND(cuGraphicsGLRegisterImage); 00309 00310 /* cuda 3.0 */ 00311 CUDA_LIBRARY_FIND(cuMemcpyDtoDAsync); 00312 CUDA_LIBRARY_FIND(cuFuncSetCacheConfig); 00313 CUDA_LIBRARY_FIND(cuGraphicsUnregisterResource); 00314 CUDA_LIBRARY_FIND(cuGraphicsSubResourceGetMappedArray); 00315 CUDA_LIBRARY_FIND(cuGraphicsResourceGetMappedPointer); 00316 CUDA_LIBRARY_FIND(cuGraphicsResourceSetMapFlags); 00317 CUDA_LIBRARY_FIND(cuGraphicsMapResources); 00318 CUDA_LIBRARY_FIND(cuGraphicsUnmapResources); 00319 CUDA_LIBRARY_FIND(cuGetExportTable); 00320 00321 /* cuda 3.1 */ 00322 CUDA_LIBRARY_FIND(cuModuleGetSurfRef); 00323 CUDA_LIBRARY_FIND(cuSurfRefSetArray); 00324 CUDA_LIBRARY_FIND(cuSurfRefGetArray); 00325 CUDA_LIBRARY_FIND(cuCtxSetLimit); 00326 CUDA_LIBRARY_FIND(cuCtxGetLimit); 00327 00328 /* functions which changed 3.1 -> 3.2 for 64 bit stuff, the cuda library 00329 has both the old ones for compatibility and new ones with _v2 postfix, 00330 we load the _v2 ones here. */ 00331 CUDA_LIBRARY_FIND_V2(cuDeviceTotalMem); 00332 CUDA_LIBRARY_FIND_V2(cuCtxCreate); 00333 CUDA_LIBRARY_FIND_V2(cuModuleGetGlobal); 00334 CUDA_LIBRARY_FIND_V2(cuMemGetInfo); 00335 CUDA_LIBRARY_FIND_V2(cuMemAlloc); 00336 CUDA_LIBRARY_FIND_V2(cuMemAllocPitch); 00337 CUDA_LIBRARY_FIND_V2(cuMemFree); 00338 CUDA_LIBRARY_FIND_V2(cuMemGetAddressRange); 00339 CUDA_LIBRARY_FIND_V2(cuMemAllocHost); 00340 CUDA_LIBRARY_FIND_V2(cuMemHostGetDevicePointer); 00341 CUDA_LIBRARY_FIND_V2(cuMemcpyHtoD); 00342 CUDA_LIBRARY_FIND_V2(cuMemcpyDtoH); 00343 CUDA_LIBRARY_FIND_V2(cuMemcpyDtoD); 00344 CUDA_LIBRARY_FIND_V2(cuMemcpyDtoA); 00345 CUDA_LIBRARY_FIND_V2(cuMemcpyAtoD); 00346 CUDA_LIBRARY_FIND_V2(cuMemcpyHtoA); 00347 CUDA_LIBRARY_FIND_V2(cuMemcpyAtoH); 00348 CUDA_LIBRARY_FIND_V2(cuMemcpyAtoA); 00349 CUDA_LIBRARY_FIND_V2(cuMemcpyHtoAAsync); 00350 CUDA_LIBRARY_FIND_V2(cuMemcpyAtoHAsync); 00351 CUDA_LIBRARY_FIND_V2(cuMemcpy2D); 00352 CUDA_LIBRARY_FIND_V2(cuMemcpy2DUnaligned); 00353 CUDA_LIBRARY_FIND_V2(cuMemcpy3D); 00354 CUDA_LIBRARY_FIND_V2(cuMemcpyHtoDAsync); 00355 CUDA_LIBRARY_FIND_V2(cuMemcpyDtoHAsync); 00356 CUDA_LIBRARY_FIND_V2(cuMemcpyDtoDAsync); 00357 CUDA_LIBRARY_FIND_V2(cuMemcpy2DAsync); 00358 CUDA_LIBRARY_FIND_V2(cuMemcpy3DAsync); 00359 CUDA_LIBRARY_FIND_V2(cuMemsetD8); 00360 CUDA_LIBRARY_FIND_V2(cuMemsetD16); 00361 CUDA_LIBRARY_FIND_V2(cuMemsetD32); 00362 CUDA_LIBRARY_FIND_V2(cuMemsetD2D8); 00363 CUDA_LIBRARY_FIND_V2(cuMemsetD2D16); 00364 CUDA_LIBRARY_FIND_V2(cuMemsetD2D32); 00365 CUDA_LIBRARY_FIND_V2(cuArrayCreate); 00366 CUDA_LIBRARY_FIND_V2(cuArrayGetDescriptor); 00367 CUDA_LIBRARY_FIND_V2(cuArray3DCreate); 00368 CUDA_LIBRARY_FIND_V2(cuArray3DGetDescriptor); 00369 CUDA_LIBRARY_FIND_V2(cuTexRefSetAddress); 00370 CUDA_LIBRARY_FIND_V2(cuTexRefSetAddress2D); 00371 CUDA_LIBRARY_FIND_V2(cuTexRefGetAddress); 00372 CUDA_LIBRARY_FIND_V2(cuGraphicsResourceGetMappedPointer); 00373 CUDA_LIBRARY_FIND_V2(cuGLCtxCreate); 00374 00375 /* cuda 4.0 */ 00376 CUDA_LIBRARY_FIND(cuCtxSetCurrent); 00377 00378 #ifndef WITH_CUDA_BINARIES 00379 #ifdef _WIN32 00380 return false; /* runtime build doesn't work at the moment */ 00381 #else 00382 if(cuCompilerPath() == "") 00383 return false; 00384 #endif 00385 #endif 00386 00387 /* success */ 00388 result = true; 00389 00390 return result; 00391 } 00392 00393 string cuCompilerPath() 00394 { 00395 #ifdef _WIN32 00396 const char *defaultpath = "C:/CUDA/bin"; 00397 const char *executable = "nvcc.exe"; 00398 #else 00399 const char *defaultpath = "/usr/local/cuda/bin"; 00400 const char *executable = "nvcc"; 00401 #endif 00402 00403 const char *binpath = getenv("CUDA_BIN_PATH"); 00404 00405 string nvcc; 00406 00407 if(binpath) 00408 nvcc = path_join(binpath, executable); 00409 else 00410 nvcc = path_join(defaultpath, executable); 00411 00412 if(path_exists(nvcc)) 00413 return nvcc; 00414 00415 #ifndef _WIN32 00416 if(system("which nvcc") == 0) 00417 return "nvcc"; 00418 #endif 00419 00420 return ""; 00421 } 00422 00423 CCL_NAMESPACE_END 00424