Loading src/Python/pytnl/tnl/SparseMatrix.h +1 −1 Original line number Diff line number Diff line Loading @@ -99,7 +99,7 @@ void export_Matrix( py::module & m, const char* name ) // TODO: these two don't work //.def("addMatrix", &Matrix::addMatrix) //.def("getTransposition", &Matrix::getTransposition) .def("performSORIteration", &Matrix::template performSORIteration< VectorType >) .def("performSORIteration", &Matrix::template performSORIteration< VectorType, VectorType >) // .def("assign", &Matrix::operator=) .def("assign", []( Matrix& matrix, const Matrix& other ) -> Matrix& { return matrix = other; Loading src/TNL/Containers/Algorithms/ArrayOperations.h +2 −4 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ class ArrayOperations< Devices::Host > const Element& value ); template< typename Element > static Element getMemoryElement( Element* data ); static Element getMemoryElement( const Element* data ); template< typename Element, typename Index > static bool setMemory( Element* data, Loading Loading @@ -86,12 +86,10 @@ class ArrayOperations< Devices::Cuda > static void freeMemory( Element* data ); template< typename Element > __cuda_callable__ static void setMemoryElement( Element* data, const Element& value ); template< typename Element > __cuda_callable__ static Element getMemoryElement( const Element* data ); template< typename Element, typename Index > Loading src/TNL/Containers/Algorithms/ArrayOperationsCuda_impl.h +2 −10 Original line number Diff line number Diff line Loading @@ -60,32 +60,24 @@ freeMemory( Element* data ) } template< typename Element > __cuda_callable__ void void ArrayOperations< Devices::Cuda >:: setMemoryElement( Element* data, const Element& value ) { TNL_ASSERT_TRUE( data, "Attempted to set data through a nullptr." ); #ifdef __CUDAARCH__ *data = value; #else ArrayOperations< Devices::Cuda >::setMemory( data, value, 1 ); #endif } template< typename Element > __cuda_callable__ Element Element ArrayOperations< Devices::Cuda >:: getMemoryElement( const Element* data ) { TNL_ASSERT_TRUE( data, "Attempted to get data through a nullptr." ); #ifdef __CUDAARCH__ return *data; #else Element result; ArrayOperations< Devices::Host, Devices::Cuda >::copyMemory< Element, Element, int >( &result, data, 1 ); return result; #endif } Loading src/TNL/Containers/Algorithms/ArrayOperationsHost_impl.h +3 −3 Original line number Diff line number Diff line Loading @@ -51,15 +51,15 @@ setMemoryElement( Element* data, const Element& value ) { *data = value; }; } template< typename Element > Element ArrayOperations< Devices::Host >:: getMemoryElement( Element* data ) getMemoryElement( const Element* data ) { return *data; }; } template< typename Element, typename Index > bool Loading src/TNL/Containers/Algorithms/Reduction_impl.h +2 −2 Original line number Diff line number Diff line Loading @@ -69,12 +69,12 @@ reduce( Operation& operation, */ if( can_reduce_all_on_host && size <= Reduction_minGpuDataSize ) { DataType1 hostArray1[ Reduction_minGpuDataSize ]; typename std::remove_const< DataType1 >::type hostArray1[ Reduction_minGpuDataSize ]; if( ! ArrayOperations< Devices::Host, Devices::Cuda >::copyMemory( hostArray1, deviceInput1, size ) ) return false; if( deviceInput2 ) { using _DT2 = typename std::conditional< std::is_same< DataType2, void >::value, DataType1, DataType2 >::type; _DT2 hostArray2[ Reduction_minGpuDataSize ]; typename std::remove_const< _DT2 >::type hostArray2[ Reduction_minGpuDataSize ]; if( ! ArrayOperations< Devices::Host, Devices::Cuda >::copyMemory( hostArray2, (_DT2*) deviceInput2, size ) ) return false; return Reduction< Devices::Host >::reduce( operation, size, hostArray1, hostArray2, result ); Loading Loading
src/Python/pytnl/tnl/SparseMatrix.h +1 −1 Original line number Diff line number Diff line Loading @@ -99,7 +99,7 @@ void export_Matrix( py::module & m, const char* name ) // TODO: these two don't work //.def("addMatrix", &Matrix::addMatrix) //.def("getTransposition", &Matrix::getTransposition) .def("performSORIteration", &Matrix::template performSORIteration< VectorType >) .def("performSORIteration", &Matrix::template performSORIteration< VectorType, VectorType >) // .def("assign", &Matrix::operator=) .def("assign", []( Matrix& matrix, const Matrix& other ) -> Matrix& { return matrix = other; Loading
src/TNL/Containers/Algorithms/ArrayOperations.h +2 −4 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ class ArrayOperations< Devices::Host > const Element& value ); template< typename Element > static Element getMemoryElement( Element* data ); static Element getMemoryElement( const Element* data ); template< typename Element, typename Index > static bool setMemory( Element* data, Loading Loading @@ -86,12 +86,10 @@ class ArrayOperations< Devices::Cuda > static void freeMemory( Element* data ); template< typename Element > __cuda_callable__ static void setMemoryElement( Element* data, const Element& value ); template< typename Element > __cuda_callable__ static Element getMemoryElement( const Element* data ); template< typename Element, typename Index > Loading
src/TNL/Containers/Algorithms/ArrayOperationsCuda_impl.h +2 −10 Original line number Diff line number Diff line Loading @@ -60,32 +60,24 @@ freeMemory( Element* data ) } template< typename Element > __cuda_callable__ void void ArrayOperations< Devices::Cuda >:: setMemoryElement( Element* data, const Element& value ) { TNL_ASSERT_TRUE( data, "Attempted to set data through a nullptr." ); #ifdef __CUDAARCH__ *data = value; #else ArrayOperations< Devices::Cuda >::setMemory( data, value, 1 ); #endif } template< typename Element > __cuda_callable__ Element Element ArrayOperations< Devices::Cuda >:: getMemoryElement( const Element* data ) { TNL_ASSERT_TRUE( data, "Attempted to get data through a nullptr." ); #ifdef __CUDAARCH__ return *data; #else Element result; ArrayOperations< Devices::Host, Devices::Cuda >::copyMemory< Element, Element, int >( &result, data, 1 ); return result; #endif } Loading
src/TNL/Containers/Algorithms/ArrayOperationsHost_impl.h +3 −3 Original line number Diff line number Diff line Loading @@ -51,15 +51,15 @@ setMemoryElement( Element* data, const Element& value ) { *data = value; }; } template< typename Element > Element ArrayOperations< Devices::Host >:: getMemoryElement( Element* data ) getMemoryElement( const Element* data ) { return *data; }; } template< typename Element, typename Index > bool Loading
src/TNL/Containers/Algorithms/Reduction_impl.h +2 −2 Original line number Diff line number Diff line Loading @@ -69,12 +69,12 @@ reduce( Operation& operation, */ if( can_reduce_all_on_host && size <= Reduction_minGpuDataSize ) { DataType1 hostArray1[ Reduction_minGpuDataSize ]; typename std::remove_const< DataType1 >::type hostArray1[ Reduction_minGpuDataSize ]; if( ! ArrayOperations< Devices::Host, Devices::Cuda >::copyMemory( hostArray1, deviceInput1, size ) ) return false; if( deviceInput2 ) { using _DT2 = typename std::conditional< std::is_same< DataType2, void >::value, DataType1, DataType2 >::type; _DT2 hostArray2[ Reduction_minGpuDataSize ]; typename std::remove_const< _DT2 >::type hostArray2[ Reduction_minGpuDataSize ]; if( ! ArrayOperations< Devices::Host, Devices::Cuda >::copyMemory( hostArray2, (_DT2*) deviceInput2, size ) ) return false; return Reduction< Devices::Host >::reduce( operation, size, hostArray1, hostArray2, result ); Loading