pytorch/cmake/Modules
min-jean-cho 7a6808c5f6 build: support DNNL_GRAPH_CPU_RUNTIME=TBB (#87512)
Force set cmake `DNNL_GRAPH_CPU_RUNTIME` as `MKLDNN_CPU_RUNTIME` to overwrite [`set(DNNL_GRAPH_CPU_RUNTIME "OMP")`](d19d0f795c/cmake/options.cmake (L65-L67)), enabling user-specified `MKLDNN_CPU_RUNTIME` values (`OMP` (default), `TBB`) for `DNNL_GRAPH_CPU_RUNTIME`.

Fixes https://github.com/pytorch/pytorch/issues/87511
Pull Request resolved: https://github.com/pytorch/pytorch/pull/87512
Approved by: https://github.com/jgong5, https://github.com/ashokei, https://github.com/malfet
2022-10-25 19:24:38 +00:00
..
FindARM.cmake
FindAtlas.cmake
FindAVX.cmake Fix false positive AVX, AVX2 and AVX512 detection with MSVC (#82554) 2022-08-01 23:52:49 +00:00
FindBenchmark.cmake
FindBLAS.cmake Specify "Generic" BLAS library name. (#74269) 2022-06-20 18:44:54 +00:00
FindBLIS.cmake
FindCUB.cmake
FindFFmpeg.cmake
FindFlexiBLAS.cmake
FindGloo.cmake
FindHiredis.cmake
FindITT.cmake Enable Intel® VTune™ Profiler's Instrumentation and Tracing Technology APIs (ITT) to PyTorch (#63289) 2022-07-13 13:50:15 +00:00
FindLAPACK.cmake
FindLevelDB.cmake
FindLMDB.cmake
FindMAGMA.cmake
FindMatlabMex.cmake
FindMKL.cmake
FindMKLDNN.cmake build: support DNNL_GRAPH_CPU_RUNTIME=TBB (#87512) 2022-10-25 19:24:38 +00:00
FindNCCL.cmake
FindNuma.cmake
FindNumPy.cmake
FindOpenBLAS.cmake
FindOpenMP.cmake
Findpybind11.cmake
FindRocksDB.cmake
FindSnappy.cmake
FindvecLib.cmake
FindVSX.cmake
FindZMQ.cmake
FindZVECTOR.cmake
README.md

This folder contains various custom cmake modules for finding libraries and packages. Details about some of them are listed below.

FindOpenMP.cmake

This is modified from the file included in CMake 3.13 release, with the following changes:

  • Replace VERSION_GREATER_EQUAL with NOT ... VERSION_LESS as VERSION_GREATER_EQUAL is not supported in CMake 3.5 (our min supported version).

  • Update the separate_arguments commands to not use NATIVE_COMMAND which is not supported in CMake 3.5 (our min supported version).

  • Make it respect the QUIET flag so that, when it is set, try_compile failures are not reported.

  • For AppleClang compilers, use -Xpreprocessor instead of -Xclang as the later is not documented.

  • For AppleClang compilers, an extra flag option is tried, which is -Xpreprocessor -openmp -I${DIR_OF_omp_h}, where ${DIR_OF_omp_h} is a obtained using find_path on omp.h with brew's default include directory as a hint. Without this, the compiler will complain about missing headers as they are not natively included in Apple's LLVM.

  • For non-GNU compilers, whenever we try a candidate OpenMP flag, first try it with directly linking MKL's libomp if it has one. Otherwise, we may end up linking two libomps and end up with this nasty error:

    OMP: Error #15: Initializing libomp.dylib, but found libiomp5.dylib already
    initialized.
    
    OMP: Hint This means that multiple copies of the OpenMP runtime have been
    linked into the program. That is dangerous, since it can degrade performance
    or cause incorrect results. The best thing to do is to ensure that only a
    single OpenMP runtime is linked into the process, e.g. by avoiding static
    linking of the OpenMP runtime in any library. As an unsafe, unsupported,
    undocumented workaround you can set the environment variable
    KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but
    that may cause crashes or silently produce incorrect results. For more
    information, please see http://openmp.llvm.org/
    

    See NOTE [ Linking both MKL and OpenMP ] for details.