ltd
February 17, 2009, 11:39am
1
I’ve encounterd a very interesting problem. When i compile such code
template<typename Type>
Type* cudaHostNew(typename Type::InitStruct& data)
{avoided
Type* result = NULL;
cudaMalloc((void**)&devPtr,100);
}
cudafe always throws an error
(33): internal error: assertion failed: gen_expr: bad expr node kind (D:/Bld/rel/gpgpu/toolkit/r2.1/compiler/edg/EDG_3.9/src/cp_gen_be.c, line 9510)
Any idea about thisstrange behaviour? Could it be avoided? Is it a bug or only my incompetence? :unsure:
Sarnath
February 17, 2009, 12:00pm
2
I’ve encounterd a very interesting problem. When i compile such code
template<typename Type>
Type* cudaHostNew(typename Type::InitStruct& data)
{avoided
Type* result = NULL;
cudaMalloc((void**)&devPtr,100);
}
cudafe always throws an error
(33): internal error: assertion failed: gen_expr: bad expr node kind (D:/Bld/rel/gpgpu/toolkit/r2.1/compiler/edg/EDG_3.9/src/cp_gen_be.c, line 9510)
Any idea about thisstrange behaviour? Could it be avoided? Is it a bug or only my incompetence? :unsure:
cudafe is known to be fragile especially when mixing C++ code with it. But CUDA 2.1 must be stable (coz templates are officially supported only in 2.1)
btw,
What is that “avoided” doing in your code? Is that a deliberate mistake that you have introduced?
ltd
February 18, 2009, 7:22am
3
I know, it seemed to me that i use cuda 2.1.
Simply nothing, just wrong copy+paste.
Sarnath
February 18, 2009, 7:29am
4
template<typename Type>
Type* cudaHostNew(typename Type::InitStruct& data)
{
Type* result = NULL;
cudaMalloc((void**)&devPtr,100);
}
You dont require “typename” in the arg list for “cudaHostNew” function.
Also I am not sure “type::InitStruct&” would work.
You better declare “Type” as “class Type” instead of “typename Type” – though am not very sure about it