I am fairly new to Cuda C, and I have a problem exporting a large 2D array in Cuda C using ofstream
. The code works fine, but the performance is not really what I expected. Is there any other faster method other than fstream
? I've tried using ostringstream
but it doesn't really show any improvements.
HANDLE_ERROR( cudaMemcpy( sseismo, seismo,sizeof(float)*(DIMX*samp),cudaMemcpyDeviceToHost ) );
sprintf(nmfile, "seismo%ix%itau%08ivz.txt",4000,4000,1 );
std::ofstream outseis(nmfile); // output, normal file
for (int jj=0; jj<4000; jj++)
{
for (int ii=0; ii<4000; ii++)
{
int ij=(DIMX)*jj + ii;
outseis<<sseismo[ij]<<" ";
}
outseis<<"\n";
}
outseis.close();