Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Compilation error when using TBB with CUDA

it_d_balajigmail_com
361 Views
Hi,

I am trying to use CUDA with TBB on VS 2008, Vista. I got a compilation error saying "__alignof__" is undefined. I wrote a small sample program to reproduce the error. The following code gives an error when I compile it with nvcc. For some reasons, after the compilation by cudafe++, the __alignof operator inside the template function gets converted to __alignof__ and I am getting an error since __alignof__ is not defined. This problem doesn't happen if I don't use a template b'coz the __alignof operator gets evaluated before it reaches cudafe++. Has anyone else faced this problem or have a solution for it? (I tried to go through all possible header files to find where __alignof would be defined as __alignof__. But I could not find any.)

Thanks in advance :)

(PS: I have created a thread in the CUDA forum too. I thought may be someone here could have faced this issue.)

Thanks,
Balaji


#include

class A{
int a;double b;
};


template
void myfunc()
{
printf("\nAlignof: %d\n",__alignof(T));
}


int main()
{
myfunc();
return 0;
}
0 Kudos
3 Replies
jimdempseyatthecove
Honored Contributor III
361 Views


I cannot answer for your specific problem (as I cannot reproduce it) however a related problem occured and was reported elsewhere on this forum which may be the cause for your problem.

What was happening was a problem in the template token parsing.

The solution was to add white space between your tokens.

As to if this fixes your problem you will have to run a simple experiment.

Jim Dempsey

0 Kudos
it_d_balajigmail_com
361 Views
Thanks for your reply. I will try it. (Btw, you cannot reproduce the problem because you tried it in your system and its not happening, right)

Balaji
Quoting - jimdempseyatthecove


I cannot answer for your specific problem (as I cannot reproduce it) however a related problem occured and was reported elsewhere on this forum which may be the cause for your problem.

What was happening was a problem in the template token parsing.

The solution was to add white space between your tokens.

As to if this fixes your problem you will have to run a simple experiment.

Jim Dempsey


0 Kudos
jimdempseyatthecove
Honored Contributor III
361 Views

I haven't tried it
0 Kudos
Reply