This is an archive of the discontinued LLVM Phabricator instance.

[test-suite] Added CMake files for external CUDA tests.
ClosedPublic

Authored by tra on Apr 22 2016, 2:15 PM.

Details

Summary

Creates test executables and RUN-only test scripts for all combinations of:

  • CUDA version: all versions found in externals/cuda
  • C++ dialect: C++98,C++11
  • C++ library: libc++, libstdc++ (for all gcc versions found in externals/cuda)

Supported tests:

  • simple CUDA executables (included)
  • thrust tests (enabled if if thrust sources are found in externals/cuda)

Diff Detail

Event Timeline

tra updated this revision to Diff 54723.Apr 22 2016, 2:15 PM
tra retitled this revision from to [test-suite] Added CMake files for external CUDA tests..
tra updated this object.
tra added reviewers: MatzeB, jmolloy.
tra added a subscriber: llvm-commits.
MatzeB accepted this revision.Apr 22 2016, 3:59 PM
MatzeB edited edge metadata.

This should not affect users without users without cuda stuff installed so this LGTM.

I don't have any experience from the cuda side and do not plan to use this. So consider the rest as a suggestion I got while glancing over the code (but feel free to do whatever you want in the cuda parts).

External/CUDA/CMakeLists.txt
83–88

It's unusual to do stuff like setting CPPFLAGS in a function rather than toplevel. At least in the sense that it is inconsistent with the style in the rest of the test-suite.

114

if(LARGE_PROBLEM_SIZE) is probably enough.

132–159

This looks like magic to discover the host system. Maybe this would better fit in some global configuration variables combines with cmake/cache files for typical configurations? Esp. the hardcoding of the libstdc++ paths looks out of place here...

175–189

ditto.

202–222

ditto.

External/CUDA/README
4–6

Note that as a convenience you can even do without this flag: If you checkout your externals in test-suite/test-suite-externals it will get picked up automatically at cmake time.

This revision is now accepted and ready to land.Apr 22 2016, 3:59 PM
tra added inline comments.Apr 22 2016, 5:04 PM
External/CUDA/CMakeLists.txt
83–88

Part of the problem is that cmake wants to have one configuration for *everything* while I want to build multiple variants of the same test without creating separate build directory for each, configure things there, etc. because I'd need *a lot* of them. My current test set involves 12 build variants. Once CUDA-8 is out, it 's likely to become 24.

Also, within each build variant I need to build more than one application, each of them potentially requiring its own set of compiler flags. Hence I create thrust app inside a function which gives each application its own set of flags within build variant.

Granted, I may be forcing CMake to do something it was not intended for. I'm new to CMake, so if you have suggestions how to do it better, I'd appreciate your input.

I guess I could move thrust into its own variant iteration loop and set compiler flags that are identical for all variants outside of the loop. It would not do much to change the fact that I'll have large number of targets that each needs its own set of compiler options and libraries to link with.

114

Fixed.

132–159

Not quite. I need to test with different libc++ variants provided in the externals directory. In order to do that I need to provide explicit path to libstdc++ shared library so executable is linked with appropriate -Wl,rpath and picks correct shared library when it's executed. Otherwise I end up loading whatever libstdc++ is installed on host or failing to run because it's not found.

Again, it's probably something I can move out of per-variant loop, but at the moment I can't think of a way to do just let CMake magically pick it only for specific subset of targets I'm creating.

175–189

Similar story here. Per CUDA version installed I need to link with specific cuda runtime library and provide specific include paths. Can't set it globally for everyone. I can move it out of the per-variant loop and do it once, though.

202–222

I need to find *specific* libc++/libstdc++ library to link with. CMake's standard "find me something" facilities are not flexible enough for what I need here.

External/CUDA/README
4–6

Good to know. I'll add this info.

tra updated this revision to Diff 57265.May 13 2016, 3:57 PM
tra edited edge metadata.

I've moved as much as I could from inner loop to outer ones.
Switched most of helper functions to macros as it makes it easier to update state variables in current scope.
Instead of creating variant build targets in separate function's scope,
pass custom options as parameters to llvm_multisource() (see D20221)

tra updated this revision to Diff 69613.Aug 29 2016, 2:05 PM

Updated cmake scripts to use D20842.

Use llvm_test_executable(), retrieve target name it creates, and customize the way we compile/link it using standard cmake functions.

This revision was automatically updated to reflect the committed changes.