@@ -6,6 +6,11 @@ if(USE_VULKAN)
6
6
include (../cmake/VulkanCodegen.cmake)
7
7
endif ()
8
8
9
+ # ---[ MSVC OpenMP modification
10
+ if (MSVC )
11
+ include (../cmake/public /utils.cmake)
12
+ endif ()
13
+
9
14
# ATen parallelism settings
10
15
# OMP - OpenMP for intra-op, native thread pool for inter-op parallelism
11
16
# NATIVE - using native thread pool for intra- and inter-op parallelism
@@ -895,6 +900,11 @@ if(USE_OPENMP)
895
900
find_package (OpenMP QUIET )
896
901
endif ()
897
902
if (USE_OPENMP AND OPENMP_FOUND)
903
+ if (MSVC AND OpenMP_CXX_LIBRARIES MATCHES "libiomp5md\\ .lib" )
904
+ set (AT_MKL_MT 1)
905
+ else ()
906
+ set (AT_MKL_MT 0)
907
+ endif ()
898
908
message (STATUS "pytorch is compiling with OpenMP. \n "
899
909
"OpenMP CXX_FLAGS: ${OpenMP_CXX_FLAGS} . \n "
900
910
"OpenMP libraries: ${OpenMP_CXX_LIBRARIES} ." )
@@ -1385,6 +1395,7 @@ if(BUILD_PYTHON)
1385
1395
if (NOT MSVC )
1386
1396
set_target_properties (caffe2_pybind11_state PROPERTIES COMPILE_FLAGS "-fvisibility=hidden" )
1387
1397
endif ()
1398
+ torch_set_target_props(caffe2_pybind11_state)
1388
1399
set_target_properties (caffe2_pybind11_state PROPERTIES PREFIX "" DEBUG_POSTFIX "" )
1389
1400
set_target_properties (caffe2_pybind11_state PROPERTIES SUFFIX ${PY_EXT_SUFFIX} )
1390
1401
set_target_properties (caffe2_pybind11_state PROPERTIES LINK_FLAGS "${_caffe2_pybind11_state_linker_flags} " )
@@ -1414,6 +1425,7 @@ if(BUILD_PYTHON)
1414
1425
if (NOT MSVC )
1415
1426
set_target_properties (caffe2_pybind11_state_gpu PROPERTIES COMPILE_FLAGS "-fvisibility=hidden" )
1416
1427
endif ()
1428
+ torch_set_target_props(caffe2_pybind11_state_gpu)
1417
1429
set_target_properties (caffe2_pybind11_state_gpu PROPERTIES PREFIX "" DEBUG_POSTFIX "" )
1418
1430
set_target_properties (caffe2_pybind11_state_gpu PROPERTIES SUFFIX ${PY_EXT_SUFFIX} )
1419
1431
set_target_properties (caffe2_pybind11_state_gpu PROPERTIES LINK_FLAGS "${_caffe2_pybind11_state_linker_flags} " )
@@ -1441,6 +1453,7 @@ if(BUILD_PYTHON)
1441
1453
if (NOT MSVC )
1442
1454
target_compile_options (caffe2_pybind11_state_hip PRIVATE ${HIP_CXX_FLAGS} -fvisibility=hidden)
1443
1455
endif ()
1456
+ torch_set_target_props(caffe2_pybind11_state_hip)
1444
1457
set_target_properties (caffe2_pybind11_state_hip PROPERTIES PREFIX "" )
1445
1458
set_target_properties (caffe2_pybind11_state_hip PROPERTIES SUFFIX ${PY_EXT_SUFFIX} )
1446
1459
set_target_properties (caffe2_pybind11_state_hip PROPERTIES LINK_FLAGS "${_caffe2_pybind11_state_linker_flags} " )
0 commit comments