Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Makefile CUDA_VERSION extraction on OSX Yosemite #4146

Merged
merged 1 commit into from
May 17, 2016

Conversation

yalesong
Copy link

The current way of extracting CUDA_VERSION causes problem on OSX Yosemite

$ make
awk: syntax error at source line 1
 context is
    {exit  >>>  < <<<  7.0;}
awk: illegal statement at source line 1

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.10.5
BuildVersion:   14F27

$ uname -prs
Darwin 14.5.0 i386

Looks like the change suggested in #4075 wasn't helpful in my case: grep after the second pipe doesn't work as expected:

$ echo "nvcc: ... release 7.5, V7.5.19" | grep -o 'release [0-9.]*'
release 7.5
$ echo "nvcc: ... release 7.5, V7.5.19" | grep -o 'release [0-9.]*' | grep -o '[0-9.]*'

The following did work for me:

$ echo "nvcc: ... release 7.5, V7.5.19" | grep -o 'release [0-9.]*' | grep -o '[0-9].*'
7.5
$ echo "nvcc: ... release 7.5, V7.5.19" | grep -o 'release [0-9.]*' | tr -d '[a-z ]'
7.5
$ echo "nvcc: ... release 7.5, V7.5.19" | grep -o 'release [0-9.]*' | sed 's/[a-z ]//g'
7.5

@longjon
Copy link
Contributor

longjon commented May 17, 2016

Ah, the perils of regular expressions. I think what's happening here is that [0-9.]* matches the empty string at the beginning instead of the desired digits (note that grep -c does report a match). I don't know why the behavior is different with GNU grep.

I'll accept this patch; it would be a little nicer if the latter part of the pipeline did not depend on the former, but this works.

Thanks!

@longjon longjon merged commit 0acb8db into BVLC:master May 17, 2016
fxbit pushed a commit to Yodigram/caffe that referenced this pull request Sep 1, 2016
Fix Makefile CUDA_VERSION extraction on OSX Yosemite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants