* OpenCL now only uses GPU/Accelerator devices, it's only confusing if CPU
  device is used, easy to enable in the code for debugging.
* OpenCL kernel binaries are now cached for faster startup after the first
  time compiling.
* CUDA kernels can now be compiled and cached at runtime if the CUDA toolkit
  is installed. This means that even if the build does not have CUDA enabled,
  it's still possible to use it as long as you install the toolkit.
This commit is contained in:
Brecht Van Lommel
2011-09-09 12:04:39 +00:00
parent 9b31cba74e
commit cfbd6cf154
11 changed files with 317 additions and 46 deletions

View File

@@ -16,6 +16,8 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <stdlib.h>
#include "util_cuda.h"
#include "util_debug.h"
#include "util_dynlib.h"
@@ -371,6 +373,11 @@ bool cuLibraryInit()
/* cuda 4.0 */
CUDA_LIBRARY_FIND(cuCtxSetCurrent);
#ifndef WITH_CUDA_BINARIES
if(cuCompilerPath() == "")
return false;
#endif
/* success */
result = true;
@@ -379,13 +386,23 @@ bool cuLibraryInit()
string cuCompilerPath()
{
/* todo: better nvcc detection */
#ifdef _WIN32
string nvcc = "C:/CUDA/bin/nvcc.exe";
const char *defaultpath = "C:/CUDA/bin";
const char *executable = "nvcc.exe";
#else
string nvcc = "/usr/local/cuda/bin/nvcc";
const char *defaultpath = "/usr/local/cuda/bin";
const char *executable = "nvcc";
#endif
const char *binpath = getenv("CUDA_BIN_PATH");
string nvcc;
if(binpath)
nvcc = path_join(binpath, executable);
else
nvcc = path_join(defaultpath, executable);
return (path_exists(nvcc))? nvcc: "";
}