mercredi 6 juillet 2016

Namespace thrust::random conflicts with custom namespace with CUDA backend

I use random generators from thrust library in my own functions and classes, located in [custom] random namespace. Of course, I use fully qualified names like:

namespace random {

// ... 

strust generator {
    __host__ __device__        
    float operator()(int n) {
        // ...
        thrust::random::uniform_real_distribution<float> u01(a, b);
        // ...
    }
};

} // end random

Then I use functions and classes from my random namespace in other functions located in different namespaces using fully qualified names as well.

Everything is fine if compile this code with OMP backend (by setting THRUST_DEVICE_SYSTEM = THRUST_DEVICE_SYSTEM_OMP). But when I try to compile it with CUDA backend it leads to a lot of errors. Some of them say that "class random::MyClass is not a member of thrust::random namespace" so I thought that maybe it is a bug in thrust (I've tried 1.8.0 and 1.8.1).

I've found a solution - rename my random to rnd, but maybe there is another way?

Thanks.




Aucun commentaire:

Enregistrer un commentaire