|
| 1 | +# |
| 2 | +#//===----------------------------------------------------------------------===// |
| 3 | +#// |
| 4 | +#// The LLVM Compiler Infrastructure |
| 5 | +#// |
| 6 | +#// This file is dual licensed under the MIT and the University of Illinois Open |
| 7 | +#// Source Licenses. See LICENSE.txt for details. |
| 8 | +#// |
| 9 | +#//===----------------------------------------------------------------------===// |
| 10 | +# |
| 11 | + |
| 12 | +===================================================================== |
| 13 | +How to Build the LLVM* OpenMP* Offloading Runtime Library using CMake |
| 14 | +===================================================================== |
| 15 | + |
| 16 | +==== Version of CMake required: v2.8.0 or above ==== |
| 17 | + |
| 18 | +============================================ |
| 19 | +How to call cmake initially, then repeatedly |
| 20 | +============================================ |
| 21 | +- When calling cmake for the first time, all needed compiler options |
| 22 | + must be specified on the command line. After this initial call to |
| 23 | + cmake, the compiler definitions must not be included for further calls |
| 24 | + to cmake. Other options can be specified on the command line multiple |
| 25 | + times including all definitions in the Build options section below. |
| 26 | +- Example of configuring, building, reconfiguring, rebuilding: |
| 27 | + $ mkdir build |
| 28 | + $ cd build |
| 29 | + $ cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ .. # Initial configuration |
| 30 | + $ make |
| 31 | + ... |
| 32 | + $ make clean |
| 33 | + $ cmake -DCMAKE_BUILD_TYPE=Debug .. # Second configuration |
| 34 | + $ make |
| 35 | + ... |
| 36 | + $ rm -rf * |
| 37 | + $ cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ .. # Third configuration |
| 38 | + $ make |
| 39 | +- Notice in the example how the compiler definitions are only specified |
| 40 | + for an empty build directory, but other Build options are used at any time. |
| 41 | +- The file CMakeCache.txt which is created after the first call to cmake |
| 42 | + is a configuration file which holds all the values for the Build options. |
| 43 | + These configuration values can be changed using a text editor to modify |
| 44 | + CMakeCache.txt as opposed to using definitions on the command line. |
| 45 | +- To have cmake create a particular type of build generator file simply |
| 46 | + inlude the -G <Generator name> option: |
| 47 | + $ cmake -G "Unix Makefiles" ... |
| 48 | + You can see a list of generators cmake supports by executing cmake with |
| 49 | + no arguments and a list will be printed. |
| 50 | + |
| 51 | +===================== |
| 52 | +Instructions to Build |
| 53 | +===================== |
| 54 | + $ cd libomptarget_top_level/ [ directory with plugins/ , deviceRTLs/ , etc. ] |
| 55 | + $ mkdir build |
| 56 | + $ cd build |
| 57 | + |
| 58 | + [ Unix* Libraries ] |
| 59 | + $ cmake -DCMAKE_C_COMPILER=<C Compiler> -DCMAKE_CXX_COMPILER=<C++ Compiler> .. |
| 60 | + |
| 61 | + $ make |
| 62 | + $ make install |
| 63 | + |
| 64 | +=========== |
| 65 | +Tests |
| 66 | +=========== |
| 67 | +After the library has been built, there are optional tests that can be |
| 68 | +performed. Some will be skipped based upon the platform. |
| 69 | +To run the tests, |
| 70 | +$ make check-libomptarget |
| 71 | + |
| 72 | +============= |
| 73 | +CMake options |
| 74 | +============= |
| 75 | +-DCMAKE_C_COMPILER=<C compiler name> |
| 76 | +Specify the C compiler |
| 77 | + |
| 78 | +-DCMAKE_CXX_COMPILER=<C++ compiler name> |
| 79 | +Specify the C++ compiler |
| 80 | + |
| 81 | +==== First values listed are the default value ==== |
| 82 | +-DCMAKE_BUILD_TYPE=Release|Debug|RelWithDebInfo |
| 83 | +Build type can be Release, Debug, or RelWithDebInfo. |
| 84 | + |
| 85 | +-DLIBOMPTARGET_ENABLE_WERROR=true|false |
| 86 | +Should consider warnings as errors. |
| 87 | + |
| 88 | +-DLIBOMPTARGET_LLVM_LIT_EXECUTABLE="" |
| 89 | +Full path to the llvm-lit tool. Required for testing in out-of-tree builds. |
| 90 | + |
| 91 | +-DLIBOMPTARGET_FILECHECK_EXECUTABLE="" |
| 92 | +Full path to the FileCheck tool. Required for testing in out-of-tree builds. |
| 93 | + |
| 94 | +-DLIBOMPTARGET_OPENMP_HEADER_FOLDER="" |
| 95 | +Path of the folder that contains omp.h. This is required for testing |
| 96 | +out-of-tree builds. |
| 97 | + |
| 98 | +-DLIBOMPTARGET_OPENMP_HOST_RTL_FOLDER="" |
| 99 | +Path of the folder that contains libomp.so. This is required for testing |
| 100 | +out-of-tree builds. |
| 101 | + |
| 102 | +==== NVPTX device RTL specific ==== |
| 103 | +-DLIBOMPTARGET_NVPTX_ENABLE_BCLIB=false|true |
| 104 | +Enable CUDA LLVM bitcode offloading device RTL. This is used for |
| 105 | +link time optimization of the omp runtime and application code. |
| 106 | + |
| 107 | +-DLIBOMPTARGET_NVPTX_CUDA_COMPILER=<CUDA compiler name> |
| 108 | +Location of a CUDA compiler capable of emitting LLVM bitcode. |
| 109 | +Currently only the Clang compiler is supported. This is only used |
| 110 | +when building the CUDA LLVM bitcode offloading device RTL. If |
| 111 | +unspecified, the default paths are inspected. |
| 112 | + |
| 113 | +-DLIBOMPTARGET_NVPTX_BC_LINKER=<LLVM bitcode linker> |
| 114 | +Location of a linker capable of linking LLVM bitcode objects. |
| 115 | +This is only used when building the CUDA LLVM bitcode offloading |
| 116 | +device RTL. If unspecified, the default paths are inspected. |
| 117 | + |
| 118 | +-DLIBOMPTARGET_NVPTX_ALTERNATE_HOST_COMPILER="" |
| 119 | +Host compiler to use with NVCC. This compiler is not going to be used to produce |
| 120 | +any binary. Instead, this is used to overcome the input compiler checks done by |
| 121 | +NVCC. E.g. if using a default host compiler that is not compatible with NVCC, |
| 122 | +this option can be use to pass to NVCC a valid compiler to avoid the error. |
| 123 | + |
| 124 | +-DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITY="35" |
| 125 | +Comma-separated list of CUDA compute capabilities that should be supported by |
| 126 | +the NVPTX device RTL. E.g. for compute capabilities 3.0 and 3.5, the option |
| 127 | +"30,35" should be used. |
| 128 | + |
| 129 | +======================= |
| 130 | +Example usages of CMake |
| 131 | +======================= |
| 132 | +---- Typical usage ---- |
| 133 | +cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ .. |
| 134 | +cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ .. |
| 135 | + |
| 136 | +---- Request an NVPTX runtime library that supports compute capability 5.0 ---- |
| 137 | +cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITY="50" |
| 138 | + |
| 139 | +========= |
| 140 | +Footnotes |
| 141 | +========= |
| 142 | +[*] Other names and brands may be claimed as the property of others. |
0 commit comments