Skip to content

fix linking with -lcudart, should also include -lrt#882

Merged
boegel merged 1 commit intoeasybuilders:developfrom
boegel:cudart
Apr 1, 2014
Merged

fix linking with -lcudart, should also include -lrt#882
boegel merged 1 commit intoeasybuilders:developfrom
boegel:cudart

Conversation

@boegel
Copy link
Member

@boegel boegel commented Mar 14, 2014

@pescobar: this should fix the problem of building gzip with a goolfc toolchain

@ajdecon: does this make sense to you, i.e. is -lrt requires when linking with -lcudart, even for non-CUDA apps like gzip?

@boegel
Copy link
Member Author

boegel commented Mar 14, 2014

confirmed on my end that this fixes the problem

I would like to hear from @ajdecon why this is required though...

@ajdecon
Copy link
Contributor

ajdecon commented Mar 15, 2014

My impression was that this shouldn't be required, but my information might be wrong. Following up internally at NVIDIA to make sure I understand this. :)

@boegel
Copy link
Member Author

boegel commented Mar 19, 2014

@ajdecon: any updates?
Also note that it's (apparently) important that -lrt is listed before -lcudart, so it seems like libcudart is redefining some symbols and thus throwing off builds?

For future reference: these are the error message you run into when building gzip with a goolfc toolchain, without using -lrt before -lcudart:

gcc -std=gnu11   -O2 -march=native -Wl,--as-needed ... lib/libgzip.a  -lm -lcudart -lpthread
lib/libgzip.a(gettime.o): In function `gettime':
gettime.c:(.text+0xe): undefined reference to `clock_gettime'
collect2: error: ld returned 1 exit status

@ajdecon
Copy link
Contributor

ajdecon commented Mar 20, 2014

Still waiting on feedback from another engineer at NVIDIA. Sorry for the delays, we're all a little crazy right now due to our conference GTC next week. :)

I do suggest you check to see if a CUDA app such as Gromacs still builds correctly with this fix in place. If there are symbol conflicts between libcudart and librt, then I'd be concerned that this fix for non-CUDA builds might break CUDA apps.

@boegel boegel added this to the v1.12 milestone Mar 28, 2014
@boegel
Copy link
Member Author

boegel commented Apr 1, 2014

I've tested a GROMACS build with the goolfc toolchain, adding -lrt before -lcudart doesn't break anything, so I'm merging this in.

Thanks @ajdecon for the responses!

boegel added a commit that referenced this pull request Apr 1, 2014
fix linking with -lcudart, should also include -lrt
@boegel boegel merged commit fe16f9b into easybuilders:develop Apr 1, 2014
@boegel boegel deleted the cudart branch April 1, 2014 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants