-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from yungyuc/feature/nsd
Feature/nsd
- Loading branch information
Showing
212 changed files
with
23,036 additions
and
27 deletions.
There are no files selected for viewing
This file contains 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,197 @@ | ||
name: nsd | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**/nsd**' | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
env: | ||
CPPROOT: nsd/03cpp/code | ||
MATRIXROOT: nsd/04matrix/code | ||
CACHEROOT: nsd/05cache/code | ||
SIMDROOT: nsd/06simd/code | ||
MEMROOT: nsd/07mem/code | ||
SMARTROOT: nsd/08smart/code | ||
MODERNCPPROOT: nsd/09moderncpp/code | ||
ARRAYDESIGNROOT: nsd/11arraydesign/code | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-20.04, macos-10.15] | ||
|
||
fail-fast: false | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v1 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: apt (ubuntu) | ||
if: startsWith(matrix.os, 'ubuntu') | ||
run: | | ||
sudo apt-get -q update | ||
sudo apt-get -qy install \ | ||
curl build-essential make cmake libc6-dev \ | ||
gcc g++ clang clang-tidy \ | ||
gfortran intel-mkl-full \ | ||
python3 python3-pip python3-pytest \ | ||
python3-numpy python3-scipy python3-pandas | ||
- name: brew (macos) | ||
if: startsWith(matrix.os, 'macos') | ||
run: | | ||
brew install make cmake llvm libomp python3 radare2 | ||
- name: pip (ubuntu) | ||
if: startsWith(matrix.os, 'ubuntu') | ||
run: | | ||
sudo pip3 install -U flake8 | ||
sudo pip3 install -U https://github.com/aldanor/ipybind/tarball/master | ||
- name: pip (macos) | ||
if: startsWith(matrix.os, 'macos') | ||
run: | | ||
pip3 install -U pip | ||
pip3 install -U setuptools | ||
pip3 install -U pytest numpy scipy pandas | ||
pip3 install -U flake8 | ||
pip3 install -U https://github.com/aldanor/ipybind/tarball/master | ||
- name: INSTALL_PREFIX (ubuntu) | ||
if: startsWith(matrix.os, 'ubuntu') | ||
run: | | ||
echo "INSTALL_PREFIX=/usr" >> ${GITHUB_ENV} | ||
- name: INSTALL_PREFIX (macos) | ||
if: startsWith(matrix.os, 'macos') | ||
run: | | ||
echo "INSTALL_PREFIX=/usr/local" >> ${GITHUB_ENV} | ||
- name: custom | ||
run: | | ||
INSTALL_PREFIX=${{ env.INSTALL_PREFIX }} | ||
echo "INSTALL_PREFIX=${INSTALL_PREFIX}" | ||
#nsd/contrib/install.sh radare2 # skip to save time, for now | ||
nsd/contrib/install.sh pybind11 | ||
nsd/contrib/install.sh xtl | ||
nsd/contrib/install.sh xsimd | ||
nsd/contrib/install.sh xtensor | ||
nsd/contrib/install.sh xtensor_blas | ||
nsd/contrib/install.sh xtensor_python | ||
- name: show dependency | ||
run: | | ||
echo "radare2 path: $(which radare2)" | ||
echo "radare2 version: $(radare2 -v)" | ||
echo "gcc path: $(which gcc)" | ||
echo "gcc version: $(gcc --version)" | ||
echo "cmake path: $(which cmake)" | ||
echo "cmake version: $(cmake --version)" | ||
echo "python3 path: $(which python3)" | ||
echo "python3 version: $(python3 --version)" | ||
python3 -c 'import numpy ; print("numpy.__version__:", numpy.__version__)' | ||
echo "pytest path: $(which pytest)" | ||
echo "pytest version: $(pytest --version)" | ||
echo "clang-tidy path: $(which clang-tidy)" | ||
echo "clang-tidy version: $(clang-tidy -version)" | ||
echo "flake8 path: $(which flake8)" | ||
echo "flake8 version: $(flake8 --version)" | ||
- name: 03cpp | ||
run: | | ||
make -C ${{ env.CPPROOT }} clean | ||
make -C ${{ env.CPPROOT }} runall | ||
- name: 04matrix_pod | ||
run: | | ||
make -C ${{ env.MATRIXROOT }} clean | ||
make -C ${{ env.MATRIXROOT }} runpod | ||
- name: 04matrix_ma | ||
run: | | ||
make -C ${{ env.MATRIXROOT }} clean | ||
make -C ${{ env.MATRIXROOT }} runma | ||
- name: 04matrix_la | ||
# macos does not have MKL. | ||
if: startsWith(matrix.os, 'ubuntu') | ||
run: | | ||
make -C ${{ env.MATRIXROOT }} clean | ||
make -C ${{ env.MATRIXROOT }} runla | ||
- name: 05cache_skip_access | ||
run: | | ||
make -C ${{ env.CACHEROOT }} clean | ||
make -C ${{ env.CACHEROOT }} run_01_skip_access | ||
- name: 05cache_locality | ||
run: | | ||
make -C ${{ env.CACHEROOT }} clean | ||
make -C ${{ env.CACHEROOT }} run_02_locality | ||
- name: 05cache_matrix_matrix | ||
# macos does not have MKL. | ||
if: startsWith(matrix.os, 'ubuntu') | ||
run: | | ||
make -C ${{ env.CACHEROOT }} clean | ||
make -C ${{ env.CACHEROOT }} run_03_matrix_matrix | ||
- name: 06simd_mul | ||
run: | | ||
make -C ${{ env.SIMDROOT }} hardware | ||
make -C ${{ env.SIMDROOT }} clean | ||
make -C ${{ env.SIMDROOT }}/01_mul run | ||
#make -C ${{ env.SIMDROOT }}/02_fma run # server not supporting FMA | ||
- name: 06simd_mul_r2 | ||
# ubuntu does not have a working r2. | ||
if: startsWith(matrix.os, 'macos') | ||
run: | | ||
make -C ${{ env.SIMDROOT }}/01_mul r2all | ||
- name: 06simd_omp | ||
run: | | ||
make -C ${{ env.SIMDROOT }}/03_omp | ||
make -C ${{ env.SIMDROOT }}/03_omp run | ||
[ "$(env OMP_NUM_THREADS=5 make -C ${{ env.SIMDROOT }}/03_omp run | grep 'Hello from thread' | wc -l | xargs)" = "5" ] | ||
- name: 07mem | ||
run: | | ||
make -C ${{ env.MEMROOT }} clean | ||
make -C ${{ env.MEMROOT }} runall | ||
- name: 08smart_pointer | ||
run: | | ||
make -C ${{ env.SMARTROOT }}/01_pointer clean | ||
make -C ${{ env.SMARTROOT }}/01_pointer runall | ||
- name: 08smart_shared | ||
run: | | ||
make -C ${{ env.SMARTROOT }}/02_shared clean | ||
make -C ${{ env.SMARTROOT }}/02_shared runall | ||
- name: 09moderncpp | ||
run: | | ||
make -C ${{ env.MODERNCPPROOT }}/03_elision clean | ||
make -C ${{ env.MODERNCPPROOT }}/03_elision runall | ||
make -C ${{ env.MODERNCPPROOT }}/04_template clean | ||
make -C ${{ env.MODERNCPPROOT }}/04_template runall | ||
make -C ${{ env.MODERNCPPROOT }}/05_lambda clean | ||
make -C ${{ env.MODERNCPPROOT }}/05_lambda runall | ||
- name: 11arraydesign_solve_cpp | ||
run: | | ||
make -C ${{ env.ARRAYDESIGNROOT }} solve_cpp.so | ||
- name: 11arraydesign_data_prep | ||
# macos does not have MKL. | ||
if: startsWith(matrix.os, 'ubuntu') | ||
run: | | ||
make -C ${{ env.ARRAYDESIGNROOT }} data_prep.so |
This file contains 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 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 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,4 @@ | ||
nsd/ | ||
repo1/ | ||
gtest/ | ||
line*.log |
This file contains 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,7 @@ | ||
.PHONY: default | ||
default: | ||
@echo "do nothing" | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf repo1/ nsd/ gtest/ *.log |
This file contains 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,8 @@ | ||
#!/bin/bash | ||
runcmd () { | ||
echo "run command: ${@:2}" | ||
{ time "${@:2}" ; } > $1 2>&1 | ||
echo "done; log file: $(cd "$(dirname $1)" && pwd)/$1" | ||
} | ||
runcmd line1.log echo "first command" | ||
runcmd line2.log echo "second command" |
This file contains 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,2 @@ | ||
build/ | ||
*.so |
This file contains 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,11 @@ | ||
cmake_minimum_required(VERSION 3.9) | ||
project(vector) | ||
|
||
find_package(pybind11 REQUIRED) | ||
|
||
pybind11_add_module( | ||
_vector | ||
vector.cpp | ||
) | ||
|
||
install(TARGETS _vector DESTINATION .) |
This file contains 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,30 @@ | ||
#include <pybind11/pybind11.h> | ||
|
||
#include <cmath> | ||
#include <tuple> | ||
|
||
std::tuple<double, double> rotate( | ||
std::tuple<double, double> const & vec | ||
, double rad | ||
) | ||
{ | ||
|
||
const double cth = cos(rad); | ||
const double sth = sin(rad); | ||
|
||
return std::tuple<double, double>( | ||
std::get<0>(vec) * cth - std::get<1>(vec) * sth | ||
, std::get<0>(vec) * sth + std::get<1>(vec) * cth); | ||
|
||
} | ||
|
||
PYBIND11_MODULE(_vector, mod) | ||
{ | ||
|
||
mod.doc() = "example C extension module"; | ||
|
||
mod.def("rotate", &rotate, "vector rotation"); | ||
|
||
} | ||
|
||
/* vim: set et ts=4 sw=4: */ |
This file contains 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,3 @@ | ||
#!/bin/bash | ||
export MYENVVAR="MYENVVAR is set to what I want" | ||
echo "do something" |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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,2 @@ | ||
hello | ||
*.o |
This file contains 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,12 @@ | ||
CXX = g++ | ||
|
||
hello: hello.o hellomain.o | ||
$(CXX) hello.o hellomain.o -o hello | ||
|
||
hello.o: hello.cpp hello.hpp | ||
$(CXX) -c hello.cpp -o hello.o | ||
|
||
hellomain.o: hellomain.cpp hello.hpp | ||
$(CXX) -c hellomain.cpp -o hellomain.o | ||
|
||
# vim: set noet nobomb fenc=utf8 ff=unix: |
This file contains 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,7 @@ | ||
#include <iostream> | ||
#include "hello.hpp" | ||
void hello() | ||
{ | ||
std::cout << "hello with standalone compiling unit" << std::endl; | ||
} | ||
// vim: set sw=4 ts=4 sts=4 et: |
This file contains 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,3 @@ | ||
#pragma once | ||
void hello(); | ||
// vim: set sw=4 ts=4 sts=4 et: |
This file contains 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,7 @@ | ||
#include "hello.hpp" | ||
int main(int argc, char ** argv) | ||
{ | ||
hello(); | ||
return 0; | ||
} | ||
// vim: set sw=4 ts=4 sts=4 et: |
This file contains 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,2 @@ | ||
hello | ||
*.o |
This file contains 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,12 @@ | ||
CXX = g++ | ||
|
||
hello: hello.o hellomain.o | ||
$(CXX) $^ -o $@ | ||
|
||
hello.o: hello.cpp hello.hpp | ||
$(CXX) -c $< -o $@ | ||
|
||
hellomain.o: hellomain.cpp hello.hpp | ||
$(CXX) -c $< -o $@ | ||
|
||
# vim: set noet nobomb fenc=utf8 ff=unix: |
This file contains 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,7 @@ | ||
#include <iostream> | ||
#include "hello.hpp" | ||
void hello() | ||
{ | ||
std::cout << "hello with standalone compiling unit" << std::endl; | ||
} | ||
// vim: set sw=4 ts=4 sts=4 et: |
This file contains 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,3 @@ | ||
#pragma once | ||
void hello(); | ||
// vim: set sw=4 ts=4 sts=4 et: |
This file contains 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,6 @@ | ||
#include "hello.hpp" | ||
int main(int argc, char ** argv) | ||
{ | ||
hello(); | ||
} | ||
// vim: set sw=4 ts=4 sts=4 et: |
This file contains 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,2 @@ | ||
hello | ||
*.o |
This file contains 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,9 @@ | ||
CXX = g++ | ||
|
||
hello: hello.o hellomain.o | ||
$(CXX) $^ -o $@ | ||
|
||
%.o: %.cpp hello.hpp | ||
$(CXX) -c $< -o $@ | ||
|
||
# vim: set noet nobomb fenc=utf8 ff=unix: |
This file contains 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,7 @@ | ||
#include <iostream> | ||
#include "hello.hpp" | ||
void hello() | ||
{ | ||
std::cout << "hello with standalone compiling unit" << std::endl; | ||
} | ||
// vim: set sw=4 ts=4 sts=4 et: |
This file contains 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,3 @@ | ||
#pragma once | ||
void hello(); | ||
// vim: set sw=4 ts=4 sts=4 et: |
Oops, something went wrong.