-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Initial OpenMP support #25937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
JAicewizard
wants to merge
12
commits into
emscripten-core:main
Choose a base branch
from
JAicewizard:libomp
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Initial OpenMP support #25937
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1d7e6b9
Initial OMP support
JAicewizard f69cfb1
Fix formatting and copy
JAicewizard 2b81189
Unfortunatly, we do need docs
JAicewizard 45736c8
Move away from cmake for building libomp at runtime
JAicewizard ded2f91
Remove object files
JAicewizard df58065
Remove archives
JAicewizard f66394b
Fix python issues
JAicewizard 9124815
Add trailing comma
JAicewizard 7f947e4
Fix whitespace
JAicewizard c0df238
Fix tests for openmp
JAicewizard 5078651
Apply suggestions
JAicewizard 67a6100
format
JAicewizard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| #==============================================================================# | ||
| # This file specifies intentionally untracked files that git should ignore. | ||
| # See: http://www.kernel.org/pub/software/scm/git/docs/gitignore.html | ||
| # | ||
| # This file is intentionally different from the output of `git svn show-ignore`, | ||
| # as most of those are useless. | ||
| #==============================================================================# | ||
|
|
||
| #==============================================================================# | ||
| # File extensions to be ignored anywhere in the tree. | ||
| #==============================================================================# | ||
| # Temp files created by most text editors. | ||
| *~ | ||
| # Merge files created by git. | ||
| *.orig | ||
| # Byte compiled python modules. | ||
| *.pyc | ||
| # vim swap files | ||
| .*.sw? | ||
| .sw? | ||
| #OS X specific files. | ||
| .DS_store | ||
| # Python egg files | ||
| *.eggs | ||
|
|
||
| #==============================================================================# | ||
| # Explicit files to ignore (only matches one). | ||
| #==============================================================================# | ||
| # Various tag programs | ||
| tags | ||
| /TAGS | ||
| /GPATH | ||
| /GRTAGS | ||
| /GSYMS | ||
| /GTAGS | ||
| .gitusers | ||
|
|
||
| #==============================================================================# | ||
| # Directories to ignore (do not add trailing '/'s, they skip symlinks). | ||
| #==============================================================================# | ||
| runtime/exports | ||
|
|
||
| # Nested build directory | ||
| /build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,174 @@ | ||
| cmake_minimum_required(VERSION 3.20.0) | ||
| set(LLVM_SUBPROJECT_TITLE "OpenMP") | ||
|
|
||
| set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) | ||
|
|
||
| # Add path for custom modules | ||
| list(INSERT CMAKE_MODULE_PATH 0 | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/cmake" | ||
| "${LLVM_COMMON_CMAKE_UTILS}/Modules" | ||
| ) | ||
|
|
||
| # llvm/runtimes/ will set OPENMP_STANDALONE_BUILD. | ||
| if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") | ||
| set(OPENMP_STANDALONE_BUILD TRUE) | ||
| project(openmp C CXX ASM) | ||
| else() | ||
| set(OPENMP_STANDALONE_BUILD FALSE) | ||
| endif() | ||
|
|
||
| # Must go below project(..) | ||
| include(GNUInstallDirs) | ||
|
|
||
| if (OPENMP_STANDALONE_BUILD) | ||
| set(LLVM_TREE_AVAILABLE False) | ||
|
|
||
| # CMAKE_BUILD_TYPE was not set, default to Release. | ||
| if (NOT CMAKE_BUILD_TYPE) | ||
| set(CMAKE_BUILD_TYPE Release) | ||
| endif() | ||
|
|
||
| # Group common settings. | ||
| set(OPENMP_ENABLE_WERROR FALSE CACHE BOOL | ||
| "Enable -Werror flags to turn warnings into errors for supporting compilers.") | ||
| set(OPENMP_LIBDIR_SUFFIX "" CACHE STRING | ||
| "Suffix of lib installation directory, e.g. 64 => lib64") | ||
| # Do not use OPENMP_LIBDIR_SUFFIX directly, use OPENMP_INSTALL_LIBDIR. | ||
| set(OPENMP_INSTALL_LIBDIR "lib${OPENMP_LIBDIR_SUFFIX}" CACHE STRING | ||
| "Path where built OpenMP libraries should be installed.") | ||
|
|
||
| # Group test settings. | ||
| set(OPENMP_TEST_C_COMPILER ${CMAKE_C_COMPILER} CACHE STRING | ||
| "C compiler to use for testing OpenMP runtime libraries.") | ||
| set(OPENMP_TEST_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING | ||
| "C++ compiler to use for testing OpenMP runtime libraries.") | ||
| set(OPENMP_TEST_Fortran_COMPILER ${CMAKE_Fortran_COMPILER} CACHE STRING | ||
| "FORTRAN compiler to use for testing OpenMP runtime libraries.") | ||
| set(OPENMP_LLVM_TOOLS_DIR "" CACHE PATH "Path to LLVM tools for testing.") | ||
|
|
||
| set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to") | ||
| set(CMAKE_CXX_STANDARD_REQUIRED NO) | ||
| set(CMAKE_CXX_EXTENSIONS NO) | ||
| else() | ||
| # Usually <llvm-project>/runtimes/CMakeLists.txt sets LLVM_TREE_AVAILABLE and | ||
| # we assume it is not available otherwise. The exception is that we are in an | ||
| # LLVM_ENABLE_PROJECTS=openmp build, the LLVM tree is actually available. | ||
| # Note that this build mode has been deprecated. | ||
| # See https://github.com/llvm/llvm-project/issues/124014 | ||
| if (NOT LLVM_RUNTIMES_BUILD AND "openmp" IN_LIST LLVM_ENABLE_PROJECTS) | ||
| set(LLVM_TREE_AVAILABLE True) | ||
| endif () | ||
|
|
||
| set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR}) | ||
|
|
||
| # When building in tree we install the runtime according to the LLVM settings. | ||
| if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) | ||
| set(OPENMP_INSTALL_LIBDIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE STRING | ||
| "Path where built openmp libraries should be installed.") | ||
| else() | ||
| set(OPENMP_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}" CACHE STRING | ||
| "Path where built OpenMP libraries should be installed.") | ||
| endif() | ||
|
|
||
| if (NOT MSVC) | ||
| set(OPENMP_TEST_C_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang) | ||
| set(OPENMP_TEST_CXX_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang++) | ||
| else() | ||
| set(OPENMP_TEST_C_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang.exe) | ||
| set(OPENMP_TEST_CXX_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang++.exe) | ||
| endif() | ||
|
|
||
| # Set fortran test compiler if flang is found | ||
| if (EXISTS "${OPENMP_TEST_Fortran_COMPILER}") | ||
| message("Using local flang build at ${OPENMP_TEST_Fortran_COMPILER}") | ||
| else() | ||
| unset(OPENMP_TEST_Fortran_COMPILER) | ||
| endif() | ||
|
|
||
| # If not standalone, set CMAKE_CXX_STANDARD but don't set the global cache value, | ||
| # only set it locally for OpenMP. | ||
| set(CMAKE_CXX_STANDARD 17) | ||
| set(CMAKE_CXX_STANDARD_REQUIRED NO) | ||
| set(CMAKE_CXX_EXTENSIONS NO) | ||
| endif() | ||
|
|
||
| # Check and set up common compiler flags. | ||
| include(config-ix) | ||
| include(HandleOpenMPOptions) | ||
|
|
||
| # Check for flang | ||
| set(OPENMP_TEST_Fortran_COMPILER_default "") | ||
| if (CMAKE_Fortran_COMPILER) | ||
| set(OPENMP_TEST_Fortran_COMPILER_default "${CMAKE_Fortran_COMPILER}") | ||
| endif () | ||
| set(OPENMP_TEST_Fortran_COMPILER "${OPENMP_TEST_Fortran_COMPILER_default}" CACHE STRING | ||
| "Fortran compiler to use for testing OpenMP runtime libraries.") | ||
|
|
||
| # Set up testing infrastructure. | ||
| include(OpenMPTesting) | ||
|
|
||
| set(OPENMP_TEST_FLAGS "" CACHE STRING | ||
| "Extra compiler flags to send to the test compiler.") | ||
| set(OPENMP_TEST_OPENMP_FLAGS ${OPENMP_TEST_COMPILER_OPENMP_FLAGS} CACHE STRING | ||
| "OpenMP compiler flag to use for testing OpenMP runtime libraries.") | ||
|
|
||
| set(ENABLE_LIBOMPTARGET ON) | ||
| # Currently libomptarget cannot be compiled on Windows or MacOS X. | ||
| # Since the device plugins are only supported on Linux anyway, | ||
| # there is no point in trying to compile libomptarget on other OSes. | ||
| # 32-bit systems are not supported either. | ||
| if (APPLE OR WIN32 OR WASM OR NOT "cxx_std_17" IN_LIST CMAKE_CXX_COMPILE_FEATURES | ||
| OR NOT CMAKE_SIZEOF_VOID_P EQUAL 8 OR "${CMAKE_SYSTEM_NAME}" MATCHES "AIX") | ||
| set(ENABLE_LIBOMPTARGET OFF) | ||
| endif() | ||
|
|
||
| option(OPENMP_ENABLE_LIBOMPTARGET "Enable building libomptarget for offloading." | ||
| ${ENABLE_LIBOMPTARGET}) | ||
| option(OPENMP_ENABLE_LIBOMP_PROFILING "Enable time profiling for libomp." OFF) | ||
|
|
||
| # Header install location | ||
| if(NOT LLVM_TREE_AVAILABLE) | ||
| set(LIBOMP_HEADERS_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}") | ||
| else() | ||
| include(GetClangResourceDir) | ||
| get_clang_resource_dir(LIBOMP_HEADERS_INSTALL_PATH SUBDIR include) | ||
| endif() | ||
|
|
||
| # Use the current compiler target to determine the appropriate runtime to build. | ||
| if("${LLVM_DEFAULT_TARGET_TRIPLE}" MATCHES "^amdgcn|^nvptx" OR | ||
| "${CMAKE_CXX_COMPILER_TARGET}" MATCHES "^amdgcn|^nvptx") | ||
| add_subdirectory(device) | ||
| else() | ||
| # Build host runtime library, after LIBOMPTARGET variables are set since they | ||
| # are needed to enable time profiling support in the OpenMP runtime. | ||
| add_subdirectory(runtime) | ||
|
|
||
| set(ENABLE_OMPT_TOOLS ON) | ||
| # Currently tools are not tested well on Windows or MacOS X. | ||
| if (APPLE OR WIN32) | ||
| set(ENABLE_OMPT_TOOLS OFF) | ||
| endif() | ||
|
|
||
| option(OPENMP_ENABLE_OMPT_TOOLS "Enable building ompt based tools for OpenMP." | ||
| ${ENABLE_OMPT_TOOLS}) | ||
| if (OPENMP_ENABLE_OMPT_TOOLS) | ||
| add_subdirectory(tools) | ||
| endif() | ||
|
|
||
| # Propagate OMPT support to offload | ||
| if(NOT ${OPENMP_STANDALONE_BUILD}) | ||
| set(LIBOMP_HAVE_OMPT_SUPPORT ${LIBOMP_HAVE_OMPT_SUPPORT} PARENT_SCOPE) | ||
| set(LIBOMP_OMP_TOOLS_INCLUDE_DIR ${LIBOMP_OMP_TOOLS_INCLUDE_DIR} PARENT_SCOPE) | ||
| endif() | ||
|
|
||
| option(OPENMP_MSVC_NAME_SCHEME "Build dll with MSVC naming scheme." OFF) | ||
|
|
||
| # Build libompd.so | ||
| add_subdirectory(libompd) | ||
|
|
||
| # Build documentation | ||
| add_subdirectory(docs) | ||
|
|
||
| # Now that we have seen all testsuites, create the check-openmp target. | ||
| construct_check_openmp_target() | ||
| endif() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| This file is a partial list of people who have contributed to the LLVM/openmp | ||
| project. If you have contributed a patch or made some other contribution to | ||
| LLVM/openmp, please submit a patch to this file to add yourself, and it will be | ||
| done! | ||
|
|
||
| The list is sorted by surname and formatted to allow easy grepping and | ||
| beautification by scripts. The fields are: name (N), email (E), web-address | ||
| (W), PGP key ID and fingerprint (P), description (D), and snail-mail address | ||
| (S). | ||
|
|
||
| N: Adam Azarchs | ||
| W: 10xgenomics.com | ||
| D: Bug fix for lock code | ||
|
|
||
| N: Carlo Bertolli | ||
| W: http://ibm.com | ||
| D: IBM contributor to PowerPC support in CMake files and elsewhere. | ||
|
|
||
| N: Diego Caballero | ||
| E: diego.l.caballero@gmail.com | ||
| D: Fork performance improvements | ||
|
|
||
| N: Sunita Chandrasekaran | ||
| D: Contributor to testsuite from OpenUH | ||
|
|
||
| N: Barbara Chapman | ||
| D: Contributor to testsuite from OpenUH | ||
|
|
||
| N: University of Houston | ||
| W: http://web.cs.uh.edu/~openuh/download/ | ||
| D: OpenUH test suite | ||
|
|
||
| N: Intel Corporation OpenMP runtime team | ||
| W: http://openmprtl.org | ||
| D: Created the runtime. | ||
|
|
||
| N: John Mellor-Crummey and other members of the OpenMP Tools Working Group | ||
| E: johnmc@rice.edu | ||
| D: OpenMP Tools Interface (OMPT) | ||
|
|
||
| N: Matthias Muller | ||
| D: Contributor to testsuite from OpenUH | ||
|
|
||
| N: Tal Nevo | ||
| E: tal@scalemp.com | ||
| D: ScaleMP contributor to improve runtime performance there. | ||
| W: http://scalemp.com | ||
|
|
||
| N: Pavel Neytchev | ||
| D: Contributor to testsuite from OpenUH | ||
|
|
||
| N: Steven Noonan | ||
| E: steven@uplinklabs.net | ||
| D: Patches for the ARM architecture and removal of several inconsistencies. | ||
|
|
||
| N: Joachim Protze | ||
| E: protze@itc.rwth-aachen.de | ||
| D: OpenMP Tools Interface, Archer tool | ||
|
|
||
| N: Alp Toker | ||
| E: alp@nuanti.com | ||
| D: Making build work for FreeBSD. | ||
|
|
||
| N: Cheng Wang | ||
| D: Contributor to testsuite from OpenUH |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.