Skip to content

Commit 81de715

Browse files
committed
Intel(R) SHMEM Library (ISHMEM) 1.0.0
Signed-off-by: sys_shmem <sys_shmem@intel.com>
1 parent e7ceb89 commit 81de715

File tree

201 files changed

+43966
-11
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

201 files changed

+43966
-11
lines changed

.clang-format

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright (C) 2023 Intel Corporation
2+
# SPDX-License-Identifier: BSD-3-Clause
3+
4+
Language: Cpp
5+
BasedOnStyle: Google
6+
AccessModifierOffset: -2
7+
AlignConsecutiveMacros: true
8+
AlignEscapedNewlines: Right
9+
AllowAllArgumentsOnNextLine: false
10+
AllowAllParametersOfDeclarationOnNextLine: false
11+
AlwaysBreakBeforeMultilineStrings: true
12+
AllowShortEnumsOnASingleLine: false
13+
AllowShortFunctionsOnASingleLine: Empty
14+
AllowShortLoopsOnASingleLine: false
15+
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
16+
BreakBeforeBraces: WebKit
17+
ColumnLimit: 100
18+
Cpp11BracedListStyle: true
19+
DerivePointerAlignment: false
20+
PointerAlignment: Right
21+
IndentWidth: 4
22+
KeepEmptyLinesAtTheStartOfBlocks: false
23+
SortIncludes: false
24+
SpaceAfterCStyleCast: true

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.*.sw*
2+
build
3+
tags

CMakeLists.txt

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# Copyright (C) 2023 Intel Corporation
2+
# SPDX-License-Identifier: BSD-3-Clause
3+
4+
cmake_minimum_required(VERSION 3.17)
5+
6+
project(ishmem VERSION 1.0)
7+
8+
set(CMAKE_CXX_STANDARD 17)
9+
set(CMAKE_CXX_STANDARD_REQUIRED True)
10+
set(ISHMRUN_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/scripts/ishmrun)
11+
12+
# Configurable paths
13+
set(L0_INSTALL_PREFIX "/usr" CACHE PATH "Path to L0 installation")
14+
set(SHMEM_INSTALL_PREFIX "/usr" CACHE PATH "Path to OpenSHMEM installation")
15+
16+
option(BUILD_SHARED_LIBS ON)
17+
18+
# Build flags for choosing back-ends
19+
option(ENABLE_OPENSHMEM "Enable OpenSHMEM runtime support" ON)
20+
#option(ENABLE_MPI "Enable MPI runtime support" OFF)
21+
#option(ENABLE_PMI "Enable PMI runtime support" OFF)
22+
#option(ENABLE_OSHMPI "Enable OSHMPI support for MPI runtimes" OFF)
23+
#option(ENABLE_ONECCL "Enable ONECCL support for collectives" OFF)
24+
25+
# Build flags for selecting unit and performance tests
26+
option(ENABLE_ERROR_CHECKING "Verify correctness of API arguments" OFF)
27+
option(BUILD_TEST "Build Test" ON)
28+
option(BUILD_PERF_TEST "Build Performance Test" ON)
29+
30+
# Build flags for choosing different configurations
31+
option(ENABLE_GPU_RDMA "Enable GPU RDMA support" ON)
32+
33+
# Other build flags
34+
option(USE_REDUCED_LINK_ENGINE_SET "Reduced link engines for single tile device" OFF)
35+
36+
option(CTEST_SCHEDULER "Job scheduler used for ctest" OFF)
37+
if(NOT CTEST_SCHEDULER)
38+
set(CTEST_SCHEDULER srun CACHE STRING "Job scheduler used for ctest" FORCE)
39+
endif()
40+
set(valid_schedulers srun qsub mpi)
41+
list(FIND valid_schedulers "${CTEST_SCHEDULER}" scheduler_found)
42+
if (scheduler_found EQUAL -1)
43+
string(REPLACE ";" ", " valid_schedulers_csv "${valid_schedulers}")
44+
message(FATAL_ERROR
45+
"Invalid valid value for CTEST_SCHEDULER provided: ${CTEST_SCHEDULER}\n"
46+
"Supported schedulers: ${valid_schedulers_csv}")
47+
endif()
48+
set(CTEST_WRAPPER ${CMAKE_CURRENT_SOURCE_DIR}/scripts/ctest/${CTEST_SCHEDULER}_wrapper)
49+
50+
enable_testing()
51+
52+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
53+
54+
configure_file(ishmem_config.h.in ishmem_config.h)
55+
56+
# adopt icpx -fsycl for all compilation, replacing dpcpp
57+
set(CMAKE_CXX_COMPILER icpx)
58+
add_compile_options(-fsycl)
59+
add_link_options(-fsycl)
60+
add_compile_options(-Werror -Wuninitialized)
61+
add_compile_options(-Rno-debug-disables-optimization)
62+
add_link_options(-Rno-debug-disables-optimization)
63+
64+
# Make sure at least one of the backends is enabled
65+
if (ENABLE_MPI STREQUAL "OFF" AND ENABLE_OPENSHMEM STREQUAL "OFF" AND ENABLE_PMI STREQUAL "OFF")
66+
message(FATAL ERROR "At least one of 'ENABLE_MPI', 'ENABLE_OPENSHMEM' or 'ENABLE_PMI' must be on")
67+
endif()
68+
69+
# Check for valid L0 path
70+
if (EXISTS "${L0_INSTALL_PREFIX}/include/level_zero/ze_api.h" AND
71+
EXISTS "${L0_INSTALL_PREFIX}/include/level_zero/zet_api.h")
72+
list(APPEND EXTRA_INCS "${L0_INSTALL_PREFIX}/include")
73+
else()
74+
message(FATAL_ERROR
75+
"Cannot find level zero headers!\n"
76+
"Provided: ${L0_INSTALL_PREFIX}\n"
77+
"Required Headers:\n"
78+
" level_zero/ze_api.h\n"
79+
" level_zero/zet_api.h")
80+
endif()
81+
82+
if (EXISTS "${L0_INSTALL_PREFIX}/lib64/libze_loader.so")
83+
list(APPEND EXTRA_LIBS "-L${L0_INSTALL_PREFIX}/lib64 -lze_loader")
84+
elseif (EXISTS "${L0_INSTALL_PREFIX}/lib/libze_loader.so")
85+
list(APPEND EXTRA_LIBS "-L${L0_INSTALL_PREFIX}/lib -lze_loader")
86+
else()
87+
message(FATAL_ERROR
88+
"Cannot find level zero library!\n"
89+
"Provided: ${L0_INSTALL_PREFIX}\n"
90+
"Required Headers:\n"
91+
" libze_loader.so")
92+
endif()
93+
94+
if (ENABLE_MPI)
95+
find_package(MPI REQUIRED)
96+
string(REGEX REPLACE "[^/]+/?$" "" MPI_CXX_LIBRARY_DIR "${MPI_mpicxx_LIBRARY}")
97+
list(APPEND EXTRA_INCS ${MPI_CXX_INCLUDE_PATH})
98+
list(APPEND EXTRA_LIBS -L${MPI_CXX_LIBRARY_DIR})
99+
endif()
100+
101+
if (ENABLE_OPENSHMEM)
102+
# Check for valid SOS path
103+
if (EXISTS "${SHMEM_INSTALL_PREFIX}/include/shmem.h" AND
104+
EXISTS "${SHMEM_INSTALL_PREFIX}/include/shmemx.h")
105+
list(APPEND EXTRA_INCS "${SHMEM_INSTALL_PREFIX}/include")
106+
else()
107+
message(FATAL_ERROR
108+
"Cannot find OpenSHMEM headers!\n"
109+
"Provided: ${SHMEM_INSTALL_PREFIX}\n"
110+
"Required Headers:\n"
111+
" shmem.h\n"
112+
" shmemx.h")
113+
endif()
114+
115+
if (EXISTS "${SHMEM_INSTALL_PREFIX}/bin/oshc++")
116+
execute_process(COMMAND ${SHMEM_INSTALL_PREFIX}/bin/oshc++ -showlibs OUTPUT_VARIABLE SHMEM_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
117+
list(APPEND EXTRA_LIBS ${SHMEM_LIBS})
118+
else()
119+
message(FATAL_ERROR
120+
"Cannot find OpenSHMEM library!\n"
121+
"Provided: ${SHMEM_INSTALL_PREFIX}\n"
122+
"Required files:\n"
123+
" oshc++")
124+
endif()
125+
endif()
126+
127+
add_subdirectory(pmi-simple)
128+
add_subdirectory(src)
129+
add_subdirectory(examples)
130+
if (BUILD_TEST)
131+
add_subdirectory(test)
132+
endif()
133+
134+
# setup installer
135+
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
136+
set(CPACK_PACKAGE_VERSION_MAJOR "${ISHMEM_MAJOR_VERSION}")
137+
set(CPACK_PACKAGE_VERSION_MINOR "${ISHMEM_MINOR_VERSION}")
138+
include(CPack)
139+
140+
install(PROGRAMS scripts/ishmrun DESTINATION bin)

CONTRIBUTING.md

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,54 @@
1-
# Contributing
1+
# Contributing guidelines
22

3-
### License
3+
We welcome community contributions to Intel® SHMEM. You can:
44

5-
<PROJECT NAME> is licensed under the terms in [LICENSE]<link to license file in repo>. By contributing to the project, you agree to the license and copyright terms therein and release your contribution under these terms.
5+
- Submit your changes directly with a [pull request](pulls).
6+
- Log a bug or feedback with an [issue](issues).
7+
8+
Refer to our guidelines on [pull requests](#pull-requests) and [issues](#issues) before proceeding.
9+
10+
## Issues
11+
12+
Use [Github issues](issues) to:
13+
- report an issue
14+
- provide feedback
15+
- make a feature request
16+
17+
**Note**: To report a vulnerability, please refer to the [Intel vulnerability reporting policy](https://www.intel.com/content/www/us/en/security-center/default.html).
18+
19+
## Pull requests
20+
21+
Before you submit a pull request, please ensure the following:
22+
- Follow our [code contribution guidelines](#code-contribution-guidelines) and [coding style guidelines](#coding-style-guidelines)
23+
- Extend the existing [unit tests](#unit-tests) when fixing an issue.
24+
- [Signed-off](#sign-your-work) your work.
25+
26+
**Note:** This project follows the [Github flow](https://docs.github.com/en/get-started/quickstart/github-flow) process. To get started with a pull request, see [Github how-to](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests).
27+
28+
### Code contribution guidelines
29+
30+
Contributed code must be:
31+
- *Tested*
32+
- *Documented*
33+
- *Portable*
34+
35+
### Coding style
36+
37+
The code style and consistency is maintained using `clang-format`. When submitting a contribution, please make sure that it adheres to the existing coding style by using the following command:
38+
39+
```
40+
clang-format -style=file -i <FILE>
41+
```
42+
43+
This will format the code using the `.clang-format` file found in the top-level directory of this repository.
44+
45+
### Unit tests
46+
47+
Be sure to extend the existing tests when fixing an issue.
648

749
### Sign your work
850

9-
Please use the sign-off line at the end of the patch. Your signature certifies that you wrote the patch or otherwise have the right to pass it on as an open-source patch. The rules are pretty simple: if you can certify
10-
the below (from [developercertificate.org](http://developercertificate.org/)):
51+
Use the sign-off line at the end of the patch. Your signature certifies that you wrote the patch or otherwise have the right to pass it on as an open-source patch. If you can certify the below (from [developercertificate.org](http://developercertificate.org/)):
1152

1253
```
1354
Developer Certificate of Origin
@@ -47,11 +88,10 @@ By making a contribution to this project, I certify that:
4788
this project or the open source license(s) involved.
4889
```
4990

50-
Then you just add a line to every git commit message:
91+
Then add a line to every git commit message:
5192

52-
Signed-off-by: Joe Smith <joe.smith@email.com>
93+
Signed-off-by: Kris Smith <kris.smith@email.com>
5394

54-
Use your real name (sorry, no pseudonyms or anonymous contributions.)
95+
**Note**: Use your real name.
5596

56-
If you set your `user.name` and `user.email` git configs, you can sign your
57-
commit automatically with `git commit -s`.
97+
If you set your `user.name` and `user.email` git configurations, your commit can be signed automatically with `git commit -s` or `git commit -S`.

LICENSE

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Copyright (c) 2023 Intel Corporation.
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are
5+
met:
6+
7+
1. Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
10+
2. Redistributions in binary form must reproduce the above copyright
11+
notice, this list of conditions and the following disclaimer in the
12+
documentation and/or other materials provided with the distribution.
13+
14+
3. Neither the name of the copyright holder nor the names of its
15+
contributors may be used to endorse or promote products derived from
16+
this software without specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+
“AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
30+
SPDX-License-Identifier: BSD-3-Clause

0 commit comments

Comments
 (0)