Skip to content

Commit ea4432b

Browse files
peterjc123soumith
authored andcommitted
Fix CUDA builds for Windows (#3650)
* Fix CUDA builds for Windows 1. CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS has a limitation, the maximum number of exported functions cannot exceed 65535. So it can't be used. 2. Specify static on an inline function to prevent linking errors. * cancel CMAKE version limitation
1 parent 73431f0 commit ea4432b

File tree

3 files changed

+2
-10
lines changed

3 files changed

+2
-10
lines changed

aten/CMakeLists.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
if(WIN32)
2-
# To enable CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS to automatically
3-
# add export decorators for all classes, structs and functions
4-
cmake_minimum_required(VERSION 3.4)
5-
else(WIN32)
6-
cmake_minimum_required(VERSION 3.0)
7-
endif(WIN32)
1+
cmake_minimum_required(VERSION 3.0)
82
set(CMAKE_MODULE_PATH
93
${CMAKE_CURRENT_SOURCE_DIR}/cmake
104
${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindCUDA

aten/src/TH/generic/THBlas.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ TH_EXTERNC double ddot_(int *n, double *x, int *incx, double *y, int *incy);
2222
TH_EXTERNC float cblas_sdot(const int n, const float *x, const int incx, const float *y, const int incy);
2323
#ifndef THBlas_C_sdot_
2424
#define THBlas_C_sdot_
25-
inline ffloat sdot_(const int *n, const float *x, const int *incx, const float *y, const int *incy)
25+
static inline ffloat sdot_(const int *n, const float *x, const int *incx, const float *y, const int *incy)
2626
{
2727
return cblas_sdot(*n, x, *incx, y, *incy);
2828
}

torch/lib/build_libs.bat

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ goto:eof
9191
-DTHCUNN_SO_VERSION=1 ^
9292
-DNO_CUDA=%NO_CUDA% ^
9393
-Dnanopb_BUILD_GENERATOR=0 ^
94-
-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE ^
9594
-DCMAKE_BUILD_TYPE=Release
9695

9796
%MAKE_COMMAND%
@@ -110,7 +109,6 @@ goto:eof
110109
-DNO_CUDA=%NO_CUDA% ^
111110
-DCUDNN_INCLUDE_DIR="%CUDNN_INCLUDE_DIR%" ^
112111
-DCUDNN_LIB_DIR="%CUDNN_LIB_DIR%" ^
113-
-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE ^
114112
-DCMAKE_BUILD_TYPE=Release
115113

116114
%MAKE_COMMAND%

0 commit comments

Comments
 (0)