lunar-walker opened a new issue #20256: URL: https://github.com/apache/incubator-mxnet/issues/20256
## Description When compiling version 1.8 with GPU & MKLDNN support from Windows 10 / x64 (Visual studio Community 2019), it fails with lots of errors of pattern calling a __host__ function from a __global__ function is not allowed... Initial investigation suggests some sort of confusion by CUDA Compiler for mixing standard C/C++ libraries functions with CUDA Libraries functions i.e. error is appearing when calling floor, ceil functions inside CUDA code (both functions are available in standard C/C++ & CUDA libraries). I'm using CUDA 11.2 (Pasted below initial out of build_windows.py for environment) ### Error Message ../src/operator/contrib/adaptive_avg_pooling.cu(73): error: calling a __host__ function("__floorf") from a __global__ function("mxnet::op::adaptiveaveragepool<float> ") is not allowed ../src/operator/contrib/adaptive_avg_pooling.cu(73): error: identifier "__floorf" is undefined in device code ../src/operator/contrib/adaptive_avg_pooling.cu(74): error: calling a __host__ function("__ceilf") from a __global__ function("mxnet::op::adaptiveaveragepool<float> ") is not allowed ../src/operator/contrib/adaptive_avg_pooling.cu(74): error: identifier "__ceilf" is undefined in device code ../src/operator/contrib/adaptive_avg_pooling.cu(78): error: calling a __host__ function("__floorf") from a __global__ function("mxnet::op::adaptiveaveragepool<float> ") is not allowed ../src/operator/contrib/adaptive_avg_pooling.cu(78): error: identifier "__floorf" is undefined in device code ../src/operator/contrib/adaptive_avg_pooling.cu(79): error: calling a __host__ function("__ceilf") from a __global__ function("mxnet::op::adaptiveaveragepool<float> ") is not allowed ../src/operator/contrib/adaptive_avg_pooling.cu(79): error: identifier "__ceilf" is undefined in device code ../src/operator/contrib/adaptive_avg_pooling.cu(73): error: calling a __host__ function("__floorf") from a __global__ function("mxnet::op::adaptiveaveragepool<double> ") is not allowed ../src/operator/contrib/adaptive_avg_pooling.cu(73): error: identifier "__floorf" is undefined in device code ../src/operator/contrib/adaptive_avg_pooling.cu(74): error: calling a __host__ function("__ceilf") from a __global__ function("mxnet::op::adaptiveaveragepool<double> ") is not allowed ../src/operator/contrib/adaptive_avg_pooling.cu(74): error: identifier "__ceilf" is undefined in device code ../src/operator/contrib/adaptive_avg_pooling.cu(78): error: calling a __host__ function("__floorf") from a __global__ function("mxnet::op::adaptiveaveragepool<double> ") is not allowed ../src/operator/contrib/adaptive_avg_pooling.cu(78): error: identifier "__floorf" is undefined in device code ../src/operator/contrib/adaptive_avg_pooling.cu(79): error: calling a __host__ function("__ceilf") from a __global__ function("mxnet::op::adaptiveaveragepool<double> ") is not allowed ../src/operator/contrib/adaptive_avg_pooling.cu(79): error: identifier "__ceilf" is undefined in device code ../src/operator/contrib/adaptive_avg_pooling.cu(73): error: calling a __host__ function("__floorf") from a __global__ function("mxnet::op::adaptiveaveragepool< ::mshadow::half::half_t> ") is not allowed ../src/operator/contrib/adaptive_avg_pooling.cu(73): error: identifier "__floorf" is undefined in device code ../src/operator/contrib/adaptive_avg_pooling.cu(74): error: calling a __host__ function("__ceilf") from a __global__ function("mxnet::op::adaptiveaveragepool< ::mshadow::half::half_t> ") is not allowed ../src/operator/contrib/adaptive_avg_pooling.cu(74): error: identifier "__ceilf" is undefined in device code ../src/operator/contrib/adaptive_avg_pooling.cu(78): error: calling a __host__ function("__floorf") from a __global__ function("mxnet::op::adaptiveaveragepool< ::mshadow::half::half_t> ") is not allowed ../src/operator/contrib/adaptive_avg_pooling.cu(78): error: identifier "__floorf" is undefined in device code ../src/operator/contrib/adaptive_avg_pooling.cu(79): error: calling a __host__ function("__ceilf") from a __global__ function("mxnet::op::adaptiveaveragepool< ::mshadow::half::half_t> ") is not allowed ../src/operator/contrib/adaptive_avg_pooling.cu(79): error: identifier "__ceilf" is undefined in device code ../src/operator/contrib/adaptive_avg_pooling.cu(130): error: calling a __host__ function("__floorf") from a __global__ function("mxnet::op::atomicadaptiveaveragegradinput<float> ") is not allowed ../src/operator/contrib/adaptive_avg_pooling.cu(130): error: identifier "__floorf" is undefined in device code ...... ...... ...... ## What have you tried to solve it? 1. Tried compiling using cmake / visual Studio solution 2. Tried compiling using ci/build_windows.py script ## Environment <details> <summary>Environment Information</summary> ----------Python Info---------- Version : 3.9.5 Compiler : MSC v.1928 64 bit (AMD64) Build : ('tags/v3.9.5:0a7dcbd', 'May 3 2021 17:27:52') Arch : ('64bit', 'WindowsPE') ------------Pip Info----------- Version : 21.1.1 Directory : C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\site-packages\pip ----------MXNet Info----------- No MXNet installed. ----------System Info---------- Platform : Windows-10-10.0.19042-SP0 system : Windows node : DESKTOP-6LE30FJ release : 10 version : 10.0.19042 ----------Hardware Info---------- machine : AMD64 processor : Intel64 Family 6 Model 94 Stepping 3, GenuineIntel Name Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz </details> <details> <summary>Initial output of ci/build_windows.py</summary> ********************************************************************** ** Visual Studio 2019 Developer Command Prompt v16.9.4 ** Copyright (c) 2021 Microsoft Corporation ********************************************************************** [vcvarsall.bat] Environment initialized for: 'x64' -- The C compiler identification is MSVC 19.28.29914.0 -- The CXX compiler identification is MSVC 19.28.29914.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- CMAKE_CROSSCOMPILING FALSE -- CMAKE_HOST_SYSTEM_PROCESSOR AMD64 -- CMAKE_SYSTEM_PROCESSOR AMD64 -- CMAKE_SYSTEM_NAME Windows -- CMake version '3.20.1' using generator 'Ninja' -- Looking for a CUDA compiler -- Looking for a CUDA compiler - C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.2/bin/nvcc.exe -- The CUDA compiler identification is NVIDIA 11.2.67 -- Detecting CUDA compiler ABI info -- Detecting CUDA compiler ABI info - done -- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.2/bin/nvcc.exe - skipped -- Detecting CUDA compile features -- Detecting CUDA compile features - done -- The ASM_MASM compiler identification is MSVC -- Found assembler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/ml64.exe CMake Deprecation Warning at 3rdparty/mkldnn/CMakeLists.txt:17 (cmake_minimum_required): Compatibility with CMake < 2.8.12 will be removed from a future version of CMake. Update the VERSION argument <min> value or use a ...<max> suffix to tell CMake that the project does not need compatibility with older versions. -- Intel MKL-DNN compat: set DNNL_BUILD_EXAMPLES to MKLDNN_BUILD_EXAMPLES with value `OFF` -- Intel MKL-DNN compat: set DNNL_BUILD_TESTS to MKLDNN_BUILD_TESTS with value `OFF` -- Intel MKL-DNN compat: set DNNL_ENABLE_JIT_PROFILING to MKLDNN_ENABLE_JIT_PROFILING with value `OFF` -- Intel MKL-DNN compat: set DNNL_LIBRARY_TYPE to MKLDNN_LIBRARY_TYPE with value `STATIC` -- Intel MKL-DNN compat: set DNNL_ARCH_OPT_FLAGS to MKLDNN_ARCH_OPT_FLAGS with value `` -- Looking for pthread.h -- Looking for pthread.h - not found -- Found Threads: TRUE -- Found OpenMP_C: -openmp (found version "2.0") -- Found OpenMP_CXX: -openmp (found version "2.0") -- Found OpenMP: TRUE (found version "2.0") -- GPU support is disabled -- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.30.0.windows.2") fatal: not a git repository (or any of the parent directories): .git -- Primitive cache is enabled -- Found MKL: D:/oneAPI/mkl/latest/include -- Found MKL (include: D:/oneAPI/mkl/latest/include, lib: D:/oneAPI/mkl/latest/lib/intel64/mkl_rt.lib -- Found OpenCV: D:/code/opencvlib/build_opencv (found version "4.5.2") found components: core highgui imgproc imgcodecs -- OpenCV 4.5.2 found (D:/code/opencvlib/build_opencv) -- OpenCV_LIBS=opencv_core;opencv_highgui;opencv_imgproc;opencv_imgcodecs USE_LAPACK is ON CMake Warning at 3rdparty/googletest/googletest/CMakeLists.txt:47 (project): VERSION keyword not followed by a value or was followed by a value that expanded to nothing. CMake Deprecation Warning at 3rdparty/googletest/googletest/CMakeLists.txt:49 (cmake_minimum_required): Compatibility with CMake < 2.8.12 will be removed from a future version of CMake. Update the VERSION argument <min> value or use a ...<max> suffix to tell CMake that the project does not need compatibility with older versions. -- Found PythonInterp: D:/miniconda3/python.exe (found version "3.7.9") -- Found GTest: gtest -- Found CUDNN: C:/cudnn/cuda/lib/x64/cudnn.lib -- Looking for clock_gettime in rt -- Looking for clock_gettime in rt - not found -- Looking for fopen64 -- Looking for fopen64 - not found -- Looking for C++ include cxxabi.h -- Looking for C++ include cxxabi.h - not found -- Looking for nanosleep -- Looking for nanosleep - not found -- Looking for backtrace -- Looking for backtrace - not found -- Could NOT find Backtrace (missing: Backtrace_LIBRARY Backtrace_INCLUDE_DIR) -- D:/code/apache-mxnet-src-1.8.0-incubating/3rdparty/dmlc-core/cmake/build_config.h.in -> include/dmlc/build_config.h -- CUDA: Using the following NVCC architecture flags -gencode;arch=compute_75,code=sm_75 -- Found CUDAToolkit: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.2/include (found version "11.2.67") -- Performing Test SUPPORT_MSSE3 -- Performing Test SUPPORT_MSSE3 - Failed -- Performing Test SUPPORT_MSSE2 -- Performing Test SUPPORT_MSSE2 - Failed -- Determining F16C support F16C instruction set is not yet supported for MSVC -- CUDA: Adding NVCC options: --fatbin-options --compress-all -- Google Test not found -- Configuring done CMake Warning (dev) in CMakeLists.txt: Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC, empty CUDA_ARCHITECTURES not allowed. Run "cmake --help-policy CMP0104" for policy details. Use the cmake_policy command to set the policy and suppress this warning. CUDA_ARCHITECTURES is empty for target "mxnet_75". This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning (dev) in CMakeLists.txt: Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC, empty CUDA_ARCHITECTURES not allowed. Run "cmake --help-policy CMP0104" for policy details. Use the cmake_policy command to set the policy and suppress this warning. CUDA_ARCHITECTURES is empty for target "customop_gpu_lib". This warning is for project developers. Use -Wno-dev to suppress it. -- Generating done -- Build files have been written to: D:/code/apache-mxnet-src-1.8.0-incubating/build </details> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@mxnet.apache.org For additional commands, e-mail: issues-h...@mxnet.apache.org