How to compile a cuda program with TNtuple included using nvcc

Hi all
I’m trying to compile a cuda program with ROOT class included using nvcc, What would be the best way to do it. I tried to provide the path using “-I$ROOTSYS/include” option but can not make it. For example, to compile the following simple code:

#include <iostream>
#include "TNtuple.h"
int main()
{
    std::cout<<"Hello"<<std::endl;
}
-->nvcc mm.cu -o oo `root-config --ldflags --cflags --glibs`

The error:

   nvcc fatal   : Unknown option 'pthread'

Thanks

1 Like

Hi,
The compilation flags generated by root-config --cflags are for the compiler used to build ROOT; they are not suited to be passed to some “random other compiler” :slight_smile:

So please check the output of root-config --cflags and adjust it to whatever is applicable for nvcc.

Cheers, Axel.

1 Like

I did the following and it runs but still shows warning messages. Would it be a concern?

--> nvcc -std=c++11 -m64 -I/home/root/include mm.cu -o mm  -L/home/root/lib -lGui -lCore -lImt -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lROOTVecOps -lTree -lTreePlayer -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lMultiProc -lROOTDataFrame -lm -ldl 

The warning message is:

"/home/root/include/TStorage.h:131:37: warning: declaration of ‘static void TStorage::UpdateIsOnHeap(const volatile UInt_t&, volatile UInt_t&)’ with attribute noinline follows inline declaration  [-Wattributes]
 R__NEVER_INLINE void TStorage::UpdateIsOnHeap(volatile const UInt_t &uniqueID, volatile UInt_t &bits) {
                                     ^~~~~~~~
/home/root/include/TStorage.h:91:20: note: previous declaration of ‘static void TStorage::UpdateIsOnHeap(const volatile UInt_t&, volatile UInt_t&)’ was here
    static void UpdateIsOnHeap(volatile const UInt_t &uniqueID, volatile UInt_t &bits);"
1 Like

That looks like a compiler bug to me? I don’t think we need to worry about that, though.

1 Like

cool. Thanks for the help

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.