Commit a4bd8e53 authored by Cianciosa, Mark's avatar Cianciosa, Mark
Browse files

Change method to import headers in cuda.

parent 3e6f3866
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -6,10 +6,6 @@ target_compile_features (rays
                         cxx_std_20
)

if (${USE_CUDA})
    file (READ ${CMAKE_CURRENT_SOURCE_DIR}/special_functions.hpp header)
endif ()

target_compile_definitions (rays
                            INTERFACE
                            $<$<PLATFORM_ID:Darwin>:CXX="${CMAKE_CXX_COMPILER} -isysroot ${CMAKE_OSX_SYSROOT} -I${CMAKE_CURRENT_SOURCE_DIR} -std=gnu++2a">
@@ -17,7 +13,7 @@ target_compile_definitions (rays
                            $<$<PLATFORM_ID:Linux>:CXX="${CMAKE_CXX_COMPILER} -I${CMAKE_CURRENT_SOURCE_DIR} -std=gnu++2a">
                            $<$<PLATFORM_ID:Linux>:CXX_FLAGS="-g -fsanitize=undefined -fsanitize=float-divide-by-zero">
                            NC_FILE="${CMAKE_CURRENT_SOURCE_DIR}/../graph_tests/efit.nc"
                            $<$<BOOL:${USE_CUDA}>:HEADERS=$<BUILD_INTERFACE:${header}>>
                            $<$<BOOL:${USE_CUDA}>:HEADERS=$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/special_functions.hpp>>
)
target_include_directories (rays
                            INTERFACE
+7 −21
Original line number Diff line number Diff line
@@ -160,25 +160,10 @@ namespace gpu {
            }

            nvrtcProgram kernel_program;
            if constexpr (jit::is_complex<T> ()) {
                std::array<char *, 1> headers = {
                    HEADERS
                };
                std::array<char *, 1> includeNames = {
                    "special_functions.hpp"
                };
                check_nvrtc_error(nvrtcCreateProgram(&kernel_program,
                                                     kernel_source.c_str(),
                                                     NULL, headers.size(),
                                                     headers.data(),
                                                     includeNames.data()),
                                  "nvrtcCreateProgram");
            } else {
            check_nvrtc_error(nvrtcCreateProgram(&kernel_program,
                                                 kernel_source.c_str(),
                                                 NULL, 0, NULL, NULL),
                              "nvrtcCreateProgram");
            }

            for (std::string &name : names) {
                check_nvrtc_error(nvrtcAddNameExpression(kernel_program,
@@ -218,10 +203,11 @@ namespace gpu {
            }

            const std::string temp = arch.str();
            std::array<const char *, 3> options({
            std::array<const char *, 4> options({
                temp.c_str(),
                "--std=c++17",
                "--include-path=" CUDA_INCLUDE
                "--include-path=" CUDA_INCLUDE,
                "--include-path=" HEADERS
            });

            if (nvrtcCompileProgram(kernel_program, options.size(), options.data())) {