Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/device/cuda/device_impl.cpp
| Show All 18 Lines | |||||
| # include <climits> | # include <climits> | ||||
| # include <limits.h> | # include <limits.h> | ||||
| # include <stdio.h> | # include <stdio.h> | ||||
| # include <stdlib.h> | # include <stdlib.h> | ||||
| # include <string.h> | # include <string.h> | ||||
| # include "device/cuda/device_impl.h" | # include "device/cuda/device_impl.h" | ||||
| # include "render/buffers.h" | # include "util/debug.h" | ||||
| # include "util/foreach.h" | |||||
| # include "util/util_debug.h" | # include "util/log.h" | ||||
| # include "util/util_foreach.h" | # include "util/map.h" | ||||
| # include "util/util_logging.h" | # include "util/md5.h" | ||||
| # include "util/util_map.h" | # include "util/path.h" | ||||
| # include "util/util_md5.h" | # include "util/string.h" | ||||
| # include "util/util_path.h" | # include "util/system.h" | ||||
| # include "util/util_string.h" | # include "util/time.h" | ||||
| # include "util/util_system.h" | # include "util/types.h" | ||||
| # include "util/util_time.h" | # include "util/windows.h" | ||||
| # include "util/util_types.h" | |||||
| # include "util/util_windows.h" | |||||
| CCL_NAMESPACE_BEGIN | CCL_NAMESPACE_BEGIN | ||||
| class CUDADevice; | class CUDADevice; | ||||
| bool CUDADevice::have_precompiled_kernels() | bool CUDADevice::have_precompiled_kernels() | ||||
| { | { | ||||
| string cubins_path = path_get("lib"); | string cubins_path = path_get("lib"); | ||||
| ▲ Show 20 Lines • Show All 327 Lines • ▼ Show 20 Lines | string command = string_printf( | ||||
| kernel_arch, | kernel_arch, | ||||
| major, | major, | ||||
| minor, | minor, | ||||
| kernel_ext, | kernel_ext, | ||||
| source_path.c_str(), | source_path.c_str(), | ||||
| cubin.c_str(), | cubin.c_str(), | ||||
| common_cflags.c_str()); | common_cflags.c_str()); | ||||
| printf("Compiling CUDA kernel ...\n%s\n", command.c_str()); | printf("Compiling %sCUDA kernel ...\n%s\n", | ||||
| (use_adaptive_compilation()) ? "adaptive " : "", | |||||
| command.c_str()); | |||||
| # ifdef _WIN32 | # ifdef _WIN32 | ||||
| command = "call " + command; | command = "call " + command; | ||||
| # endif | # endif | ||||
| if (system(command.c_str()) != 0) { | if (system(command.c_str()) != 0) { | ||||
| set_error( | set_error( | ||||
| "Failed to execute compilation command, " | "Failed to execute compilation command, " | ||||
| "see console for details."); | "see console for details."); | ||||
| Show All 10 Lines | # endif | ||||
| printf("Kernel compilation finished in %.2lfs.\n", time_dt() - starttime); | printf("Kernel compilation finished in %.2lfs.\n", time_dt() - starttime); | ||||
| return cubin; | return cubin; | ||||
| } | } | ||||
| bool CUDADevice::load_kernels(const uint kernel_features) | bool CUDADevice::load_kernels(const uint kernel_features) | ||||
| { | { | ||||
| /* TODO(sergey): Support kernels re-load for CUDA devices. | /* TODO(sergey): Support kernels re-load for CUDA devices adaptive compile. | ||||
| * | * | ||||
| * Currently re-loading kernel will invalidate memory pointers, | * Currently re-loading kernel will invalidate memory pointers, | ||||
| * causing problems in cuCtxSynchronize. | * causing problems in cuCtxSynchronize. | ||||
| */ | */ | ||||
| if (cuModule) { | if (cuModule) { | ||||
| VLOG(1) << "Skipping kernel reload, not currently supported."; | if (use_adaptive_compilation()) { | ||||
| VLOG(1) << "Skipping CUDA kernel reload for adaptive compilation, not currently supported."; | |||||
| } | |||||
| return true; | return true; | ||||
| } | } | ||||
| /* check if cuda init succeeded */ | /* check if cuda init succeeded */ | ||||
| if (cuContext == 0) | if (cuContext == 0) | ||||
| return false; | return false; | ||||
| /* check if GPU is supported */ | /* check if GPU is supported */ | ||||
| ▲ Show 20 Lines • Show All 812 Lines • Show Last 20 Lines | |||||