Thrust Error

Hi All.

I am using GCC 4.5.4 with CUDA 4.1

I am getting this error:

terminate called after throwing an instance of 'thrust::system::system_error'

  what():  synchronize: launch_closure_by_value: unspecified launch failure

This is my code

// .cu file

#include "ActivationFunctionTanh.hpp"

#include <cuda.h>

#include <cuda_runtime.h>

#include <thrust/device_ptr.h>

#include <thrust/transform.h>

struct tanh_func {


  double operator() (double x) {

    return tanh(x);



void ActivationFunctionTanh::f_cuda(double* x, size_t size) {

  try {

  thrust::device_ptr<double> ptr(x);

thrust::transform(ptr, ptr + size, ptr, tanh_func());

  } catch(thrust::system_error e) {

    std::cerr << e.what() << std::endl;


// .cpp file which contains C++0x code if it matters

    ActivationFunction::f_cuda(m_outputs_cuda, m_outputs_size_cuda);

m_outputs_cuda was allocated with cudaMallocPitch and with size m_outputs_size_cuda * sizeof(double)

unspecified launch failure usually means page-fault at the GPU