Skip to content

namespace thrust has no member "device_malloc" #10

@Codeguyross

Description

@Codeguyross

Hello, I am getting the error thrust has no member device_malloc. Any ideas on how to correct this issue?

/home/gFlip3D-Release_271/GDelFlipping/src/gDel3D/GPU/ThrustWrapper.cu(121): error: namespace "thrust" has no member "device_malloc"

/home/gFlip3D-Release_271/GDelFlipping/src/gDel3D/GPU/ThrustWrapper.cu(121): error: type name is not allowed

/home/gFlip3D-Release_271/GDelFlipping/src/gDel3D/GPU/ThrustWrapper.cu(121): error: expression must have class type

/home/gFlip3D-Release_271/GDelFlipping/src/gDel3D/GPU/GPUDecl.h(280): error: namespace "thrust" has no member "device_malloc"

/home/gFlip3D-Release_271/GDelFlipping/src/gDel3D/GPU/GPUDecl.h(280): error: type name is not allowed

I have had this issue in the past but surely there is a better way then having to use out-dated cuda 9 to fix this issue1.9

More details:

I am using thrust version 1.9

Checking thrust version can be done with the following code

#include <thrust/version.h>
#include <iostream>

    int main(void)
    {
      int major = THRUST_MAJOR_VERSION;
      int minor = THRUST_MINOR_VERSION;
    
      std::cout << "Thrust v" << major << "." << minor << std::endl;
    
      return 0;
    }

and compiled with
nvcc version.cu -o version

and run with
./version

I went ahead and added the following line to the two files complaining and that fixed the issue. I am not sure what changed to require direct reference to the library and would appreciate any input as to why this header is now required.

The two files you need to modify with the new reference

/home/gFlip3D-Release_271/GDelFlipping/src/gDel3D/GPU/ThrustWrapper.cu
/home/gFlip3D-Release_271/GDelFlipping/src/gDel3D/GPU/GPUDecl.h

The magical line to add
#include <thrust/device_malloc.h>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions