@@ -158,27 +144,29 @@ Index CSR< Real, Device, Index >::getNonZeroRowLength( const IndexType row ) con
if(std::is_same<DeviceType,Devices::Cuda>::value)
{
IndexType*cols=newIndexType[4];
std::cout<<"crash1"<<std::endl;
RealType*vals=newRealType[4];
std::cout<<"crash2"<<std::endl;
for(inti=0;i<4;i++)
{
cols[i]=i;
vals[i]=1.0;
}
std::cout<<"crash3"<<std::endl;
ConstMatrixRowmatrixRow(cols,vals,4,1);// = this->getRow( row ); // If the program even compiles, this line fails because a segfault is thrown on the first line of getRow()
std::cout<<"crash4"<<std::endl;
ConstMatrixRowmatrixRow(cols,vals,4,1);
// ConstMatrixRow matrixRow = this->getRow( row );// If the program even compiles, this line fails because a segfault is thrown on the first line of getRow()
// WHEN debugging with GDB:
// (gdb) p this->rowPointers[0]
// Could not find operator[].
// (gdb) p rowPointers.getElement(0)
// Attempt to take address of value not located in memory.
// PROBLEM: If thee second parameter of getNonZeroRowLengthCudaKernel is '&resultCuda', the following issue is thrown:
// PROBLEM: If the second parameter of getNonZeroRowLengthCudaKernel is '&resultCuda', the following issue is thrown:
// 'error: no instance of function template "TNL::Matrices::getNonZeroRowLengthCudaKernel" matches the argument list'
/*TNL::Matrices::*/getNonZeroRowLengthCudaKernel<ConstMatrixRow,IndexType><<<1,1>>>(matrixRow,resultCuda);// matrixRow works fine, tested them both separately
resultHost=Devices::Cuda::passFromDevice(resultCuda);// This causes a crash: Illegal memory address.
std::cout<<"crash6"<<std::endl;
TNL::Matrices::getNonZeroRowLengthCudaKernel<ConstMatrixRow,IndexType><<<1,1>>>(matrixRow,resultCuda);// matrixRow works fine, tested them both separately
delete[]cols;
delete[]vals;
std::cout<<"Checkpoint BEFORE passFromDevice"<<std::endl;
resultHost=Devices::Cuda::passFromDevice(resultCuda);// This causes a crash: Illegal memory address in Cuda_impl.h at TNL_CHECK_CUDA_DEVICE
std::cout<<"Checkpoint AFTER passFromDevice"<<std::endl;