Problem of initialization of array at declaration (double)

Hello,

I just want to initialize array at declaration TYPE a={1.0,2.0} and it seems to be a problem when TYPE=double.

Just post my sample code below :

[codebox]#include

#include “cuPrintf.cu”

typedef double TYPE;

using namespace std;

global void test_init_array(TYPE *nodes) {

TYPE x11,x21,x31,x12,x22,x32;

x11=nodes[0];

x21=nodes[1];    

x31=nodes[2];

x12=nodes[3];    

x22=nodes[4];

x32=nodes[5]; 

// if xi declared like that then the compute is ok in float or double.

/* TYPE x11=0.0;

TYPE x21=0.5;

TYPE x31=0.25;

TYPE x12=0.0;

TYPE x22=0.0;

TYPE x32=0.25;*/

TYPE S=0.5abs((x21-x11)(x32-x12)-(x31-x11)*(x22-x12));

TYPE Be={(x22-x32)/(2S),0,(x32-x12)/(2S),0,(x12-x22)/(2*S),0,

    0,(x31-x21)/(2*S),0,(x11-x31)/(2*S),0,(x21-x11)/(2*S),

                (x31-x21)/(2*S),(x22-x32)/(2*S),(x11-x31)/(2*S), (x32-x12)/(2*S),(x21-x11)/(2*S),(x12-x22)/(2*S)};

cuPrintf("compute : ");

for (unsigned i=0;i<18;i++) cuPrintf("%0.0f “, Be[i]); cuPrintf(”\n");

cuPrintf(“solution : -2 0 2 0 0 0 0 -2 0 -2 0 4 -2 -2 -2 2 4 0\n”);

}

int main() {

cudaPrintfInit();

TYPE nodes={0.0,0.5,0.25,0,0,0.25};

TYPE *nodes_d;

cudaError_t error = cudaMalloc((void**)&nodes_d,sizeof(nodes)); if (error != cudaSuccess) cout << cudaGetErrorString( error) << endl;

error = cudaMemcpy(nodes_d,nodes,sizeof(nodes),cudaMemcpyHostToDevic

e);if (error != cudaSuccess) cout << cudaGetErrorString( error) << endl;

test_init_array<<<1,1>>>(nodes_d);

error = cudaGetLastError(); if (error != cudaSuccess) cout << cudaGetErrorString( error) << endl;

cudaPrintfDisplay(stdout, false);

cudaPrintfEnd();

}

[/codebox]

With float type, the result in Be is OK but in double, the result is false…

Is it normal ? Is it a bug ? What s wrong in my syntax ?

I compiled with “/usr/local/cuda/bin/nvcc -arch=sm_13 test_init_array.cu -o test_init_array” command.

Nvcc is Cuda compilation tools, release 2.3, V0.2.1221

EDIT : Nvcc 3.0, V0.2.1221 same problem…

Work on T1060, linux debian 64, four quad xeon…

Alain