pgcpp error

I used pgcpp in the complier PGI Workstation13.10 64-bit target on x86-64 windows and compiled
the code as follow.


// example1.cpp : Defines the entry point for the console application.

#include <stdio.h>

// Kernel that executes on the CUDA device
__global__ void square_array(float *a, int N)
  int idx = blockIdx.x + blockDim.x + threadIdx.x;
  if (idx<N)
    a[idx] = a[idx]*a[idx];

// main routine that executes on the host
int main(void)
  float *a_h, *a_d;  // Pointer to host & device arrays
  const int N = 10;  // Number of elements in arrays
  size_t size = N * sizeof(float);
  a_h = (float *)malloc(size);        // Allocate array on host
  cudaMalloc((void **) &a_d, size);   // Allocate array on device

  // Initialize host array and copy it to CUDA device
  for (int i=0; i<N; i++) a_h[i] = (float)i;
  printf("copying to device\n");
  cudaMemcpy(a_d, a_h, size, cudaMemcpyHostToDevice);

  // Do calculation on device:
  int block_size = 4;
  int n_blocks = N/block_size + (N%block_size == 0 ? 0:1);
  printf("launching kernel <<<%d,%d>>>\n", n_blocks, block_size);
  square_array <<< n_blocks, block_size >>> (a_d, N);

  // Retrieve result from device and store it in host array
  printf( "retrieving data\n");
  cudaMemcpy(a_h, a_d, sizeof(float)*N, cudaMemcpyDeviceToHost);

  // Print results
  for (int i=0; i<N; i++) printf("%d %f\n", i, a_h[i]);

  // Cleanup
  free(a_h); cudaFree(a_d); 

Compile the program
pgcpp -Mcudax86

error message is showing as follow:

“D:\PROGRA~1\PGI/win32/2013/cuda/5.0/include/cuda_runtime_api.h”,line 3762:error:
unknown attribute “host
extern host cudaError_t CUDARTAPI cudaMemcpyToArrayAsync(cudaArray_t dst,
size_t wOffset, size_t hOffset,
const void *src, size_t count,
enum cudaMemcpyKind kind,
cudaStream_t stream __dv(0));
how do i fix that?

Unfortunately, pgcpp cuda x86 is not supported in windows in the current release. Currently, it is supported for linux and Osx,

hi,Deb Caruso
Thanks for your reply.
But,the quote
"Q Which operating systems does PGI support with its CUDA-x86 compilers?
A Linux, Windows and OS X. "
from the PGI website FAQ And I also used the latest release,the error message is similar.

Hi Hongyao.xu,

With apologies, the web page is in error. Windows should not be listed. I’ll have it corrected.

Best Regards,

hi, Mat
thanks for your reply.