Skip to content

Commit

Permalink
Merge pull request #1 from Tohoku-University-Takizawa-Lab/release
Browse files Browse the repository at this point in the history
Initial public release
  • Loading branch information
keichi authored Jun 30, 2022
2 parents a2bd11d + 3fdd003 commit 32ee42f
Show file tree
Hide file tree
Showing 137 changed files with 5,352 additions and 11,045 deletions.
21 changes: 21 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
BasedOnStyle: LLVM
Language: Cpp
AlignConsecutiveAssignments: Consecutive
AlignTrailingComments: true
AllowShortFunctionsOnASingleLine: Empty
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: false
AfterControlStatement: MultiLine
AfterEnum: false
AfterFunction: false
AfterNamespace: false
# AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: true
BeforeElse: true
IndentBraces: false
PointerAlignment: Left
SortIncludes: false
103 changes: 103 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
format:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- name: Check coding style
run: |
git ls-files '*.cpp' '*.hpp' | xargs clang-format-13 --dry-run --Werror
build:
strategy:
fail-fast: false
matrix:
os:
- rockylinux/rockylinux:8
- ubuntu:20.04
device:
- host
- cpu
- ve

runs-on: ubuntu-latest
container:
image: ${{ matrix.os }}

steps:
- name: Install dependencies (Rocky Linux)
run: |
yum install -y git gcc gcc-c++ cmake make clang-devel llvm-devel python3 libffi-devel
if: ${{ startsWith(matrix.os, 'rockylinux') }}

- name: Install dependencies (Ubuntu)
run: |
apt-get update
apt-get install -y git gcc g++ cmake make pkg-config clang-12 libclang-12-dev llvm-12-dev python3 libffi-dev
env:
DEBIAN_FRONTEND: noninteractive
if: ${{ startsWith(matrix.os, 'ubuntu') }}

- name: Checkout veo-stubs
uses: actions/checkout@v3
with:
repository: keichi/veo-stubs
ref: v0.1.0
path: veo-stubs
submodules: true
if: ${{ matrix.device == 've' }}

- name: Build and install veo-stubs
run: |
cmake -B build-veo-stubs -S veo-stubs -DCMAKE_INSTALL_PREFIX=/opt/nec/ve/veos
cmake --build build-veo-stubs --parallel $(nproc)
cmake --install build-veo-stubs
if: ${{ matrix.device == 've' }}

- name: Checkout neoSYCL
uses: actions/checkout@v3
with:
path: neoSYCL

- name: Configure and install neoSYCL
run: |
cmake -B build-neoSYCL -S neoSYCL
if: ${{ matrix.device == 'host' }}

- name: Configure and install neoSYCL
run: |
cmake -B build-neoSYCL -DBUILD_KERNEL_OUTLINER=ON -S neoSYCL
if: ${{ matrix.device == 'cpu' }}

- name: Configure and install neoSYCL
run: |
cmake -B build-neoSYCL -DBUILD_VE=ON -DBUILD_KERNEL_OUTLINER=ON -S neoSYCL
if: ${{ matrix.device == 've' }}

- name: Build and install neoSYCL
run: |
cmake --build build-neoSYCL --parallel $(nproc)
cmake --install build-neoSYCL
- name: Checkout veo-sycl-bench
uses: actions/checkout@v3
with:
repository: Tohoku-University-Takizawa-Lab/veo-sycl-bench
path: veo-sycl-bench
ref: 2670124d4aed0b867c78c27aa9780a21a21aebd1

- name: Build and run veo-sycl-bench
run: |
cp neoSYCL/tests/test_veosycl.sh veo-sycl-bench/
cd veo-sycl-bench
./test_veosycl.sh ${{ matrix.device }}
env:
DEVICE_COMPILER: g++
23 changes: 14 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,18 @@
*.out
*.app

# CLion tmp dirs
# CMake
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps

build
.idea
cmake-build-debug
cmake-build-release
node_modules
package-lock.json
package.json

.DS_Store
.DS_Store
53 changes: 22 additions & 31 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,46 +1,37 @@
cmake_minimum_required(VERSION 3.4)
project(neoSYCL C CXX)
cmake_minimum_required(VERSION 3.10)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")

option(BUILD_KERNEL_GENERATOR "build sycl kernel generator" OFF)
option(BUILD_VE "Enable SX-Aurora support" OFF)
#option(BUILD_TESTING "Enable build tests" OFF)
project(neoSYCL LANGUAGES CXX VERSION 0.5.0)
add_library(neoSYCL INTERFACE)

set(CMAKE_CXX_STANDARD 17)

if (BUILD_KERNEL_GENERATOR)
add_subdirectory(kernel_generator)
endif ()

option(BUILD_KERNEL_OUTLINER "Build SYCL kernel outliner" ON)
option(BUILD_VE "Enable SX-Aurora TSUBASA support" OFF)

if (BUILD_VE)
ADD_DEFINITIONS(-DBUILD_VE)
add_definitions(-DBUILD_VE)
# find VEOS headers and libs
set(VEO_HEADER_PATH "/opt/nec/ve/veos/include" CACHE PATH "veo headers path")
set(VEO_LIB_PATH "/opt/nec/ve/veos/lib64" CACHE PATH "veo libs path")
set(VEO_DIR "/opt/nec/ve/veos" CACHE PATH "VEO installation path")
find_path(VEO_HEADER_PATH ve_offload.h HINTS ${VEO_DIR} PATH_SUFFIXES include)
find_path(VEO_LIB_PATH libveo.so HINTS ${VEO_DIR} PATH_SUFFIXES lib64)

message(STATUS "Enable SX-Aurora support")
message(STATUS "Use veo headers path: ${VEO_HEADER_PATH}")
message(STATUS "Use veo libs path: ${VEO_LIB_PATH}")
message(STATUS "Use VEO headers path: ${VEO_HEADER_PATH}")
message(STATUS "Use VEO libs path: ${VEO_LIB_PATH}")

include_directories(${VEO_HEADER_PATH})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${VEO_LIB_PATH} -Wl,-rpath=${VEO_LIB_PATH} -lveo")
include_directories(${VEO_HEADER_PATH} include/neoSYCL/)
endif ()

# debug info
if (CMAKE_BUILD_TYPE STREQUAL Debug)
message(STATUS "Enable debug mode")
ADD_DEFINITIONS(-DDEBUG)
include_directories(third_party/fmt/include)
if (BUILD_KERNEL_OUTLINER)
add_subdirectory(src)
endif ()

include_directories(include)

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lpthread")

# add examples
add_subdirectory(examples)
target_include_directories(
neoSYCL
INTERFACE $<BUILD_INTERFACE:include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

# add tests
add_subdirectory(tests)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/neoSYCL DESTINATION include)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/CL DESTINATION include)
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 High Performance Computing Laboratory, Tohoku University

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
56 changes: 45 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,59 @@
# neoSYCL
SYCL Implementation for CPU / NEC SX-Aurora TSUBASA (SX-AT)

[![build](https://github.com/Tohoku-University-Takizawa-Lab/neoSYCL/actions/workflows/ci.yml/badge.svg)](https://github.com/Tohoku-University-Takizawa-Lab/neoSYCL/actions/workflows/ci.yml)

## Installation & testing
A SYCL Implementation for CPU and NEC SX-Aurora TSUBASA (SX-AT)

SYCL is a template library, so no real installation is required.
## Requirements

For CPU computation, the runtime library is implemented with pure C++ STL, does not rely on any third-party libraries.
- CMake 3.10 or higher
- A C++ compiler supporting C++17
- Clang and LLVM 12 or higher (including development headers and shared
libraries, required if using the CPU or VE device)
- Python 3 (required if using the CPU or VE device)
- NEC Software Development Kit for Vector Engine (required if using the VE device)

To build examples, use following commands:
We regularly test on Rocky Linux 8 and Ubuntu 20.04 on our GitHub Actions
pipeline. Use the following commands to install all required dependencies
(except the VE SDK) on these distributions:

`cmake ${CMAKE_FILE_DIR}`
- Rocky Linux 8: `dnf install -y git gcc gcc-c++ cmake make clang-devel llvm-devel python3`
- Ubuntu 20.04: `apt install -y git gcc g++ cmake make pkg-config clang-12 libclang-12-dev llvm-12-dev python3`

## Configuration and Installation

## Enable NEC SX-Aurora TSUBASA (SX-AT) support
```
mkdir build && cd build
cmake ..
make
sudo make install
```

@TODO Current SX-AURORA new version is under development, please check branch backup.
neoSYCL supports three types of devices:

We also need a `sycl-kernel-generator` to generate kernel codes, which is a module of neoSYCL project.
- Host: Kernels are executed on the host. This device is always available.
- CPU: Kernels are compiled to a shared library and executed
on the host CPU. To use this device, add the `-DBUILD_KERNEL_OUTLINER=ON`
option when invoking CMake.
- VE: Kernels are compiled to a shared library and executed
on the Vector Engine using Vector Engine Offloading. To use this device, add
the `-DBUILD_KERNEL_OUTLINER=ON` and `-DBUILD_VE=ON` options when invoking
CMake.

To enable SX-Aurora support, use following commands:
If Clang, LLVM or VEOS are installed to non-standard locations, their paths
should be given via the options `-DCLang_DIR=`, `-DLLVM_DIR=` and `-DVEO_DIR=`
options, respectively.

`cmake -DBUILD_VE=ON -DClang_DIR=${LLVM_PROJECT_BUILD_DIR}/lib/cmake/clang -DLLVM_DIR=${LLVM_PROJECT_BUILD_DIR}/lib/cmake/llvm -DBUILD_KERNEL_GENERATOR=ON ${CMAKE_FILE_DIR}`
## Usage

When using the CPU or VE device, the SYCL source file needs to be compiled
using the `nsc++` compiler wrapper. The target device can be specified using
the `--device` option. Accepted values are ` cpu` or `ve`.

## Citing

If you use neoSYCL in your work, please cite the following paper:

Yinan Ke, Mulya Agung, Hiroyuki Takizawa, "neoSYCL: a SYCL implementation for
SX-Aurora TSUBASA," The International Conference on High Performance Computing
in Asia-Pacific Region (HPC Asia 2021), pp. 50-57, Jan. 2021.
50 changes: 0 additions & 50 deletions cmake/ExtProjectUtils.cmake

This file was deleted.

5 changes: 0 additions & 5 deletions examples/CMakeLists.txt

This file was deleted.

22 changes: 0 additions & 22 deletions examples/bfs/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit 32ee42f

Please sign in to comment.