--fatbin segfaults

I’d like to use the --fatbin argument to nvcc mentioned in the man page, but doing so always causes nvcc to segfault.

I’m doing:

$ nvcc --ptx incrementArrays.cu

$ nvcc --fatbin incrementArrays.ptx

Segmentation fault

Where incrementArrays.cu is:

// incrementArray.cu

#include <assert.h>

#include <stdio.h>

void incrementArrayOnHost(float *a, int N)

{

  int i;

  for (i=0; i < N; i++) a[i] = a[i]+1.f;

}

__global__ void incrementArrayOnDevice(float *a, int N)

{

  int idx = blockIdx.x*blockDim.x + threadIdx.x;

  if (idx<N) a[idx] = a[idx]+1.f;

}

int main(void)

{

  float *a_h, *b_h;		   // pointers to host memory

  float *a_d;				 // pointer to device memory

  int i, N = 10;

  size_t size = N*sizeof(float);

  // allocate arrays on host

  a_h = (float *)malloc(size);

  b_h = (float *)malloc(size);

  // allocate array on device 

  cudaMalloc((void **) &a_d, size);

  // initialization of host data

  for (i=0; i<N; i++) a_h[i] = (float)i;

  // copy data from host to device

  cudaMemcpy(a_d, a_h, sizeof(float)*N, cudaMemcpyHostToDevice);

  // do calculation on host

  incrementArrayOnHost(a_h, N);

  // do calculation on device:

  // Part 1 of 2. Compute execution configuration

  int blockSize = 4;

  int nBlocks = N/blockSize + (N%blockSize == 0?0:1);

  // Part 2 of 2. Call incrementArrayOnDevice kernel 

  incrementArrayOnDevice <<< nBlocks, blockSize >>> (a_d, N);

  // Retrieve result from device and store in b_h

  cudaMemcpy(b_h, a_d, sizeof(float)*N, cudaMemcpyDeviceToHost);

  // check results

  for (i=0; i<N; i++) assert(a_h[i] == b_h[i]);

  // cleanup

  printf("Success\n");

  free(a_h); free(b_h); cudaFree(a_d); 

  return 0;

}

For reference:

$ nvcc --version

nvcc: NVIDIA ® Cuda compiler driver

Copyright © 2005-2007 NVIDIA Corporation

Built on Wed_Dec__3_18:29:25_PST_2008

Cuda compilation tools, release 2.1, V0.2.1221

$ uname -a

Linux fortitude 2.6.27-9-generic #1 SMP Thu Nov 20 21:57:00 UTC 2008 i686 GNU/Linux

As a sanity check, could someone do me the favor of checking that the segfault also happens on their machine? Also, if this is not the right place for this sort of inquiry, could someone please point me in the right direction?

Thanks!