Zha0q1 commented on a change in pull request #19174:
URL: https://github.com/apache/incubator-mxnet/pull/19174#discussion_r530694851



##########
File path: cmake/ChooseBlas.cmake
##########
@@ -45,6 +45,81 @@ elseif(BLAS STREQUAL "Open" OR BLAS STREQUAL "open")
   add_definitions(-DMSHADOW_USE_CBLAS=1)
   add_definitions(-DMSHADOW_USE_MKL=0)
   add_definitions(-DMXNET_USE_BLAS_OPEN=1)
+  if(NOT MSVC)
+    # check if we need to link to omp
+    execute_process(COMMAND ${CMAKE_NM} -g ${OpenBLAS_LIB}
+                    COMMAND grep omp_get_num_threads
+                    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+                    OUTPUT_VARIABLE OPENBLAS_USES_OMP_OUT
+                    RESULT_VARIABLE OPENBLAS_USES_OMP_RET)
+    if(NOT OPENBLAS_USES_OMP_OUT STREQUAL "" AND NOT OPENBLAS_USES_OMP_RET)
+      message("Openblas uses OMP, automatically linking to it")
+      find_package(OpenMP)
+      if(OPENMP_FOUND)
+        message("OpenMP_CXX_LIBRARIES is ${OpenMP_CXX_LIBRARIES}")
+        list(APPEND mshadow_LINKER_LIBS "${OpenMP_CXX_LIBRARIES}")
+      else()
+       message("Trying to link to gomp")

Review comment:
       currently no. I can add that in if overall the current solution looks 
good




----------------------------------------------------------------
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:
[email protected]


Reply via email to