Conversation
lukeyeager
left a comment
There was a problem hiding this comment.
Working for me!
#145 is a sufficient solution for me (I've been using it for months), but this is obviously much more complete. Hopefully the tests will be enough to get this approved for merge!
|
/cc @colesbury |
|
We are now using this patch in tesla autopilot firmware builds. Previously, we could not use |
jrosdahl
left a comment
There was a problem hiding this comment.
Looks promising. Thanks for including lots of tests!
However, I have trouble applying the commits to current master, mainly due to the spaces→tabs changes in test.sh in the first commit. Could you please squash the commits into one that only contains the actual changes you propose?
.travis/install_cuda.sh
Outdated
| @@ -0,0 +1,29 @@ | |||
| #!/bin/bash | |||
There was a problem hiding this comment.
Since the file only is meant to be sourced: remove the shebang and make it non-executable?
ccache.c
Outdated
| // Alternate form of -o with no space. | ||
| if (str_startswith(argv[i], "-o")) { | ||
| // Alternate form of -o with no space. Ignore nvcc -odir. | ||
| if (str_startswith(argv[i], "-o") && !str_eq(argv[i], "-odir")) { |
There was a problem hiding this comment.
So
ccache gcc dir.c -odir
will no longer work, right? That's not acceptable. Perhaps you can detect that nvcc is being used and only then ignore -odir?
There was a problem hiding this comment.
Fixed it and added a test for it. Actually, the option -optf caused the same problem, so I fixed that as well. Since nvcc can't handle the -o option without space, that part is not ignored if nvcc was detected.
ccache.c
Outdated
| goto out; | ||
| } | ||
|
|
||
| if (!conf->run_second_cpp && str_eq(actual_language,"cuda")) { |
There was a problem hiding this comment.
Please add a space after the comma.
|
|
||
| expect_different_files() { | ||
| if [ ! -e "$1" ]; then | ||
| test_failed "compare_files: $1 missing" |
There was a problem hiding this comment.
Please don't use tabs in shell scripts.
There was a problem hiding this comment.
There were no tabs in it. Perhaps from the first commit? I've squashed everything and rebased it on master.
There was a problem hiding this comment.
(There were lots of space→tab indent changes in the first commit which then were changed back in a subsequent commit.)
fc4c457 to
d58c324
Compare
|
The following changes were made:
|
|
Thanks for the updates! Looks mostly good. Some questions and comments:
|
d58c324 to
5bc80ef
Compare
|
Update: I've rebased on master and modified the test.sh script to incorporate your points 1 and 2. nvcc is painfully slow when compiling cuda code. I've modified to use the c++ mode wherever I can to gain speed. However, a few tests must remain using cuda code because that is what we need to test at least once. Currently, travis is unable to complete the tests because of an error in the pch test suite. I've checked that the same error occurs on the last commit on master, so it wasn't introduced by my latest modifications in the nvcc test suite. Regarding the last point, I've tested with a travis configuration to ensure supporting 7.5 using the official nvidia repos - that worked. I'll assume you installed the canonical package (because 7.5 is not provided for 16.04 by NVidia). I'll try to reproduce the error with the canonical package, I'll assume the directories used in the failed test are not available. In the updated test.sh I've added a check to ensure the directories used in the test exist. |
5bc80ef to
ab3c026
Compare
Feature: Added cuda compiler in separate travis job and implemented
tests for nvcc.
Feature: Added support for nvcc compiler options --compiler-bindir/-ccbin,
--output-directory/-odir and --libdevice-directory/-ldir.
Added tests for these options in test.sh.
Bugfix: Original patch had a statement to avoid using the preprocessed
input files for nvcc when run_second_cpp is false. Otherwise,
when a build is necessary and the preprocessed output was used,
nvcc results with a compiler error. The patch simply ensures
run_second_cpp is always set to true for the cuda compiler.
Bugfix: The -optf and -odir options are only accepted for nvcc. For other
compilers, they behave like '-o ptf' resp. '-o dir'.
A test was added to check this behaviour.
ab3c026 to
b8d2f48
Compare
|
Update: |
OK, thanks. For reference, the "different GPU architectures" test takes ≈10s on my system, which is slightly more than how much time the entire existing test suite takes... The full test suite takes ≈9s without nvcc tests and ≈47s with nvcc tests for me.
Yes, fixed in 958c4c2.
Now all tests work if I disable my masquerading gcc, but with my default setup, the "option --libdevice-directory" test fails. But I was able to fix it like this: |
|
Merged with the mentioned fix and some cleanups. Thanks! |
|
Any ideas on how to speed up the tests are of course still welcome. |
This pull request contains two bugfixes:
run_second_cppis set to false, ccache falls back to the behaviour ofrun_second_cpp=truefor the cuda compiler.--compiler-bindir/-cdir,--output-directory/-odirand--libdevice-directory/-ldirare now handled by ccache. This should fix Support nvcc (CUDA) -ccbin/--compiler-bindir option #144 .In addition, tests for nvcc were added by adding two more travis jobs and extending the
test.shscript.