This is an archive of the discontinued LLVM Phabricator instance.

[libomptarget][cuda] Only run tests when sure there is cuda available
ClosedPublic

Authored by JonChesterfield on Jan 26 2021, 11:52 AM.

Details

Summary

[libomptarget][cuda] Only run tests when sure there is cuda available

Prior to D95155, building the cuda plugin implied cuda was installed locally.
With that change, every machine can build a cuda plugin, but they won't all have
cuda and/or an nvptx card installed locally.

This change enables the nvptx tests when either:

  • libcuda is present
  • the user has forced use of the dlopen stub

The default case when there is no cuda detected will no longer attempt to
run the tests on nvptx hardware, as was the case before D95155.

Diff Detail

Event Timeline

JonChesterfield requested review of this revision.Jan 26 2021, 11:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 26 2021, 11:52 AM
openmp/libomptarget/plugins/cuda/CMakeLists.txt
26

The use of 'option' before actually set LIBOMPTARGET_DLOPEN_LIBCUDA to ON, despite cmake's documentation. This auxiliary variable workaround is copied from other uses of option() in this library.

Also, 'AND' doesn't work in the context of set. set(VAR ${A} AND ${B}) writes the list containing A, AND, B to VAR. That list is then considered 'true' in conditional statements, even when the list is ;FALSE;AND;FALSE;. Therefore set and mutate a variable.

ronlieb accepted this revision.Jan 26 2021, 11:58 AM
This revision is now accepted and ready to land.Jan 26 2021, 11:58 AM