Skip to content
Snippets Groups Projects
Commit ff6cf46f authored by Jan David Mol's avatar Jan David Mol
Browse files

Task #4341: Fixed options passed to cuModuleLoadDataEx, because CUDA expects...

Task #4341: Fixed options passed to cuModuleLoadDataEx, because CUDA expects integer values to be cast to void* directly
parent 925ff2a3
Branches
Tags
No related merge requests found
......@@ -203,31 +203,31 @@ namespace LOFAR
optionValues.push_back(&thrPerBlk); // can be read back
#endif
unsigned int infoLogSize = BUILD_MAX_LOG_SIZE + 1; // input and output var for JIT compiler
unsigned int errorLogSize = BUILD_MAX_LOG_SIZE + 1; // idem (hence not the a single var or const)
size_t infoLogSize = BUILD_MAX_LOG_SIZE + 1; // input and output var for JIT compiler
size_t errorLogSize = BUILD_MAX_LOG_SIZE + 1; // idem (hence not the a single var or const)
vector<char> infoLog(infoLogSize);
options[CU_JIT_INFO_LOG_BUFFER] = &infoLog[0];
options[CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES] = &infoLogSize;
options[CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES] = reinterpret_cast<void*>(infoLogSize);
vector<char> errorLog(errorLogSize);
options[CU_JIT_ERROR_LOG_BUFFER] = &errorLog[0];
options[CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES] = &errorLogSize;
options[CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES] = reinterpret_cast<void*>(errorLogSize);
float jitWallTime = 0.0f; // output val (init it anyway), in milliseconds
options[CU_JIT_WALL_TIME] = &jitWallTime;
#if 0
unsigned int optLvl = 4; // 0-4, default 4
options[CU_JIT_OPTIMIZATION_LEVEL] = &optLvl;
size_t optLvl = 4; // 0-4, default 4
options[CU_JIT_OPTIMIZATION_LEVEL] = reinterpret_cast<void*>(optLvl);
#endif
unsigned int jitTarget = target;
options[CU_JIT_TARGET] = reinterpret_cast<void*>(jitTarget); // cast the value itself to a void*!
size_t jitTarget = target;
options[CU_JIT_TARGET] = reinterpret_cast<void*>(jitTarget);
#if 0
CUjit_fallback_enum fallback = CU_PREFER_PTX;
options[CU_JIT_FALLBACK_STRATEGY] = &fallback;
size_t fallback = CU_PREFER_PTX;
options[CU_JIT_FALLBACK_STRATEGY] = reinterpret_cast<void*>(fallback);
#endif
try {
......
......@@ -278,6 +278,8 @@ namespace LOFAR
// \param image pointer to a module image in memory
// \param options map of \c CUjit_option items, with their associated
// values.
// \note All values are cast to void*, so if an option requires
// an unsigned int as value, the unsigned int's value itself is cast to void*!
// \note For details, please refer to the documentation of \c
// cuModuleLoadDataEx in the CUDA Driver API.
Module(const void *image, const optionmap_t &options);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment