Cuda 如何投射推力::设备_向量<;int>;使用原始指针运行 \uuuuu全局\uuuuuu无效超(int-tFast、int-tFastLenth、int-kilo、int-lenPrzvFast、double-eps、int-AF、double*arrprighfast、int-arrPrzvFncFst、int-dv\uptr) { 对于(int j=0;j

Cuda 如何投射推力::设备_向量<;int>;使用原始指针运行 \uuuuu全局\uuuuuu无效超(int-tFast、int-tFastLenth、int-kilo、int-lenPrzvFast、double-eps、int-AF、double*arrprighfast、int-arrPrzvFncFst、int-dv\uptr) { 对于(int j=0;j,cuda,gpu,thrust,raw-pointer,Cuda,Gpu,Thrust,Raw Pointer,您的内核函数HYPER没有定义的devvecPrzvFncFst61440Slow149998参数,因此当您尝试在此处使用它时: __global__ void HYPER (int tFast, int tFastLenth, int kilo, int lenPrzvFast, double eps, int AF,double *arrINTLighFast, int *arrPrzvFncFst, int dv_ptr) { for(int j = 0;j<(tF

您的内核函数
HYPER
没有定义的
devvecPrzvFncFst61440Slow149998
参数,因此当您尝试在此处使用它时:

 __global__ void HYPER (int tFast, int tFastLenth, int kilo, int lenPrzvFast, double eps, int AF,double *arrINTLighFast, int *arrPrzvFncFst, int dv_ptr) 
     {
  for(int j = 0;j<(tFast*tFastLenth);j++)
      {  arrINTLighFast[j]=0;
      } 
          for(int j = 0;j<(kilo);j++) arrPrzvFncFst[j]=0;
   for(int j = 1;j<(tFast*tFastLenth);j++)
       { arrINTLighFast[j]=  arrINTLighFast[j-1] + AF*exp(-j/(eps+tFast) ); }

   for(int j = 0;j<(tFast*tFastLenth-1);j++)
         {
            for(int i=(arrINTLighFast[j]);i< (arrINTLighFast[j+1]);i++)
                {arrPrzvFncFst[i]=j;}
         }
   for(int j = 0;j<lenPrzvFast;j++)
        { devvecPrzvFncFst61440Slow149998[j]= arrPrzvFncFst[j] ;}
 }


int main (void)
{
const int tFast = 9;
const int tFastLenth = 6;
double arrINTLighFast[tFast*tFastLenth];
int arrPrzvFncFst[61500];
int AF = 1000;
int kilo = 1024;
int kilo150 = 149998;
const double   eps=0.0000001;
const int lenPrzvFast=61500;

    thrust::host_vector<int> vecPrzvFncFst61440Slow149998;
    int Len_vecPrzv=( lenPrzvFast+kilo150);       
    for (int j=0;j<Len_vecPrzv;j++)   vecPrzvFncFst61440Slow149998.push_back(0);
    for (int j=0;j<Len_vecPrzv;j++)     vecPrzvFncFst61440Slow149998 [j] = 0;
    thrust::device_vector<int> devvecPrzvFncFst61440Slow149998 = vecPrzvFncFst61440Slow149998;

    int *dv_ptr = thrust::raw_pointer_cast(devvecPrzvFncFst61440Slow149998.data());

    HYPER <<<blocks, threads>>>(tFast, tFastLenth, kilo, lenPrzvFast, eps, AF, arrINTLighFast, arrPrzvFncFst, dv_ptr);

   thrust::host_vector<int> HostvecPrzvFncFst61440Slow149998 = devvecPrzvFncFst61440Slow149998;
    std::cout << "Device vector is: " << std::endl;
    for(int j = 0; j<vecPrzvFncFst61440Slow149998.size(); j++) 
            std::cout << "vecPrzvFncFst61440Slow149998[" << j << "] = " << HostvecPrzvFncFst61440Slow149998[j] << std::endl;
 return 0;
 }
但您正试图在内核参数位置传递它:

int *dv_ptr = thrust::raw_pointer_cast(devvecPrzvFncFst61440Slow149998.data());
以下代码修复了这些问题,并为我进行了干净的编译:

__global__ void HYPER (..., int dv_ptr) 
                            ^^^^^^^^^^
#包括
#包括
#定义块1
#定义线程1
__全局无效超(int-tFast、int-tFast-lenth、int-kilo、int-lenPrzvFast、double-eps、int-AF、double*arrillighfast、int*arrPrzvFncFst、int*dv\ptr)
{

对于(int j=0;j您的内核函数
HYPER
没有定义的
devvecPrzvFncFst61440Slow149998
参数,因此当您尝试在此处使用它时:

 __global__ void HYPER (int tFast, int tFastLenth, int kilo, int lenPrzvFast, double eps, int AF,double *arrINTLighFast, int *arrPrzvFncFst, int dv_ptr) 
     {
  for(int j = 0;j<(tFast*tFastLenth);j++)
      {  arrINTLighFast[j]=0;
      } 
          for(int j = 0;j<(kilo);j++) arrPrzvFncFst[j]=0;
   for(int j = 1;j<(tFast*tFastLenth);j++)
       { arrINTLighFast[j]=  arrINTLighFast[j-1] + AF*exp(-j/(eps+tFast) ); }

   for(int j = 0;j<(tFast*tFastLenth-1);j++)
         {
            for(int i=(arrINTLighFast[j]);i< (arrINTLighFast[j+1]);i++)
                {arrPrzvFncFst[i]=j;}
         }
   for(int j = 0;j<lenPrzvFast;j++)
        { devvecPrzvFncFst61440Slow149998[j]= arrPrzvFncFst[j] ;}
 }


int main (void)
{
const int tFast = 9;
const int tFastLenth = 6;
double arrINTLighFast[tFast*tFastLenth];
int arrPrzvFncFst[61500];
int AF = 1000;
int kilo = 1024;
int kilo150 = 149998;
const double   eps=0.0000001;
const int lenPrzvFast=61500;

    thrust::host_vector<int> vecPrzvFncFst61440Slow149998;
    int Len_vecPrzv=( lenPrzvFast+kilo150);       
    for (int j=0;j<Len_vecPrzv;j++)   vecPrzvFncFst61440Slow149998.push_back(0);
    for (int j=0;j<Len_vecPrzv;j++)     vecPrzvFncFst61440Slow149998 [j] = 0;
    thrust::device_vector<int> devvecPrzvFncFst61440Slow149998 = vecPrzvFncFst61440Slow149998;

    int *dv_ptr = thrust::raw_pointer_cast(devvecPrzvFncFst61440Slow149998.data());

    HYPER <<<blocks, threads>>>(tFast, tFastLenth, kilo, lenPrzvFast, eps, AF, arrINTLighFast, arrPrzvFncFst, dv_ptr);

   thrust::host_vector<int> HostvecPrzvFncFst61440Slow149998 = devvecPrzvFncFst61440Slow149998;
    std::cout << "Device vector is: " << std::endl;
    for(int j = 0; j<vecPrzvFncFst61440Slow149998.size(); j++) 
            std::cout << "vecPrzvFncFst61440Slow149998[" << j << "] = " << HostvecPrzvFncFst61440Slow149998[j] << std::endl;
 return 0;
 }
但您正试图在内核参数位置传递它:

int *dv_ptr = thrust::raw_pointer_cast(devvecPrzvFncFst61440Slow149998.data());
以下代码修复了这些问题,并为我进行了干净的编译:

__global__ void HYPER (..., int dv_ptr) 
                            ^^^^^^^^^^
#包括
#包括
#定义块1
#定义线程1
__全局无效超(int-tFast、int-tFast-lenth、int-kilo、int-lenPrzvFast、double-eps、int-AF、double*arrillighfast、int*arrPrzvFncFst、int*dv\ptr)
{

对于(int j=0;j您的内核函数
HYPER
没有定义的
devvecPrzvFncFst61440Slow149998
参数,因此当您尝试在此处使用它时:

 __global__ void HYPER (int tFast, int tFastLenth, int kilo, int lenPrzvFast, double eps, int AF,double *arrINTLighFast, int *arrPrzvFncFst, int dv_ptr) 
     {
  for(int j = 0;j<(tFast*tFastLenth);j++)
      {  arrINTLighFast[j]=0;
      } 
          for(int j = 0;j<(kilo);j++) arrPrzvFncFst[j]=0;
   for(int j = 1;j<(tFast*tFastLenth);j++)
       { arrINTLighFast[j]=  arrINTLighFast[j-1] + AF*exp(-j/(eps+tFast) ); }

   for(int j = 0;j<(tFast*tFastLenth-1);j++)
         {
            for(int i=(arrINTLighFast[j]);i< (arrINTLighFast[j+1]);i++)
                {arrPrzvFncFst[i]=j;}
         }
   for(int j = 0;j<lenPrzvFast;j++)
        { devvecPrzvFncFst61440Slow149998[j]= arrPrzvFncFst[j] ;}
 }


int main (void)
{
const int tFast = 9;
const int tFastLenth = 6;
double arrINTLighFast[tFast*tFastLenth];
int arrPrzvFncFst[61500];
int AF = 1000;
int kilo = 1024;
int kilo150 = 149998;
const double   eps=0.0000001;
const int lenPrzvFast=61500;

    thrust::host_vector<int> vecPrzvFncFst61440Slow149998;
    int Len_vecPrzv=( lenPrzvFast+kilo150);       
    for (int j=0;j<Len_vecPrzv;j++)   vecPrzvFncFst61440Slow149998.push_back(0);
    for (int j=0;j<Len_vecPrzv;j++)     vecPrzvFncFst61440Slow149998 [j] = 0;
    thrust::device_vector<int> devvecPrzvFncFst61440Slow149998 = vecPrzvFncFst61440Slow149998;

    int *dv_ptr = thrust::raw_pointer_cast(devvecPrzvFncFst61440Slow149998.data());

    HYPER <<<blocks, threads>>>(tFast, tFastLenth, kilo, lenPrzvFast, eps, AF, arrINTLighFast, arrPrzvFncFst, dv_ptr);

   thrust::host_vector<int> HostvecPrzvFncFst61440Slow149998 = devvecPrzvFncFst61440Slow149998;
    std::cout << "Device vector is: " << std::endl;
    for(int j = 0; j<vecPrzvFncFst61440Slow149998.size(); j++) 
            std::cout << "vecPrzvFncFst61440Slow149998[" << j << "] = " << HostvecPrzvFncFst61440Slow149998[j] << std::endl;
 return 0;
 }
但您正试图在内核参数位置传递它:

int *dv_ptr = thrust::raw_pointer_cast(devvecPrzvFncFst61440Slow149998.data());
以下代码修复了这些问题,并为我进行了干净的编译:

__global__ void HYPER (..., int dv_ptr) 
                            ^^^^^^^^^^
#包括
#包括
#定义块1
#定义线程1
__全局无效超(int-tFast、int-tFast-lenth、int-kilo、int-lenPrzvFast、double-eps、int-AF、double*arrillighfast、int*arrPrzvFncFst、int*dv\ptr)
{

对于(int j=0;j您的内核函数
HYPER
没有定义的
devvecPrzvFncFst61440Slow149998
参数,因此当您尝试在此处使用它时:

 __global__ void HYPER (int tFast, int tFastLenth, int kilo, int lenPrzvFast, double eps, int AF,double *arrINTLighFast, int *arrPrzvFncFst, int dv_ptr) 
     {
  for(int j = 0;j<(tFast*tFastLenth);j++)
      {  arrINTLighFast[j]=0;
      } 
          for(int j = 0;j<(kilo);j++) arrPrzvFncFst[j]=0;
   for(int j = 1;j<(tFast*tFastLenth);j++)
       { arrINTLighFast[j]=  arrINTLighFast[j-1] + AF*exp(-j/(eps+tFast) ); }

   for(int j = 0;j<(tFast*tFastLenth-1);j++)
         {
            for(int i=(arrINTLighFast[j]);i< (arrINTLighFast[j+1]);i++)
                {arrPrzvFncFst[i]=j;}
         }
   for(int j = 0;j<lenPrzvFast;j++)
        { devvecPrzvFncFst61440Slow149998[j]= arrPrzvFncFst[j] ;}
 }


int main (void)
{
const int tFast = 9;
const int tFastLenth = 6;
double arrINTLighFast[tFast*tFastLenth];
int arrPrzvFncFst[61500];
int AF = 1000;
int kilo = 1024;
int kilo150 = 149998;
const double   eps=0.0000001;
const int lenPrzvFast=61500;

    thrust::host_vector<int> vecPrzvFncFst61440Slow149998;
    int Len_vecPrzv=( lenPrzvFast+kilo150);       
    for (int j=0;j<Len_vecPrzv;j++)   vecPrzvFncFst61440Slow149998.push_back(0);
    for (int j=0;j<Len_vecPrzv;j++)     vecPrzvFncFst61440Slow149998 [j] = 0;
    thrust::device_vector<int> devvecPrzvFncFst61440Slow149998 = vecPrzvFncFst61440Slow149998;

    int *dv_ptr = thrust::raw_pointer_cast(devvecPrzvFncFst61440Slow149998.data());

    HYPER <<<blocks, threads>>>(tFast, tFastLenth, kilo, lenPrzvFast, eps, AF, arrINTLighFast, arrPrzvFncFst, dv_ptr);

   thrust::host_vector<int> HostvecPrzvFncFst61440Slow149998 = devvecPrzvFncFst61440Slow149998;
    std::cout << "Device vector is: " << std::endl;
    for(int j = 0; j<vecPrzvFncFst61440Slow149998.size(); j++) 
            std::cout << "vecPrzvFncFst61440Slow149998[" << j << "] = " << HostvecPrzvFncFst61440Slow149998[j] << std::endl;
 return 0;
 }
但您正试图在内核参数位置传递它:

int *dv_ptr = thrust::raw_pointer_cast(devvecPrzvFncFst61440Slow149998.data());
以下代码修复了这些问题,并为我进行了干净的编译:

__global__ void HYPER (..., int dv_ptr) 
                            ^^^^^^^^^^
#包括
#包括
#定义块1
#定义线程1
__全局无效超(int-tFast、int-tFast-lenth、int-kilo、int-lenPrzvFast、double-eps、int-AF、double*arrillighfast、int*arrPrzvFncFst、int*dv\ptr)
{
对于(int j=0;j