File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -88,11 +88,8 @@ template <typename T> class DeviceVector {
8888 // / @param size Initial size of the host vector (defaults to 0)
8989 // / @post Host vector is created with 'size' default-constructed elements
9090 // / @post Device pointer is nullptr (no GPU memory allocated)
91- explicit DeviceVector (size_t size = 0 ) : hostData_(size)
91+ explicit DeviceVector (size_t size = 0 ) : hostData_(size), devicePtr_( nullptr )
9292 {
93- #if defined(__CUDACC__)
94- devicePtr_ = nullptr ;
95- #endif
9693 }
9794
9895 ~DeviceVector () = default ;
@@ -449,7 +446,9 @@ template <typename T> class DeviceVector {
449446private:
450447 std::vector<T> hostData_; // Host-side vector
451448
452- #if defined(__CUDACC__)
449+ // Introducing compilation guards (__CUDACC__) for the device pointer
450+ // causes a runtime error during GPU simulations.
451+ // This is likely because DeviceVector is included in both
452+ // host (.cpp) and device (_d.cpp) code, and compiled on both sides.
453453 T *devicePtr_; // Device pointer
454- #endif
455- };
454+ };
You can’t perform that action at this time.
0 commit comments