Skip to content

Commit

Permalink
Intel(R) SHMEM Library (ISHMEM) 1.0.0
Browse files Browse the repository at this point in the history
Signed-off-by: sys_shmem <[email protected]>
  • Loading branch information
sys-shmem committed Nov 21, 2023
1 parent e7ceb89 commit 81de715
Show file tree
Hide file tree
Showing 201 changed files with 43,966 additions and 11 deletions.
24 changes: 24 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright (C) 2023 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause

Language: Cpp
BasedOnStyle: Google
AccessModifierOffset: -2
AlignConsecutiveMacros: true
AlignEscapedNewlines: Right
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AlwaysBreakBeforeMultilineStrings: true
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortLoopsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
BreakBeforeBraces: WebKit
ColumnLimit: 100
Cpp11BracedListStyle: true
DerivePointerAlignment: false
PointerAlignment: Right
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: false
SortIncludes: false
SpaceAfterCStyleCast: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.*.sw*
build
tags
140 changes: 140 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# Copyright (C) 2023 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required(VERSION 3.17)

project(ishmem VERSION 1.0)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(ISHMRUN_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/scripts/ishmrun)

# Configurable paths
set(L0_INSTALL_PREFIX "/usr" CACHE PATH "Path to L0 installation")
set(SHMEM_INSTALL_PREFIX "/usr" CACHE PATH "Path to OpenSHMEM installation")

option(BUILD_SHARED_LIBS ON)

# Build flags for choosing back-ends
option(ENABLE_OPENSHMEM "Enable OpenSHMEM runtime support" ON)
#option(ENABLE_MPI "Enable MPI runtime support" OFF)
#option(ENABLE_PMI "Enable PMI runtime support" OFF)
#option(ENABLE_OSHMPI "Enable OSHMPI support for MPI runtimes" OFF)
#option(ENABLE_ONECCL "Enable ONECCL support for collectives" OFF)

# Build flags for selecting unit and performance tests
option(ENABLE_ERROR_CHECKING "Verify correctness of API arguments" OFF)
option(BUILD_TEST "Build Test" ON)
option(BUILD_PERF_TEST "Build Performance Test" ON)

# Build flags for choosing different configurations
option(ENABLE_GPU_RDMA "Enable GPU RDMA support" ON)

# Other build flags
option(USE_REDUCED_LINK_ENGINE_SET "Reduced link engines for single tile device" OFF)

option(CTEST_SCHEDULER "Job scheduler used for ctest" OFF)
if(NOT CTEST_SCHEDULER)
set(CTEST_SCHEDULER srun CACHE STRING "Job scheduler used for ctest" FORCE)
endif()
set(valid_schedulers srun qsub mpi)
list(FIND valid_schedulers "${CTEST_SCHEDULER}" scheduler_found)
if (scheduler_found EQUAL -1)
string(REPLACE ";" ", " valid_schedulers_csv "${valid_schedulers}")
message(FATAL_ERROR
"Invalid valid value for CTEST_SCHEDULER provided: ${CTEST_SCHEDULER}\n"
"Supported schedulers: ${valid_schedulers_csv}")
endif()
set(CTEST_WRAPPER ${CMAKE_CURRENT_SOURCE_DIR}/scripts/ctest/${CTEST_SCHEDULER}_wrapper)

enable_testing()

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")

configure_file(ishmem_config.h.in ishmem_config.h)

# adopt icpx -fsycl for all compilation, replacing dpcpp
set(CMAKE_CXX_COMPILER icpx)
add_compile_options(-fsycl)
add_link_options(-fsycl)
add_compile_options(-Werror -Wuninitialized)
add_compile_options(-Rno-debug-disables-optimization)
add_link_options(-Rno-debug-disables-optimization)

# Make sure at least one of the backends is enabled
if (ENABLE_MPI STREQUAL "OFF" AND ENABLE_OPENSHMEM STREQUAL "OFF" AND ENABLE_PMI STREQUAL "OFF")
message(FATAL ERROR "At least one of 'ENABLE_MPI', 'ENABLE_OPENSHMEM' or 'ENABLE_PMI' must be on")
endif()

# Check for valid L0 path
if (EXISTS "${L0_INSTALL_PREFIX}/include/level_zero/ze_api.h" AND
EXISTS "${L0_INSTALL_PREFIX}/include/level_zero/zet_api.h")
list(APPEND EXTRA_INCS "${L0_INSTALL_PREFIX}/include")
else()
message(FATAL_ERROR
"Cannot find level zero headers!\n"
"Provided: ${L0_INSTALL_PREFIX}\n"
"Required Headers:\n"
" level_zero/ze_api.h\n"
" level_zero/zet_api.h")
endif()

if (EXISTS "${L0_INSTALL_PREFIX}/lib64/libze_loader.so")
list(APPEND EXTRA_LIBS "-L${L0_INSTALL_PREFIX}/lib64 -lze_loader")
elseif (EXISTS "${L0_INSTALL_PREFIX}/lib/libze_loader.so")
list(APPEND EXTRA_LIBS "-L${L0_INSTALL_PREFIX}/lib -lze_loader")
else()
message(FATAL_ERROR
"Cannot find level zero library!\n"
"Provided: ${L0_INSTALL_PREFIX}\n"
"Required Headers:\n"
" libze_loader.so")
endif()

if (ENABLE_MPI)
find_package(MPI REQUIRED)
string(REGEX REPLACE "[^/]+/?$" "" MPI_CXX_LIBRARY_DIR "${MPI_mpicxx_LIBRARY}")
list(APPEND EXTRA_INCS ${MPI_CXX_INCLUDE_PATH})
list(APPEND EXTRA_LIBS -L${MPI_CXX_LIBRARY_DIR})
endif()

if (ENABLE_OPENSHMEM)
# Check for valid SOS path
if (EXISTS "${SHMEM_INSTALL_PREFIX}/include/shmem.h" AND
EXISTS "${SHMEM_INSTALL_PREFIX}/include/shmemx.h")
list(APPEND EXTRA_INCS "${SHMEM_INSTALL_PREFIX}/include")
else()
message(FATAL_ERROR
"Cannot find OpenSHMEM headers!\n"
"Provided: ${SHMEM_INSTALL_PREFIX}\n"
"Required Headers:\n"
" shmem.h\n"
" shmemx.h")
endif()

if (EXISTS "${SHMEM_INSTALL_PREFIX}/bin/oshc++")
execute_process(COMMAND ${SHMEM_INSTALL_PREFIX}/bin/oshc++ -showlibs OUTPUT_VARIABLE SHMEM_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
list(APPEND EXTRA_LIBS ${SHMEM_LIBS})
else()
message(FATAL_ERROR
"Cannot find OpenSHMEM library!\n"
"Provided: ${SHMEM_INSTALL_PREFIX}\n"
"Required files:\n"
" oshc++")
endif()
endif()

add_subdirectory(pmi-simple)
add_subdirectory(src)
add_subdirectory(examples)
if (BUILD_TEST)
add_subdirectory(test)
endif()

# setup installer
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_VERSION_MAJOR "${ISHMEM_MAJOR_VERSION}")
set(CPACK_PACKAGE_VERSION_MINOR "${ISHMEM_MINOR_VERSION}")
include(CPack)

install(PROGRAMS scripts/ishmrun DESTINATION bin)
60 changes: 50 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,54 @@
# Contributing
# Contributing guidelines

### License
We welcome community contributions to Intel® SHMEM. You can:

<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.
- Submit your changes directly with a [pull request](pulls).
- Log a bug or feedback with an [issue](issues).

Refer to our guidelines on [pull requests](#pull-requests) and [issues](#issues) before proceeding.

## Issues

Use [Github issues](issues) to:
- report an issue
- provide feedback
- make a feature request

**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).

## Pull requests

Before you submit a pull request, please ensure the following:
- Follow our [code contribution guidelines](#code-contribution-guidelines) and [coding style guidelines](#coding-style-guidelines)
- Extend the existing [unit tests](#unit-tests) when fixing an issue.
- [Signed-off](#sign-your-work) your work.

**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).

### Code contribution guidelines

Contributed code must be:
- *Tested*
- *Documented*
- *Portable*

### Coding style

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:

```
clang-format -style=file -i <FILE>
```

This will format the code using the `.clang-format` file found in the top-level directory of this repository.

### Unit tests

Be sure to extend the existing tests when fixing an issue.

### Sign your work

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
the below (from [developercertificate.org](http://developercertificate.org/)):
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/)):

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

Then you just add a line to every git commit message:
Then add a line to every git commit message:

Signed-off-by: Joe Smith <joe[email protected]>
Signed-off-by: Kris Smith <kris[email protected]>

Use your real name (sorry, no pseudonyms or anonymous contributions.)
**Note**: Use your real name.

If you set your `user.name` and `user.email` git configs, you can sign your
commit automatically with `git commit -s`.
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`.
30 changes: 30 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Copyright (c) 2023 Intel Corporation.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
“AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

SPDX-License-Identifier: BSD-3-Clause
Loading

0 comments on commit 81de715

Please sign in to comment.