Commit e8533f47 authored by traveller59's avatar traveller59
Browse files

bug fix

1. workaround for gcc 5.5 avx512 problem
2. workaround for cuda 9 invalid device function problem
parent a6ae8967
...@@ -3,9 +3,9 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR) ...@@ -3,9 +3,9 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
option(SPCONV_BuildTests "Build the unit tests when BUILD_TESTING is enabled." ON) option(SPCONV_BuildTests "Build the unit tests when BUILD_TESTING is enabled." ON)
option(SPCONV_BuildCUDA "Build cuda code when BUILD_TESTING is enabled." ON) option(SPCONV_BuildCUDA "Build cuda code when BUILD_TESTING is enabled." ON)
if (SPCONV_BuildCUDA) if (SPCONV_BuildCUDA)
project(SparseConv LANGUAGES CXX CUDA VERSION 1.0) project(SparseConv LANGUAGES CXX CUDA VERSION 1.1)
else() else()
project(SparseConv LANGUAGES CXX VERSION 1.0) project(SparseConv LANGUAGES CXX VERSION 1.1)
endif() endif()
...@@ -15,7 +15,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") ...@@ -15,7 +15,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
endif() endif()
find_package(Torch REQUIRED) find_package(Torch REQUIRED)
# set(CMAKE_VERBOSE_MAKEFILE ON)
if (SPCONV_BuildCUDA) if (SPCONV_BuildCUDA)
set(CUDA_TOOLKIT_ROOT_DIR "${CMAKE_CUDA_COMPILER}") set(CUDA_TOOLKIT_ROOT_DIR "${CMAKE_CUDA_COMPILER}")
get_filename_component(CUDA_TOOLKIT_ROOT_DIR "${CUDA_TOOLKIT_ROOT_DIR}" DIRECTORY) get_filename_component(CUDA_TOOLKIT_ROOT_DIR "${CUDA_TOOLKIT_ROOT_DIR}" DIRECTORY)
...@@ -26,7 +26,6 @@ if (SPCONV_BuildCUDA) ...@@ -26,7 +26,6 @@ if (SPCONV_BuildCUDA)
else() else()
set(CUDA_LIB_PATH_HINTS "${CUDA_TOOLKIT_ROOT_DIR}/lib64") set(CUDA_LIB_PATH_HINTS "${CUDA_TOOLKIT_ROOT_DIR}/lib64")
endif() endif()
# set(CMAKE_VERBOSE_MAKEFILE ON)
find_library(CUDA_CUDART NAMES cudart HINTS ${CUDA_LIB_PATH_HINTS}) find_library(CUDA_CUDART NAMES cudart HINTS ${CUDA_LIB_PATH_HINTS})
find_library(CUDA_CUBLAS NAMES cublas HINTS ${CUDA_LIB_PATH_HINTS}) find_library(CUDA_CUBLAS NAMES cublas HINTS ${CUDA_LIB_PATH_HINTS})
torch_cuda_get_nvcc_gencode_flag(NVCC_FLAGS_EXTRA) torch_cuda_get_nvcc_gencode_flag(NVCC_FLAGS_EXTRA)
...@@ -50,7 +49,6 @@ endif() ...@@ -50,7 +49,6 @@ endif()
add_subdirectory(src/spconv) add_subdirectory(src/spconv)
add_subdirectory(src/utils) add_subdirectory(src/utils)
if (SPCONV_BuildTests) if (SPCONV_BuildTests)
include(CTest) #adds option BUILD_TESTING (default ON) include(CTest) #adds option BUILD_TESTING (default ON)
if(BUILD_TESTING) if(BUILD_TESTING)
......
...@@ -85,7 +85,7 @@ class CMakeBuild(build_ext): ...@@ -85,7 +85,7 @@ class CMakeBuild(build_ext):
packages = find_packages(exclude=('tools', 'tools.*')) packages = find_packages(exclude=('tools', 'tools.*'))
setup( setup(
name='spconv', name='spconv',
version='1.0', version='1.1',
author='Yan Yan', author='Yan Yan',
author_email='scrin@foxmail.com', author_email='scrin@foxmail.com',
description='spatial sparse convolution for pytorch', description='spatial sparse convolution for pytorch',
......
add_library(cuhash SHARED hash_functions.cu hash_table.cpp hash_table.cu) add_library(cuhash STATIC hash_functions.cu hash_table.cpp hash_table.cu hash_functions.cpp)
target_include_directories(cuhash PRIVATE ${ALL_INCLUDE} ) target_include_directories(cuhash PRIVATE ${ALL_INCLUDE} )
set_property(TARGET cuhash PROPERTY CUDA_STANDARD 14) set_property(TARGET cuhash PROPERTY CUDA_STANDARD 14)
set_property(TARGET cuhash PROPERTY CXX_STANDARD 14) set_property(TARGET cuhash PROPERTY CXX_STANDARD 14)
set_target_properties(cuhash PROPERTIES CUDA_SEPARABLE_COMPILATION ON) set_target_properties(cuhash PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
set_property(TARGET cuhash PROPERTY POSITION_INDEPENDENT_CODE ON)
target_link_libraries(cuhash PRIVATE ${ALL_LIBS}) target_link_libraries(cuhash PRIVATE ${ALL_LIBS})
install (TARGETS cuhash DESTINATION lib) install (TARGETS cuhash DESTINATION lib)
......
// nvcc (cuda) 9.0 with gcc 5.5 don't support random, so compile it in host
#include <random>
namespace cuhash {
std::random_device random_dev;
std::mt19937 random_engine(random_dev());
std::uniform_int_distribution<unsigned> uint_distribution;
unsigned generate_random_uint32(){
return uint_distribution(random_engine);
}
}
\ No newline at end of file
#include <cuhash/hash_table.h> #include <cuhash/hash_table.h>
#include <cuhash/hash_functions.h>
#include <cuhash/debugging.h> #include <cuhash/debugging.h>
#include <cassert> #include <cassert>
#include <random>
namespace cuhash { namespace cuhash {
std::random_device random_dev;
std::mt19937 random_engine(random_dev());
std::uniform_int_distribution<unsigned> uint_distribution;
unsigned generate_random_uint32(){
return uint_distribution(random_engine);
}
void GenerateFunctions(const unsigned N, void GenerateFunctions(const unsigned N,
const unsigned num_keys, const unsigned num_keys,
const unsigned *d_keys, const unsigned *d_keys,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment