Commit c9d296c7 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Removed old nvcc workarounds

parent bc5dd706
Loading
Loading
Loading
Loading
+3 −42
Original line number Diff line number Diff line
@@ -302,20 +302,7 @@ Reduction< Devices::Cuda >::reduce( const Index begin, const Index end, Fetch&&

   if( can_reduce_later_on_host ) {
      // transfer the reduced data from device to host
      std::unique_ptr< Result[] > resultArray{
// Workaround for nvcc 10.1.168 - it would modify the simple expression
// `new Result[reducedSize]` in the source code to `new (Result[reducedSize])`
// which is not correct - see e.g. https://stackoverflow.com/a/39671946
// Thus, the host compiler would spit out hundreds of warnings...
// Funnily enough, nvcc's behaviour depends on the context rather than the
// expression, because exactly the same simple expression in different places
// does not produce warnings.
#ifdef __NVCC__
         new Result[ static_cast< const int& >( reducedSize ) ]
#else
         new Result[ reducedSize ]
#endif
      };
      std::unique_ptr< Result[] > resultArray{ new Result[ reducedSize ] };
      MultiDeviceMemoryOperations< void, Devices::Cuda >::copy( resultArray.get(), deviceAux1, reducedSize );

#ifdef CUDA_REDUCTION_PROFILING
@@ -392,34 +379,8 @@ Reduction< Devices::Cuda >::reduceWithArgument( const Index begin,

   if( can_reduce_later_on_host ) {
      // transfer the reduced data from device to host
      std::unique_ptr< Result[] > resultArray{
// Workaround for nvcc 10.1.168 - it would modify the simple expression
// `new Result[reducedSize]` in the source code to `new (Result[reducedSize])`
// which is not correct - see e.g. https://stackoverflow.com/a/39671946
// Thus, the host compiler would spit out hundreds of warnings...
// Funnily enough, nvcc's behaviour depends on the context rather than the
// expression, because exactly the same simple expression in different places
// does not produce warnings.
#ifdef __NVCC__
         new Result[ static_cast< const int& >( reducedSize ) ]
#else
         new Result[ reducedSize ]
#endif
      };
      std::unique_ptr< Index[] > indexArray{
// Workaround for nvcc 10.1.168 - it would modify the simple expression
// `new Index[reducedSize]` in the source code to `new (Index[reducedSize])`
// which is not correct - see e.g. https://stackoverflow.com/a/39671946
// Thus, the host compiler would spit out hundreds of warnings...
// Funnily enough, nvcc's behaviour depends on the context rather than the
// expression, because exactly the same simple expression in different places
// does not produce warnings.
#ifdef __NVCC__
         new Index[ static_cast< const int& >( reducedSize ) ]
#else
         new Index[ reducedSize ]
#endif
      };
      std::unique_ptr< Result[] > resultArray{ new Result[ reducedSize ] };
      std::unique_ptr< Index[] > indexArray{ new Index[ reducedSize ] };
      MultiDeviceMemoryOperations< void, Devices::Cuda >::copy( resultArray.get(), deviceAux1, reducedSize );
      MultiDeviceMemoryOperations< void, Devices::Cuda >::copy( indexArray.get(), deviceIndexes, reducedSize );