Thread: Linking to Thrust (cuda) compiled code.

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    269

    Linking to Thrust (cuda) compiled code.

    Hi All. Basically, all I want to do is figure out how to link this thrust code (compiled with nvcc) from a code that uses an MPI c++ compiler. Here is the code:

    thrust/histogram.cu at master * thrust/thrust * GitHub

    Basically, I need to be able to invoke dense_histogram and sparse_histogram.

    This histogram.cu file has to be compiled with the nvcc compiler (nvcc histogram.cu -c)

    This will produce histogram.o

    Then, I'd like to have another file, compiled with an MPI compiler be able to call those functions.

    I'm at a loss on what I need to move into a header file, how to construct the header file, etc.

    Does anyone have any advice? Thanks

  2. #2
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    `nvcc` uses `gcc` under the hood for the linking stage.

    I think all you have to do is use `nvcc` for the actual CUDA compilations to generate the object file and then you can link it normally like you would with gcc.

    Edit: Nvidia also has a CUDA developers forum where you can ask this question as well. They're far more knowledgeable than I am in this instance.
    Last edited by MutantJohn; 10-11-2016 at 01:49 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How this code compiled
    By Username changed in forum C++ Programming
    Replies: 2
    Last Post: 06-14-2014, 07:10 PM
  2. compiled but unrunable code
    By Gu7g34r in forum C Programming
    Replies: 2
    Last Post: 07-03-2012, 12:53 AM
  3. Why not add CUDA forum?
    By JonathanS in forum General Discussions
    Replies: 33
    Last Post: 03-28-2012, 09:38 PM
  4. Replies: 1
    Last Post: 03-12-2008, 12:10 AM
  5. C# Compiled to Machine Code
    By FwyWice in forum C# Programming
    Replies: 1
    Last Post: 12-06-2002, 04:22 AM

Tags for this Thread