Skip to content

Commit 0b38d98

Browse files
committed
Merge branch 'master' of github.com:tensor-compiler/taco into master_array_algebra
2 parents 502aaad + 7cd2f29 commit 0b38d98

Some content is hidden

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

56 files changed

+3532
-494
lines changed

.github/workflows/buildandtest.yml

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78,32 +78,25 @@ jobs:
7878
CTEST_PARALLEL_LEVEL: 2
7979
working-directory: build
8080

81-
build-gpu:
82-
name: build taco for gpu, but does not run tests
83-
runs-on: ubuntu-18.04
81+
build-test-python-macos-clang:
82+
name: builds taco and pytaco on macos with clang and runs all tests
83+
runs-on: macos-10.15
8484

8585
steps:
8686
- uses: actions/checkout@v2
87-
- name: download cuda
88-
run: wget http://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda_10.2.89_440.33.01_linux.run
89-
- name: install cuda
90-
run: sudo sh cuda_10.2.89_440.33.01_linux.run --silent --toolkit --installpath="$GITHUB_WORKSPACE/cuda"
91-
- name: add path
92-
run: echo "$GITHUB_WORKSPACE/cuda/bin" >> $GITHUB_PATH
93-
- name: set ld_library_path
94-
run: echo "LD_LIBRARY_PATH=$GITHUB_WORKSPACE/cuda/lib64" >> $GITHUB_ENV
95-
- name: set library_path
96-
run: echo "LIBRARY_PATH=$GITHUB_WORKSPACE/cuda/lib64" >> $GITHUB_ENV
97-
- name: print environment
98-
run: |
99-
echo ${PATH}
100-
echo ${LD_LIBRARY_PATH}
101-
echo ${LIBRARY_PATH}
87+
- name: install numpy and scipy
88+
run: pip3 install numpy scipy
10289
- name: create_build
10390
run: mkdir build
10491
- name: cmake
105-
run: cmake -DCUDA=ON ..
92+
run: cmake -DCMAKE_BUILD_TYPE=Debug -DPYTHON=ON ..
10693
working-directory: build
10794
- name: make
10895
run: make -j2
10996
working-directory: build
97+
- name: test
98+
run: make test
99+
env:
100+
CTEST_OUTPUT_ON_FAILURE: 1
101+
CTEST_PARALLEL_LEVEL: 2
102+
working-directory: build
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: "CUDA build and test (manual)"
2+
3+
# Note: This workflow is triggered by hand by TACO developers.
4+
# It should be run after the code has been reviewed by humans.
5+
# This review step is important to ensure the safety of the
6+
# self-hosted runner.
7+
8+
on:
9+
workflow_dispatch:
10+
inputs:
11+
CMAKE_BUILD_TYPE:
12+
description: CMAKE_BUILD_TYPE
13+
required: true
14+
default: Debug
15+
OPENMP:
16+
description: OPENMP
17+
required: true
18+
default: 'ON'
19+
PYTHON:
20+
description: PYTHON
21+
required: true
22+
default: 'OFF'
23+
jobs:
24+
ubuntu1604-cuda:
25+
name: tests ubuntu 16.04 with CUDA 9
26+
runs-on: [self-hosted, ubuntu-16.04, cuda]
27+
steps:
28+
- uses: actions/checkout@v2
29+
- name: create_build
30+
run: mkdir build
31+
- name: cmake
32+
run: cmake -DCMAKE_BUILD_TYPE=${{ github.event.inputs.CMAKE_BUILD_TYPE }} -DCUDA=ON -DOPENMP=${{ github.event.inputs.OPENMP }} -DPYTHON=${{ github.event.inputs.PYTHON }} ..
33+
working-directory: build
34+
- name: make
35+
run: make -j8
36+
working-directory: build
37+
- name: test
38+
run: make test
39+
env:
40+
CTEST_OUTPUT_ON_FAILURE: 1
41+
CTEST_PARALLEL_LEVEL: 8
42+
working-directory: build

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "python_bindings/pybind11"]
22
path = python_bindings/pybind11
33
url = https://github.com/pybind/pybind11
4+
[submodule "test/bats"]
5+
path = test/bats
6+
url = https://github.com/bats-core/bats-core

CMakeLists.txt

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
1-
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.4.0 FATAL_ERROR)
2+
if(POLICY CMP0048)
3+
cmake_policy(SET CMP0048 NEW)
4+
endif()
25
if(POLICY CMP0054)
36
cmake_policy(SET CMP0054 NEW)
47
endif()
5-
project(taco)
8+
project(taco
9+
VERSION 0.1
10+
LANGUAGES C CXX
11+
)
612
option(CUDA "Build for NVIDIA GPU (CUDA must be preinstalled)" OFF)
713
option(PYTHON "Build TACO for python environment" OFF)
814
option(OPENMP "Build with OpenMP execution support" OFF)
915
option(COVERAGE "Build with code coverage analysis" OFF)
16+
set(TACO_FEATURE_CUDA 0)
17+
set(TACO_FEATURE_OPENMP 0)
18+
set(TACO_FEATURE_PYTHON 0)
1019
if(CUDA)
1120
message("-- Searching for CUDA Installation")
1221
find_package(CUDA REQUIRED)
1322
add_definitions(-DCUDA_BUILT)
23+
set(TACO_FEATURE_CUDA 1)
1424
endif(CUDA)
1525
if(OPENMP)
1626
message("-- Will use OpenMP for parallel execution")
1727
add_definitions(-DUSE_OPENMP)
28+
set(TACO_FEATURE_OPENMP 1)
1829
endif(OPENMP)
1930

2031
if(PYTHON)
2132
message("-- Will build Python extension")
2233
add_definitions(-DPYTHON)
34+
set(TACO_FEATURE_PYTHON 1)
2335
endif(PYTHON)
2436

2537
SET(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo")
@@ -101,7 +113,7 @@ include_directories(${TACO_INCLUDE_DIR})
101113

102114
set(TACO_LIBRARY_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
103115

104-
install(DIRECTORY ${TACO_INCLUDE_DIR}/ DESTINATION include)
116+
install(DIRECTORY ${TACO_INCLUDE_DIR}/ DESTINATION include FILES_MATCHING PATTERN "*.h")
105117

106118
add_subdirectory(src)
107119
add_subdirectory(test)
@@ -122,6 +134,20 @@ if(GIT_FOUND AND EXISTS "${TACO_PROJECT_DIR}/.git")
122134
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
123135
endif()
124136
endif()
137+
# get git revision
138+
execute_process(
139+
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
140+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
141+
RESULT_VARIABLE GIT_REVPARSE_RESULT
142+
OUTPUT_VARIABLE TACO_GIT_SHORTHASH
143+
OUTPUT_STRIP_TRAILING_WHITESPACE
144+
)
145+
if(NOT GIT_REVPARSE_RESULT EQUAL "0")
146+
message(NOTICE "'git rev-parse --short HEAD' failed with ${GIT_REVPARSE_RESULT}, git version info will be unavailable.")
147+
set(TACO_GIT_SHORTHASH "")
148+
endif()
149+
else()
150+
set(TACO_GIT_SHORTHASH "")
125151
endif()
126152

127153
if(NOT EXISTS "${TACO_PROJECT_DIR}/python_bindings/pybind11/CMakeLists.txt")
@@ -156,3 +182,7 @@ if(COVERAGE)
156182
endif(PYTHON)
157183
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES coverage)
158184
endif(COVERAGE)
185+
186+
string(TIMESTAMP TACO_BUILD_DATE "%Y-%m-%d")
187+
configure_file("include/taco/version.h.in" "include/taco/version.h" @ONLY)
188+
install(FILES "${CMAKE_BINARY_DIR}/include/taco/version.h" DESTINATION "include/taco")

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,18 @@ TL;DR build taco using CMake. Run `make test`.
2929
# Build and test
3030
![Build and Test](https://github.com/RSenApps/taco/workflows/Build%20and%20Test/badge.svg?branch=master)
3131

32-
Build taco using CMake 2.8.12 or greater:
32+
Build taco using CMake 3.4.0 or greater:
3333

3434
cd <taco-directory>
3535
mkdir build
3636
cd build
3737
cmake -DCMAKE_BUILD_TYPE=Release ..
3838
make -j8
3939

40+
Building taco requires `gcc` 5.0 or newer, or `clang` 3.9 or newer. You can
41+
use a specific compiler or version by setting the `CC` and `CXX` environment
42+
variables before running `cmake`.
43+
4044
## Building Python API
4145
To build taco with the Python API (pytaco), add `-DPYTHON=ON` to the cmake line above. For example:
4246

@@ -46,13 +50,20 @@ You will then need to add the pytaco module to PYTHONPATH:
4650

4751
export PYTHONPATH=<taco-directory>/build/lib:$PYTHONPATH
4852

49-
pytaco requires NumPy and SciPy to be installed.
53+
This requires Python 3.x and some development libraries. It also requires
54+
NumPy and SciPy to be installed. For Debian/Ubuntu, the following packages
55+
are needed: `python3 libpython3-dev python3-distutils python3-numpy python3-scipy`.
5056

5157
## Building for OpenMP
5258
To build taco with support for parallel execution (using OpenMP), add `-DOPENMP=ON` to the cmake line above. For example:
5359

5460
cmake -DCMAKE_BUILD_TYPE=Release -DOPENMP=ON ..
5561

62+
If you are building with the `clang` compiler, you may need to ensure that
63+
the `libomp` development headers are installed. For Debian/Ubuntu, this is
64+
provided by `libomp-dev`, One of the more specific versions like
65+
`libomp-13-dev` may also work.
66+
5667
## Building for CUDA
5768
To build taco for NVIDIA CUDA, add `-DCUDA=ON` to the cmake line above. For example:
5869

@@ -66,6 +77,8 @@ Please also make sure that you have CUDA installed properly and that the followi
6677

6778
If you do not have CUDA installed, you can still use the taco cli to generate CUDA code with the -cuda flag.
6879

80+
The generated CUDA code will require compute capability 6.1 or higher to run.
81+
6982
## Running tests
7083
To run all tests:
7184

apps/tensor_times_vector/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
cmake_minimum_required(VERSION 2.8.12)
2+
if(POLICY CMP0048)
3+
cmake_policy(SET CMP0048 NEW)
4+
endif()
25
project(tensor_times_vector)
36

47
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

ci/test-pr.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# CUDA testing
2+
3+
The script, `test-pr.py`, is a quick and easy way to run CUDA tests on a PR.
4+
5+
This should be done after code review, see [issue #457](https://github.com/tensor-compiler/taco/issues/457) for a discussion of the overall process.
6+
7+
## System requirements
8+
9+
You will need write access to the `tensor-compiler/taco` github repo, and access to run actions.
10+
11+
You will need to have the command line `git` and `gh` tools installed, configured, and talking to github.
12+
13+
`git` needs to be set up with SSH authentication or HTTPS authentication to push to the `tensor-compiler/taco` github repo without a password prompt. If you don't have that, please see [ssh setup in the github docs](https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh) or [seting up an HTTPS token](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token).
14+
15+
`gh` is a command-line interface to the github REST API. If you don't have `gh`, please see [their installation guide](https://github.com/cli/cli#installation).
16+
17+
`gh` needs to be set up to hit REST API endpoints without a password prompt. If you don't have that, the [gh auth login](https://cli.github.com/manual/gh_auth_login) command should help.
18+
19+
The script requires python version 3.x, and a few basic python modules that should be installed by default (like subprocess and tempfile).
20+
21+
## What it does
22+
23+
This script does the following:
24+
25+
* creates a temporary test branch for a PR
26+
* pushes that test branch to the taco github repo
27+
* kicks off the cuda test (with the default parameters) to run on that test branch
28+
* waits for the test to complete
29+
* removes the temporary test branch
30+
31+
The script will give you a link to the test run on the github website, so you can watch and inspect the results.
32+
33+
## Using it
34+
35+
`python3 test-pr.md [--protocol=(ssh|https)] <PRNUMBER> [<TRYNUMBER>]`
36+
37+
`PRNUMBER` is the PR you want to test, without the `#` prefix.
38+
39+
If specified, `TRYNUMBER` becomes a suffix for the temporary test branch, so you can have multiple test branches going at once. That can be omitted unless it is needed.
40+
41+
## what it looks like
42+
43+
This output comes from my own fork of taco as I was testing the script:
44+
45+
```
46+
% python3 test-pr.py 3
47+
48+
=== looking up ID and params of test action
49+
50+
=== creating test branch test-pr3
51+
remote:
52+
remote: Create a pull request for 'test-pr3' on GitHub by visiting:
53+
remote: https://github.com/Infinoid/taco/pull/new/test-pr3
54+
remote:
55+
56+
=== triggering test action
57+
✓ Created workflow_dispatch event for cuda-test-manual.yml at test-pr3
58+
59+
To see runs for this workflow, try: gh run list --workflow=cuda-test-manual.yml
60+
Test action is at: https://github.com/Infinoid/taco/actions/runs/882846018?check_suite_focus=true
61+
62+
=== waiting for action to complete
63+
64+
Refreshing run status every 3 seconds. Press Ctrl+C to quit.
65+
66+
X test-pr3 CUDA build and test (manual) · 882846018
67+
Triggered via workflow_dispatch about 11 minutes ago
68+
69+
JOBS
70+
X tests CUDA in 10m54s (ID 2686889157)
71+
✓ Set up job
72+
✓ Run actions/checkout@v2
73+
✓ create_build
74+
✓ cmake
75+
✓ make
76+
X test
77+
✓ Post Run actions/checkout@v2
78+
✓ Complete job
79+
80+
ANNOTATIONS
81+
X Process completed with exit code 2.
82+
tests CUDA: .github#1
83+
84+
85+
X Run CUDA build and test (manual) (882846018) completed with 'failure'
86+
Test results are at: https://github.com/Infinoid/taco/actions/runs/882846018?check_suite_focus=true
87+
88+
=== cleaning up test branch test-pr3
89+
90+
=== cleaning up temp dir
91+
92+
```
93+
94+
# Troubleshooting
95+
96+
## no access to taco repo, no access to run actions in taco repo
97+
98+
If you are a taco developer, ask Fred for access.
99+
100+
## test workflow does not exist
101+
102+
If you see output that looks like this:
103+
104+
```
105+
=== triggering test action
106+
could not create workflow dispatch event: HTTP 422: Workflow does not have 'workflow_dispatch' trigger (https://api.github.com/repos/tensor-compiler/taco/actions/workflows/someIDnumber/dispatches)
107+
```
108+
109+
This means the test branch does not have the cuda test workflow file. In other words, the file `.github/workflows/cuda-test-manual.yml` does not exist yet in the version of taco that the PR is based on.
110+
111+
To fix this, rebase or merge the PR to the current taco master branch, and then rerun the test.
112+
113+
## other stuff
114+
115+
If you have some other problem with it, at me on github (@infinoid) or email me for help figuring it out.

0 commit comments

Comments
 (0)