| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,7 +28,7 @@ include(CMakeParseArguments) | |||
| 28 | 28 | set(BIN2CPP_PROGRAM "bin2cpp") | |
| 29 | 29 | ||
| 30 | 30 | function(CL_KERNEL_TO_H) | |
| 31 | - cmake_parse_arguments(RTCS "" "VARNAME;EXTENSION;OUTPUT_DIR;TARGETS;NAMESPACE" "SOURCES" ${ARGN}) | ||
| 31 | + cmake_parse_arguments(RTCS "" "VARNAME;EXTENSION;OUTPUT_DIR;TARGETS;NAMESPACE;EOF" "SOURCES" ${ARGN}) | ||
| 32 | 32 | ||
| 33 | 33 | set(_output_files "") | |
| 34 | 34 | foreach(_input_file ${RTCS_SOURCES}) | |
@@ -37,7 +37,7 @@ function(CL_KERNEL_TO_H) | |||
| 37 | 37 | get_filename_component(var_name "${_input_file}" NAME) | |
| 38 | 38 | get_filename_component(_name_we "${_input_file}" NAME_WE) | |
| 39 | 39 | ||
| 40 | - set(_namespace, ${RTCS_NAMESPACE}) | ||
| 40 | + set(_namespace "${RTCS_NAMESPACE}") | ||
| 41 | 41 | string(REPLACE "." "_" var_name ${var_name}) | |
| 42 | 42 | ||
| 43 | 43 | set(_output_path "${CMAKE_CURRENT_BINARY_DIR}/${RTCS_OUTPUT_DIR}") | |
@@ -48,7 +48,7 @@ function(CL_KERNEL_TO_H) | |||
| 48 | 48 | DEPENDS ${_input_file} ${BIN2CPP_PROGRAM} | |
| 49 | 49 | COMMAND ${CMAKE_COMMAND} -E make_directory "${_output_path}" | |
| 50 | 50 | COMMAND ${CMAKE_COMMAND} -E echo "\\#include \\<${_path}/${_name_we}.hpp\\>" >>"${_output_file}" | |
| 51 | - COMMAND ${BIN2CPP_PROGRAM} --file ${_name} --namespace ${_namespace} --output ${_output_file} --name ${var_name} | ||
| 51 | + COMMAND ${BIN2CPP_PROGRAM} --file ${_name} --namespace ${_namespace} --output ${_output_file} --name ${var_name} --eof ${RTCS_EOF} | ||
| 52 | 52 | WORKING_DIRECTORY "${_path}" | |
| 53 | 53 | COMMENT "Compiling ${_input_file} to C++ source" | |
| 54 | 54 | ) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -69,6 +69,7 @@ parse_options(const vector<string>& args) { | |||
| 69 | 69 | options["--file"] = ""; | |
| 70 | 70 | options["--output"] = ""; | |
| 71 | 71 | options["--namespace"] = ""; | |
| 72 | + options["--eof"] = ""; | ||
| 72 | 73 | ||
| 73 | 74 | //Parse Arguments | |
| 74 | 75 | string curr_opt; | |
@@ -112,6 +113,7 @@ parse_options(const vector<string>& args) { | |||
| 112 | 113 | ||
| 113 | 114 | int main(int argc, const char * const * const argv) | |
| 114 | 115 | { | |
| 116 | + | ||
| 115 | 117 | vector<string> args(argv, argv+argc); | |
| 116 | 118 | ||
| 117 | 119 | opt_t&& options = parse_options(args); | |
@@ -163,6 +165,13 @@ int main(int argc, const char * const * const argv) | |||
| 163 | 165 | add_tabs(level); | |
| 164 | 166 | } | |
| 165 | 167 | } | |
| 168 | + | ||
| 169 | + if (options["--eof"].c_str()[0] == '1') { | ||
| 170 | + // Add end of file character | ||
| 171 | + cout << "0x0"; | ||
| 172 | + char_cnt++; | ||
| 173 | + } | ||
| 174 | + | ||
| 166 | 175 | cout << "};\n"; | |
| 167 | 176 | add_tabs(--level); | |
| 168 | 177 | cout << "static const size_t " << options["--name"] << "_len" << " = " << std::dec << char_cnt << ";\n"; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,6 +42,7 @@ CL_KERNEL_TO_H( | |||
| 42 | 42 | OUTPUT_DIR ${ptx_headers} | |
| 43 | 43 | TARGETS ptx_targets | |
| 44 | 44 | NAMESPACE "cuda" | |
| 45 | + EOF "1" | ||
| 45 | 46 | ) | |
| 46 | 47 | ||
| 47 | 48 | IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" AND "${APPLE}") | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,6 +11,7 @@ | |||
| 11 | 11 | #include <ptx_headers/numeric.hpp> | |
| 12 | 12 | #include <ptx_headers/trig.hpp> | |
| 13 | 13 | #include <ptx_headers/hyper.hpp> | |
| 14 | + #include <ptx_headers/cast.hpp> | ||
| 14 | 15 | #include <platform.hpp> | |
| 15 | 16 | #include <dispatch.hpp> | |
| 16 | 17 | #include <err_cuda.hpp> | |
@@ -244,12 +245,12 @@ static kc_entry_t compileKernel(const char *ker_name, string jit_ker) | |||
| 244 | 245 | CU_CHECK(cuLinkAddData(linkState, CU_JIT_INPUT_PTX, (void*)ptx, | |
| 245 | 246 | ptx_size, ker_name, 0, NULL, NULL)); | |
| 246 | 247 | ||
| 247 | - CU_CHECK(cuLinkAddData(linkState, CU_JIT_INPUT_PTX, (void*)trig_ptx, | ||
| 248 | - trig_ptx_len, "trig", 0, NULL, NULL)); | ||
| 249 | - | ||
| 250 | 248 | CU_CHECK(cuLinkAddData(linkState, CU_JIT_INPUT_PTX, (void*)arith_ptx, | |
| 251 | 249 | arith_ptx_len, "arith", 0, NULL, NULL)); | |
| 252 | 250 | ||
| 251 | + CU_CHECK(cuLinkAddData(linkState, CU_JIT_INPUT_PTX, (void*)cast_ptx, | ||
| 252 | + cast_ptx_len, "cast", 0, NULL, NULL)); | ||
| 253 | + | ||
| 253 | 254 | CU_CHECK(cuLinkAddData(linkState, CU_JIT_INPUT_PTX, (void*)exp_ptx, | |
| 254 | 255 | exp_ptx_len, "exp", 0, NULL, NULL)); | |
| 255 | 256 | ||
@@ -262,6 +263,8 @@ static kc_entry_t compileKernel(const char *ker_name, string jit_ker) | |||
| 262 | 263 | CU_CHECK(cuLinkAddData(linkState, CU_JIT_INPUT_PTX, (void*)numeric_ptx, | |
| 263 | 264 | numeric_ptx_len, "numeric", 0, NULL, NULL)); | |
| 264 | 265 | ||
| 266 | + CU_CHECK(cuLinkAddData(linkState, CU_JIT_INPUT_PTX, (void*)trig_ptx, | ||
| 267 | + trig_ptx_len, "trig", 0, NULL, NULL)); | ||
| 265 | 268 | ||
| 266 | 269 | void *cubin; | |
| 267 | 270 | size_t cubinSize; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -82,8 +82,8 @@ namespace cuda | |||
| 82 | 82 | template<> __device__ char limit_min<char>() { return 0x80; } | |
| 83 | 83 | template<> __device__ float limit_max<float>() { return CUDART_INF_F; } | |
| 84 | 84 | template<> __device__ float limit_min<float>() { return -CUDART_INF_F; } | |
| 85 | - template<> __device__ double limit_max<double>() { return CUDART_INF_F; } | ||
| 86 | - template<> __device__ double limit_min<double>() { return -CUDART_INF_F; } | ||
| 85 | + template<> __device__ double limit_max<double>() { return CUDART_INF; } | ||
| 86 | + template<> __device__ double limit_min<double>() { return -CUDART_INF; } | ||
| 87 | 87 | #endif | |
| 88 | 88 | ||
| 89 | 89 | #define upcast cuComplexFloatToDouble | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -46,6 +46,7 @@ CL_KERNEL_TO_H( | |||
| 46 | 46 | OUTPUT_DIR ${cl_kernel_headers} | |
| 47 | 47 | TARGETS cl_kernel_targets | |
| 48 | 48 | NAMESPACE "opencl" | |
| 49 | + EOF "0" | ||
| 49 | 50 | ) | |
| 50 | 51 | ||
| 51 | 52 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -pthread") | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -131,7 +131,6 @@ TEST(BasicTests, Additionf64f64) | |||
| 131 | 131 | ASSERT_NEAR(0.0f, err, 1e-8); | |
| 132 | 132 | } | |
| 133 | 133 | ||
| 134 | - #ifndef AF_CUDA //FIXME: CUDA has problems with casting | ||
| 135 | 134 | TEST(BasicTests, Additionf32f64) | |
| 136 | 135 | { | |
| 137 | 136 | static const int ndims = 2; | |
@@ -161,7 +160,6 @@ TEST(BasicTests, Additionf32f64) | |||
| 161 | 160 | } | |
| 162 | 161 | ASSERT_NEAR(0.0f, err, 1e-8); | |
| 163 | 162 | } | |
| 164 | - #endif | ||
| 165 | 163 | ||
| 166 | 164 | TEST(BasicArrayTests, constant10x10) | |
| 167 | 165 | { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments