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

Compilation of .cu (CUDA) files fail when linking against AWS SDK #1353

Closed
2 tasks done
lablabla opened this issue Mar 31, 2020 · 4 comments
Closed
2 tasks done

Compilation of .cu (CUDA) files fail when linking against AWS SDK #1353

lablabla opened this issue Mar 31, 2020 · 4 comments
Assignees
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made. needs-reproduction This issue needs reproduction.

Comments

@lablabla
Copy link

lablabla commented Mar 31, 2020

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug
Compiling a project that uses both AWS sdk and CUDA causes compilation error nvcc fatal : Unknown option 'pthread'

SDK version number
1.7.111
CUDA version 10.0.130
CMake 3.14

Platform/OS/Hardware/Device
What are you running the sdk on?
Ubuntu 16.04

To Reproduce (observed behavior)
Steps to reproduce the behavior (please share code)

CMakeLists.txt
----------------
cmake_minimum_required (VERSION 3.12)
enable_language(CUDA)

find_package(AWSSDK REQUIRED COMPONENTS s3)


add_executable(exec main.cpp cuda.cu)

target_link_libraries(exec
        ${AWSSDK_LINK_LIBRARIES})
main.cpp
-----------
#include <iostream>

int main()
{
    std::cout << "Hello, World!" << std::endl;
    return 0;
}

cuda.cu is empty

Expected behavior
Compilation should succeed

Logs/output

Scanning dependencies of target exec
[ 25%] Building CXX object CMakeFiles/exec.dir/main.cpp.o
[ 50%] Building CUDA object CMakeFiles/exec.dir/cuda.cu.o
nvcc fatal   : Unknown option 'pthread'
CMakeFiles/exec.dir/build.make:75: recipe for target 'CMakeFiles/exec.dir/cuda.cu.o' failed
make[3]: *** [CMakeFiles/exec.dir/cuda.cu.o] Error 1

Additional context
After digging around we saw that linking ${AWSSDK_LINK_LIBRARIES} adds -pthread to the CUDA_FLAGS

@lablabla lablabla added the needs-triage This issue or PR still needs to be triaged. label Mar 31, 2020
@lablabla
Copy link
Author

lablabla commented Apr 1, 2020

This seems to maybe be a cmake issue.
If I change the enable_language(CUDA) to the old find_package(CUDA), it works fine

closing

@lablabla lablabla closed this as completed Apr 1, 2020
@lablabla
Copy link
Author

lablabla commented Apr 6, 2020

Well,
After checking it more with CMake (here) looks like the problem might come from AWS after all
Checked with CMake 3.14 & 3.17

cmake_minimum_required (VERSION 3.12)
enable_language(CUDA) 

#find_package(AWSSDK REQUIRED COMPONENTS s3)

set (THREADS_PREFER_PTHREAD_FLAG ON)
find_package (Threads REQUIRED)

add_executable(exec main.cpp cuda.cu)

target_link_libraries(exec
        ${AWSSDK_LINK_LIBRARIES}
        ${CMAKE_THREAD_LIBS_INIT})

Enabling the find_package(AWSSDK) line will cause the -pthread flag to be added to the CUDA flags. finding pthread the normal way won't affect the CUDA flags

@lablabla lablabla reopened this Apr 6, 2020
@KaibaLopez KaibaLopez added the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Apr 10, 2020
@KaibaLopez KaibaLopez self-assigned this Apr 10, 2020
@KaibaLopez KaibaLopez removed the needs-triage This issue or PR still needs to be triaged. label Apr 10, 2020
@KaibaLopez
Copy link
Contributor

Hi @lablabla ,
Sorry for the wait, I was finally able to get around to test this, but it is not showing me the error you're talking about.
I have both a simple cuda sample from their even easier introduccion and a simple s3 upload object sample working on the same project compiling with no problems.

I used your same CMakeLists.txt too and was not able to reproduce your error.
My setup is a bit different than yours though:

cmake version 1.13 (shouldn't matter as you tested previous and newer versions)
Cuda compilation tools, release 10.0, V10.0.130
SDK Version: 1.7.314
Ubuntu 18.04
gcc 7.4

Not sure, but could you try upgrading the sdk to the newer versions see if by some off chance we inadvertently fixed this?

@KaibaLopez KaibaLopez added needs-reproduction This issue needs reproduction. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 2 days. closing-soon This issue will automatically close in 4 days unless further comments are made. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 2 days. labels Apr 10, 2020
@justinpa-asg
Copy link

justinpa-asg commented Apr 20, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made. needs-reproduction This issue needs reproduction.
Projects
None yet
Development

No branches or pull requests

3 participants