I'm new to CUDA and I was trying a sample program using cudaMemcpyToSymbol, but its giving me cudaErrorUnknown. Below is the sample program Im trying.
At the last line, its printing "The output of cudaMemcpyToSymbol() is: cudaErrorUnknown".
#include <iostream>
#include<cuda_runtime.h>
#include<string>
using namespace std;
int main()
{
void *ptr0,*ptr1;
string out;
char str[100]="Hi, I am Ellesemere. What is ur name?";
char output[100];
out=cudaGetErrorString(cudaSetDevice(0));
cout<<"The value of cudaSetDevice() is: "<<out<<endl;
out=cudaGetErrorString(cudaMalloc(&ptr0,100));
cout<<"The output of cudaMalloc() is: "<<out<<endl;
out=cudaGetErrorString(cudaMemcpyToSymbol(ptr0,str,100,0,cudaMemcpyHostToDevice));
cout<<"The output of cudaMemcpyToSymbol() is: "<<out<<endl;
}
I m expecting cudaSuccess as the output of cudaMemcpyToSymbol instead of cudaErrorUnknown. Can anyone please help me what might be going wrong.