blob: 0bff8b4494972939cb595c524ec90fd6510fa346 [file] [log] [blame]
CUDA Tests
==========
Cuda tests are enabled if cmake is invoked with
-DTEST_SUITE_EXTERNALS_DIR=<externals path> and specified externals
directory contains at least one CUDA installation.
Expected externals directory structure:
Externals/
cuda/
cuda-X.Y/ -- One or more CUDA installation.
gcc-X.Y.Z/ -- One or more GCC installation for libstdc++.
export EXTERNALS=/your/externals/path
export CUDA_EXTERNALS=$EXTERNALS/cuda # Note: not $EXTERNALS!
export CLANG_DIR=/your/clang/build/dir
export TEST_SUITE_DIR=/path/to/test-suite-sources
* Externals installation
For each cuda version:
$ bash cuda-linux64-rel-XXXXXX.run --toolkit --toolkitpath=$CUDA_EXTERNALS/cuda-Y.Z --silent
To install libstdc++:
# Clone GCC, doesn't need to live inside of $CUDA_EXTERNALS.
$ git clone git://gcc.gnu.org/git/gcc.git
$ cd gcc
# Repeat starting from here for each version of libstdc++ you want.
$ git checkout gcc-6_2_0 # or whatever version
$ mkdir objdir
$ cd objdir
$ ../configure --enable-languages=c,c++ --disable-libsanitizer
$ make bootstrap
$ make DESTDIR=$CUDA_EXTERNALS/gcc-X.Y.Z install
$ cd ..
# Nuke the objdir before building a different gcc version.
$ rm -rf objdir
Fetch thrust:
$ git clone https://github.com/thrust/thrust.git $CUDA_EXTERNALS/thrust
* Configure, build and run tests
Note that if externals are checked out into <test-suite>/test-suite-externals
there's no need to specify location explicitly with -DTEST_SUITE_EXTERNALS_DIR=
$ mkdir test-suite-build-dir
$ cd test-suite-build-dir
$ PATH=$CLANG_DIR/bin:$PATH CXX=clang++ CC=clang \
cmake -G Ninja -DTEST_SUITE_EXTERNALS_DIR=$EXTERNALS $TEST_SUITE_DIR
$ ninja cuda-tests-all
$ lit -j1 External/CUDA
When you run cmake, it should say "Found CUDA prerequisites $CUDA_EXTERNALS",
followed by "Found cuda X.Y" and "Found GCC X.Y.Z" for each version you've
installed.
There's a cuda-tests-simple target that excludes tests that take a long time
to build (Thrust), and cuda-tests-thrust builds only Thrust.
There are also top-level targets that build only one particular variant of the
tests:
cuda-tests-<variant_suffix>
where <variant_suffix> is <cuda-version>-<c++ std>-<libc++|libstdc++-version>
Similarly individual test variants can be built using the same convention:
<test_name>-<variant suffix>
E.g: thrust-cuda-7.5-c++98-libstdc++-4.9.3 OR axpy-cuda-7.0-c++11-libc++
`ninja help | grep cuda` will show all the targets, for your copy/pasting
pleasure.