Skip to content
Snippets Groups Projects
Commit 96ede6df authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Renamed methods in ArrayOperations to be simpler

parent 47837411
No related branches found
No related tags found
1 merge request!33Allocators
Showing
with 356 additions and 368 deletions
...@@ -60,7 +60,7 @@ struct ArrayAssignment< Array, T, true > ...@@ -60,7 +60,7 @@ struct ArrayAssignment< Array, T, true >
TNL_ASSERT_EQ( a.getSize(), t.getSize(), "The sizes of the arrays must be equal." ); TNL_ASSERT_EQ( a.getSize(), t.getSize(), "The sizes of the arrays must be equal." );
if( t.getSize() > 0 ) // we allow even assignment of empty arrays if( t.getSize() > 0 ) // we allow even assignment of empty arrays
ArrayOperations< typename Array::DeviceType, typename T::DeviceType >::template ArrayOperations< typename Array::DeviceType, typename T::DeviceType >::template
copyMemory< typename Array::ValueType, typename T::ValueType, typename Array::IndexType > copy< typename Array::ValueType, typename T::ValueType, typename Array::IndexType >
( a.getArrayData(), t.getArrayData(), t.getSize() ); ( a.getArrayData(), t.getArrayData(), t.getSize() );
} }
}; };
...@@ -81,7 +81,7 @@ struct ArrayAssignment< Array, T, false > ...@@ -81,7 +81,7 @@ struct ArrayAssignment< Array, T, false >
{ {
TNL_ASSERT_FALSE( a.empty(), "Cannot assign value to empty array." ); TNL_ASSERT_FALSE( a.empty(), "Cannot assign value to empty array." );
ArrayOperations< typename Array::DeviceType >::template ArrayOperations< typename Array::DeviceType >::template
setMemory< typename Array::ValueType, typename Array::IndexType > set< typename Array::ValueType, typename Array::IndexType >
( a.getArrayData(), ( typename Array::ValueType ) t, a.getSize() ); ( a.getArrayData(), ( typename Array::ValueType ) t, a.getSize() );
} }
}; };
......
...@@ -21,234 +21,222 @@ namespace Algorithms { ...@@ -21,234 +21,222 @@ namespace Algorithms {
template< typename DestinationDevice, template< typename DestinationDevice,
typename SourceDevice = DestinationDevice > typename SourceDevice = DestinationDevice >
class ArrayOperations{}; struct ArrayOperations;
template<> template<>
class ArrayOperations< Devices::Host > struct ArrayOperations< Devices::Host >
{ {
public: template< typename Element >
static void setElement( Element* data,
template< typename Element > const Element& value );
static void setMemoryElement( Element* data,
const Element& value ); template< typename Element >
static Element getElement( const Element* data );
template< typename Element >
static Element getMemoryElement( const Element* data ); template< typename Element, typename Index >
static void set( Element* data,
template< typename Element, typename Index > const Element& value,
static void setMemory( Element* data, const Index size );
const Element& value,
const Index size ); template< typename DestinationElement,
typename SourceElement,
template< typename DestinationElement, typename Index >
typename SourceElement, static void copy( DestinationElement* destination,
typename Index > const SourceElement* source,
static void copyMemory( DestinationElement* destination, const Index size );
const SourceElement* source,
const Index size ); template< typename DestinationElement,
typename SourceElement >
template< typename DestinationElement, static void copySTLList( DestinationElement* destination,
typename SourceElement > const std::list< SourceElement >& source );
static void copySTLList( DestinationElement* destination,
const std::list< SourceElement >& source ); template< typename Element1,
typename Element2,
template< typename Element1, typename Index >
typename Element2, static bool compare( const Element1* destination,
typename Index > const Element2* source,
static bool compareMemory( const Element1* destination, const Index size );
const Element2* source,
const Index size ); template< typename Element,
typename Index >
template< typename Element, static bool containsValue( const Element* data,
typename Index > const Index size,
static bool containsValue( const Element* data, const Element& value );
const Index size,
const Element& value ); template< typename Element,
typename Index >
template< typename Element, static bool containsOnlyValue( const Element* data,
typename Index > const Index size,
static bool containsOnlyValue( const Element* data, const Element& value );
const Index size,
const Element& value );
}; };
template<> template<>
class ArrayOperations< Devices::Cuda > struct ArrayOperations< Devices::Cuda >
{ {
public: template< typename Element >
static void setElement( Element* data,
template< typename Element > const Element& value );
static void setMemoryElement( Element* data,
const Element& value ); template< typename Element >
static Element getElement( const Element* data );
template< typename Element >
static Element getMemoryElement( const Element* data ); template< typename Element, typename Index >
static void set( Element* data,
template< typename Element, typename Index > const Element& value,
static void setMemory( Element* data, const Index size );
const Element& value,
const Index size ); template< typename DestinationElement,
typename SourceElement,
template< typename DestinationElement, typename Index >
typename SourceElement, static void copy( DestinationElement* destination,
typename Index > const SourceElement* source,
static void copyMemory( DestinationElement* destination, const Index size );
const SourceElement* source,
const Index size ); template< typename DestinationElement,
typename SourceElement >
template< typename DestinationElement, static void copySTLList( DestinationElement* destination,
typename SourceElement > const std::list< SourceElement >& source );
static void copySTLList( DestinationElement* destination,
const std::list< SourceElement >& source ); template< typename Element1,
typename Element2,
template< typename Element1, typename Index >
typename Element2, static bool compare( const Element1* destination,
typename Index > const Element2* source,
static bool compareMemory( const Element1* destination, const Index size );
const Element2* source,
const Index size ); template< typename Element,
typename Index >
template< typename Element, static bool containsValue( const Element* data,
typename Index > const Index size,
static bool containsValue( const Element* data, const Element& value );
const Index size,
const Element& value ); template< typename Element,
typename Index >
template< typename Element, static bool containsOnlyValue( const Element* data,
typename Index > const Index size,
static bool containsOnlyValue( const Element* data, const Element& value );
const Index size,
const Element& value );
}; };
template<> template<>
class ArrayOperations< Devices::Cuda, Devices::Host > struct ArrayOperations< Devices::Cuda, Devices::Host >
{ {
public: template< typename DestinationElement,
typename SourceElement,
template< typename DestinationElement, typename Index >
typename SourceElement, static void copy( DestinationElement* destination,
typename Index > const SourceElement* source,
static void copyMemory( DestinationElement* destination, const Index size );
const SourceElement* source,
const Index size ); template< typename DestinationElement,
typename SourceElement,
template< typename DestinationElement, typename Index >
typename SourceElement, static bool compare( const DestinationElement* destination,
typename Index > const SourceElement* source,
static bool compareMemory( const DestinationElement* destination, const Index size );
const SourceElement* source,
const Index size );
}; };
template<> template<>
class ArrayOperations< Devices::Host, Devices::Cuda > struct ArrayOperations< Devices::Host, Devices::Cuda >
{ {
public: template< typename DestinationElement,
typename SourceElement,
template< typename DestinationElement, typename Index >
typename SourceElement, static void copy( DestinationElement* destination,
typename Index > const SourceElement* source,
static void copyMemory( DestinationElement* destination, const Index size );
const SourceElement* source,
const Index size ); template< typename Element1,
typename Element2,
template< typename Element1, typename Index >
typename Element2, static bool compare( const Element1* destination,
typename Index > const Element2* source,
static bool compareMemory( const Element1* destination, const Index size );
const Element2* source,
const Index size );
}; };
template<> template<>
class ArrayOperations< Devices::MIC > struct ArrayOperations< Devices::MIC >
{ {
public: template< typename Element >
static void setElement( Element* data,
template< typename Element > const Element& value );
static void setMemoryElement( Element* data,
const Element& value ); template< typename Element >
static Element getElement( const Element* data );
template< typename Element >
static Element getMemoryElement( const Element* data ); template< typename Element, typename Index >
static void set( Element* data,
template< typename Element, typename Index > const Element& value,
static void setMemory( Element* data, const Index size );
const Element& value,
const Index size ); template< typename DestinationElement,
typename SourceElement,
template< typename DestinationElement, typename Index >
typename SourceElement, static void copy( DestinationElement* destination,
typename Index > const SourceElement* source,
static void copyMemory( DestinationElement* destination, const Index size );
const SourceElement* source,
const Index size ); template< typename DestinationElement,
typename SourceElement >
template< typename DestinationElement, static void copySTLList( DestinationElement* destination,
typename SourceElement > const std::list< SourceElement >& source );
static void copySTLList( DestinationElement* destination,
const std::list< SourceElement >& source ); template< typename Element1,
typename Element2,
template< typename Element1, typename Index >
typename Element2, static bool compare( const Element1* destination,
typename Index > const Element2* source,
static bool compareMemory( const Element1* destination, const Index size );
const Element2* source,
const Index size ); template< typename Element,
typename Index >
template< typename Element, static bool containsValue( const Element* data,
typename Index > const Index size,
static bool containsValue( const Element* data, const Element& value );
const Index size,
const Element& value ); template< typename Element,
typename Index >
template< typename Element, static bool containsOnlyValue( const Element* data,
typename Index > const Index size,
static bool containsOnlyValue( const Element* data, const Element& value );
const Index size,
const Element& value );
}; };
template<> template<>
class ArrayOperations< Devices::MIC, Devices::Host > struct ArrayOperations< Devices::MIC, Devices::Host >
{ {
public: public:
template< typename DestinationElement, template< typename DestinationElement,
typename SourceElement, typename SourceElement,
typename Index > typename Index >
static void copyMemory( DestinationElement* destination, static void copy( DestinationElement* destination,
const SourceElement* source, const SourceElement* source,
const Index size ); const Index size );
template< typename DestinationElement, template< typename DestinationElement,
typename SourceElement, typename SourceElement,
typename Index > typename Index >
static bool compareMemory( const DestinationElement* destination, static bool compare( const DestinationElement* destination,
const SourceElement* source, const SourceElement* source,
const Index size ); const Index size );
}; };
template<> template<>
class ArrayOperations< Devices::Host, Devices::MIC > struct ArrayOperations< Devices::Host, Devices::MIC >
{ {
public: template< typename DestinationElement,
typename SourceElement,
template< typename DestinationElement, typename Index >
typename SourceElement, static void copy( DestinationElement* destination,
typename Index > const SourceElement* source,
static void copyMemory( DestinationElement* destination, const Index size );
const SourceElement* source,
const Index size ); template< typename DestinationElement,
typename SourceElement,
template< typename DestinationElement, typename Index >
typename SourceElement, static bool compare( const DestinationElement* destination,
typename Index > const SourceElement* source,
static bool compareMemory( const DestinationElement* destination, const Index size );
const SourceElement* source,
const Index size );
}; };
} // namespace Algorithms } // namespace Algorithms
......
...@@ -27,30 +27,30 @@ namespace Algorithms { ...@@ -27,30 +27,30 @@ namespace Algorithms {
template< typename Element > template< typename Element >
void void
ArrayOperations< Devices::Cuda >:: ArrayOperations< Devices::Cuda >::
setMemoryElement( Element* data, setElement( Element* data,
const Element& value ) const Element& value )
{ {
TNL_ASSERT_TRUE( data, "Attempted to set data through a nullptr." ); TNL_ASSERT_TRUE( data, "Attempted to set data through a nullptr." );
ArrayOperations< Devices::Cuda >::setMemory( data, value, 1 ); ArrayOperations< Devices::Cuda >::set( data, value, 1 );
} }
template< typename Element > template< typename Element >
Element Element
ArrayOperations< Devices::Cuda >:: ArrayOperations< Devices::Cuda >::
getMemoryElement( const Element* data ) getElement( const Element* data )
{ {
TNL_ASSERT_TRUE( data, "Attempted to get data through a nullptr." ); TNL_ASSERT_TRUE( data, "Attempted to get data through a nullptr." );
Element result; Element result;
ArrayOperations< Devices::Host, Devices::Cuda >::copyMemory< Element, Element, int >( &result, data, 1 ); ArrayOperations< Devices::Host, Devices::Cuda >::copy< Element, Element, int >( &result, data, 1 );
return result; return result;
} }
template< typename Element, typename Index > template< typename Element, typename Index >
void void
ArrayOperations< Devices::Cuda >:: ArrayOperations< Devices::Cuda >::
setMemory( Element* data, set( Element* data,
const Element& value, const Element& value,
const Index size ) const Index size )
{ {
TNL_ASSERT_TRUE( data, "Attempted to set data through a nullptr." ); TNL_ASSERT_TRUE( data, "Attempted to set data through a nullptr." );
auto kernel = [data, value] __cuda_callable__ ( Index i ) auto kernel = [data, value] __cuda_callable__ ( Index i )
...@@ -65,9 +65,9 @@ template< typename DestinationElement, ...@@ -65,9 +65,9 @@ template< typename DestinationElement,
typename Index > typename Index >
void void
ArrayOperations< Devices::Cuda >:: ArrayOperations< Devices::Cuda >::
copyMemory( DestinationElement* destination, copy( DestinationElement* destination,
const SourceElement* source, const SourceElement* source,
const Index size ) const Index size )
{ {
TNL_ASSERT_TRUE( destination, "Attempted to copy data to a nullptr." ); TNL_ASSERT_TRUE( destination, "Attempted to copy data to a nullptr." );
TNL_ASSERT_TRUE( source, "Attempted to copy data from a nullptr." ); TNL_ASSERT_TRUE( source, "Attempted to copy data from a nullptr." );
...@@ -111,7 +111,7 @@ copySTLList( DestinationElement* destination, ...@@ -111,7 +111,7 @@ copySTLList( DestinationElement* destination,
const auto copySize = std::min( size - copiedElements, copy_buffer_size ); const auto copySize = std::min( size - copiedElements, copy_buffer_size );
for( std::size_t i = 0; i < copySize; i++ ) for( std::size_t i = 0; i < copySize; i++ )
copy_buffer[ i ] = static_cast< DestinationElement >( * it ++ ); copy_buffer[ i ] = static_cast< DestinationElement >( * it ++ );
ArrayOperations< Devices::Cuda, Devices::Host >::copyMemory( &destination[ copiedElements ], &copy_buffer[ 0 ], copySize ); ArrayOperations< Devices::Cuda, Devices::Host >::copy( &destination[ copiedElements ], &copy_buffer[ 0 ], copySize );
copiedElements += copySize; copiedElements += copySize;
} }
} }
...@@ -120,9 +120,9 @@ template< typename Element1, ...@@ -120,9 +120,9 @@ template< typename Element1,
typename Index > typename Index >
bool bool
ArrayOperations< Devices::Cuda >:: ArrayOperations< Devices::Cuda >::
compareMemory( const Element1* destination, compare( const Element1* destination,
const Element2* source, const Element2* source,
const Index size ) const Index size )
{ {
TNL_ASSERT_TRUE( destination, "Attempted to compare data through a nullptr." ); TNL_ASSERT_TRUE( destination, "Attempted to compare data through a nullptr." );
TNL_ASSERT_TRUE( source, "Attempted to compare data through a nullptr." ); TNL_ASSERT_TRUE( source, "Attempted to compare data through a nullptr." );
...@@ -179,9 +179,9 @@ template< typename DestinationElement, ...@@ -179,9 +179,9 @@ template< typename DestinationElement,
typename Index > typename Index >
void void
ArrayOperations< Devices::Host, Devices::Cuda >:: ArrayOperations< Devices::Host, Devices::Cuda >::
copyMemory( DestinationElement* destination, copy( DestinationElement* destination,
const SourceElement* source, const SourceElement* source,
const Index size ) const Index size )
{ {
TNL_ASSERT_TRUE( destination, "Attempted to copy data to a nullptr." ); TNL_ASSERT_TRUE( destination, "Attempted to copy data to a nullptr." );
TNL_ASSERT_TRUE( source, "Attempted to copy data from a nullptr." ); TNL_ASSERT_TRUE( source, "Attempted to copy data from a nullptr." );
...@@ -228,9 +228,9 @@ template< typename Element1, ...@@ -228,9 +228,9 @@ template< typename Element1,
typename Index > typename Index >
bool bool
ArrayOperations< Devices::Host, Devices::Cuda >:: ArrayOperations< Devices::Host, Devices::Cuda >::
compareMemory( const Element1* destination, compare( const Element1* destination,
const Element2* source, const Element2* source,
const Index size ) const Index size )
{ {
/*** /***
* Here, destination is on host and source is on CUDA device. * Here, destination is on host and source is on CUDA device.
...@@ -250,7 +250,7 @@ compareMemory( const Element1* destination, ...@@ -250,7 +250,7 @@ compareMemory( const Element1* destination,
cudaMemcpyDeviceToHost ) != cudaSuccess ) cudaMemcpyDeviceToHost ) != cudaSuccess )
std::cerr << "Transfer of data from CUDA device to host failed." << std::endl; std::cerr << "Transfer of data from CUDA device to host failed." << std::endl;
TNL_CHECK_CUDA_DEVICE; TNL_CHECK_CUDA_DEVICE;
if( ! ArrayOperations< Devices::Host >::compareMemory( &destination[ compared ], host_buffer.get(), transfer ) ) if( ! ArrayOperations< Devices::Host >::compare( &destination[ compared ], host_buffer.get(), transfer ) )
return false; return false;
compared += transfer; compared += transfer;
} }
...@@ -268,9 +268,9 @@ template< typename DestinationElement, ...@@ -268,9 +268,9 @@ template< typename DestinationElement,
typename Index > typename Index >
void void
ArrayOperations< Devices::Cuda, Devices::Host >:: ArrayOperations< Devices::Cuda, Devices::Host >::
copyMemory( DestinationElement* destination, copy( DestinationElement* destination,
const SourceElement* source, const SourceElement* source,
const Index size ) const Index size )
{ {
TNL_ASSERT_TRUE( destination, "Attempted to copy data to a nullptr." ); TNL_ASSERT_TRUE( destination, "Attempted to copy data to a nullptr." );
TNL_ASSERT_TRUE( source, "Attempted to copy data from a nullptr." ); TNL_ASSERT_TRUE( source, "Attempted to copy data from a nullptr." );
...@@ -316,14 +316,14 @@ template< typename Element1, ...@@ -316,14 +316,14 @@ template< typename Element1,
typename Index > typename Index >
bool bool
ArrayOperations< Devices::Cuda, Devices::Host >:: ArrayOperations< Devices::Cuda, Devices::Host >::
compareMemory( const Element1* hostData, compare( const Element1* hostData,
const Element2* deviceData, const Element2* deviceData,
const Index size ) const Index size )
{ {
TNL_ASSERT_TRUE( hostData, "Attempted to compare data through a nullptr." ); TNL_ASSERT_TRUE( hostData, "Attempted to compare data through a nullptr." );
TNL_ASSERT_TRUE( deviceData, "Attempted to compare data through a nullptr." ); TNL_ASSERT_TRUE( deviceData, "Attempted to compare data through a nullptr." );
TNL_ASSERT_GE( size, (Index) 0, "Array size must be non-negative." ); TNL_ASSERT_GE( size, (Index) 0, "Array size must be non-negative." );
return ArrayOperations< Devices::Host, Devices::Cuda >::compareMemory( deviceData, hostData, size ); return ArrayOperations< Devices::Host, Devices::Cuda >::compare( deviceData, hostData, size );
} }
} // namespace Algorithms } // namespace Algorithms
......
...@@ -25,8 +25,8 @@ namespace Algorithms { ...@@ -25,8 +25,8 @@ namespace Algorithms {
template< typename Element > template< typename Element >
void void
ArrayOperations< Devices::Host >:: ArrayOperations< Devices::Host >::
setMemoryElement( Element* data, setElement( Element* data,
const Element& value ) const Element& value )
{ {
TNL_ASSERT_TRUE( data, "Attempted to set data through a nullptr." ); TNL_ASSERT_TRUE( data, "Attempted to set data through a nullptr." );
*data = value; *data = value;
...@@ -35,7 +35,7 @@ setMemoryElement( Element* data, ...@@ -35,7 +35,7 @@ setMemoryElement( Element* data,
template< typename Element > template< typename Element >
Element Element
ArrayOperations< Devices::Host >:: ArrayOperations< Devices::Host >::
getMemoryElement( const Element* data ) getElement( const Element* data )
{ {
TNL_ASSERT_TRUE( data, "Attempted to get data through a nullptr." ); TNL_ASSERT_TRUE( data, "Attempted to get data through a nullptr." );
return *data; return *data;
...@@ -44,9 +44,9 @@ getMemoryElement( const Element* data ) ...@@ -44,9 +44,9 @@ getMemoryElement( const Element* data )
template< typename Element, typename Index > template< typename Element, typename Index >
void void
ArrayOperations< Devices::Host >:: ArrayOperations< Devices::Host >::
setMemory( Element* data, set( Element* data,
const Element& value, const Element& value,
const Index size ) const Index size )
{ {
TNL_ASSERT_TRUE( data, "Attempted to set data through a nullptr." ); TNL_ASSERT_TRUE( data, "Attempted to set data through a nullptr." );
auto kernel = [data, value]( Index i ) auto kernel = [data, value]( Index i )
...@@ -61,9 +61,9 @@ template< typename DestinationElement, ...@@ -61,9 +61,9 @@ template< typename DestinationElement,
typename Index > typename Index >
void void
ArrayOperations< Devices::Host >:: ArrayOperations< Devices::Host >::
copyMemory( DestinationElement* destination, copy( DestinationElement* destination,
const SourceElement* source, const SourceElement* source,
const Index size ) const Index size )
{ {
if( std::is_same< DestinationElement, SourceElement >::value && if( std::is_same< DestinationElement, SourceElement >::value &&
( std::is_fundamental< DestinationElement >::value || ( std::is_fundamental< DestinationElement >::value ||
...@@ -108,9 +108,9 @@ template< typename DestinationElement, ...@@ -108,9 +108,9 @@ template< typename DestinationElement,
typename Index > typename Index >
bool bool
ArrayOperations< Devices::Host >:: ArrayOperations< Devices::Host >::
compareMemory( const DestinationElement* destination, compare( const DestinationElement* destination,
const SourceElement* source, const SourceElement* source,
const Index size ) const Index size )
{ {
TNL_ASSERT_TRUE( destination, "Attempted to compare data through a nullptr." ); TNL_ASSERT_TRUE( destination, "Attempted to compare data through a nullptr." );
TNL_ASSERT_TRUE( source, "Attempted to compare data through a nullptr." ); TNL_ASSERT_TRUE( source, "Attempted to compare data through a nullptr." );
......
...@@ -30,30 +30,30 @@ static constexpr std::size_t MIC_STACK_VAR_LIM = 5*1024*1024; ...@@ -30,30 +30,30 @@ static constexpr std::size_t MIC_STACK_VAR_LIM = 5*1024*1024;
template< typename Element > template< typename Element >
void void
ArrayOperations< Devices::MIC >:: ArrayOperations< Devices::MIC >::
setMemoryElement( Element* data, setElement( Element* data,
const Element& value ) const Element& value )
{ {
TNL_ASSERT( data, ); TNL_ASSERT( data, );
ArrayOperations< Devices::MIC >::setMemory( data, value, 1 ); ArrayOperations< Devices::MIC >::set( data, value, 1 );
} }
template< typename Element > template< typename Element >
Element Element
ArrayOperations< Devices::MIC >:: ArrayOperations< Devices::MIC >::
getMemoryElement( const Element* data ) getElement( const Element* data )
{ {
TNL_ASSERT( data, ); TNL_ASSERT( data, );
Element result; Element result;
ArrayOperations< Devices::Host, Devices::MIC >::copyMemory< Element, Element, int >( &result, data, 1 ); ArrayOperations< Devices::Host, Devices::MIC >::copy< Element, Element, int >( &result, data, 1 );
return result; return result;
} }
template< typename Element, typename Index > template< typename Element, typename Index >
void void
ArrayOperations< Devices::MIC >:: ArrayOperations< Devices::MIC >::
setMemory( Element* data, set( Element* data,
const Element& value, const Element& value,
const Index size ) const Index size )
{ {
TNL_ASSERT( data, ); TNL_ASSERT( data, );
#ifdef HAVE_MIC #ifdef HAVE_MIC
...@@ -76,9 +76,9 @@ template< typename DestinationElement, ...@@ -76,9 +76,9 @@ template< typename DestinationElement,
typename Index > typename Index >
void void
ArrayOperations< Devices::MIC >:: ArrayOperations< Devices::MIC >::
copyMemory( DestinationElement* destination, copy( DestinationElement* destination,
const SourceElement* source, const SourceElement* source,
const Index size ) const Index size )
{ {
TNL_ASSERT( destination, ); TNL_ASSERT( destination, );
TNL_ASSERT( source, ); TNL_ASSERT( source, );
...@@ -116,7 +116,7 @@ template< typename DestinationElement, ...@@ -116,7 +116,7 @@ template< typename DestinationElement,
void void
ArrayOperations< Devices::MIC >:: ArrayOperations< Devices::MIC >::
copySTLList( DestinationElement* destination, copySTLList( DestinationElement* destination,
const std::list< SourceElement >& source ) const std::list< SourceElement >& source )
{ {
throw Exceptions::NotImplementedError(); throw Exceptions::NotImplementedError();
} }
...@@ -126,9 +126,9 @@ template< typename Element1, ...@@ -126,9 +126,9 @@ template< typename Element1,
typename Index > typename Index >
bool bool
ArrayOperations< Devices::MIC >:: ArrayOperations< Devices::MIC >::
compareMemory( const Element1* destination, compare( const Element1* destination,
const Element2* source, const Element2* source,
const Index size ) const Index size )
{ {
TNL_ASSERT( destination, ); TNL_ASSERT( destination, );
TNL_ASSERT( source, ); TNL_ASSERT( source, );
...@@ -218,9 +218,9 @@ template< typename DestinationElement, ...@@ -218,9 +218,9 @@ template< typename DestinationElement,
typename Index > typename Index >
void void
ArrayOperations< Devices::Host, Devices::MIC >:: ArrayOperations< Devices::Host, Devices::MIC >::
copyMemory( DestinationElement* destination, copy( DestinationElement* destination,
const SourceElement* source, const SourceElement* source,
const Index size ) const Index size )
{ {
TNL_ASSERT( destination, ); TNL_ASSERT( destination, );
TNL_ASSERT( source, ); TNL_ASSERT( source, );
...@@ -293,9 +293,9 @@ template< typename Element1, ...@@ -293,9 +293,9 @@ template< typename Element1,
typename Index > typename Index >
bool bool
ArrayOperations< Devices::Host, Devices::MIC >:: ArrayOperations< Devices::Host, Devices::MIC >::
compareMemory( const Element1* destination, compare( const Element1* destination,
const Element2* source, const Element2* source,
const Index size ) const Index size )
{ {
/*** /***
* Here, destination is on host and source is on MIC device. * Here, destination is on host and source is on MIC device.
...@@ -319,7 +319,7 @@ compareMemory( const Element1* destination, ...@@ -319,7 +319,7 @@ compareMemory( const Element1* destination,
{ {
memcpy((void*)&host_buffer,(void*)src_ptr.pointer,transfer*sizeof(Element2)); memcpy((void*)&host_buffer,(void*)src_ptr.pointer,transfer*sizeof(Element2));
} }
if( ! ArrayOperations< Devices::Host >::compareMemory( &destination[ compared ], (Element2*)&host_buffer, transfer ) ) if( ! ArrayOperations< Devices::Host >::compare( &destination[ compared ], (Element2*)&host_buffer, transfer ) )
{ {
return false; return false;
} }
...@@ -339,9 +339,9 @@ template< typename DestinationElement, ...@@ -339,9 +339,9 @@ template< typename DestinationElement,
typename Index > typename Index >
void void
ArrayOperations< Devices::MIC, Devices::Host >:: ArrayOperations< Devices::MIC, Devices::Host >::
copyMemory( DestinationElement* destination, copy( DestinationElement* destination,
const SourceElement* source, const SourceElement* source,
const Index size ) const Index size )
{ {
TNL_ASSERT( destination, ); TNL_ASSERT( destination, );
TNL_ASSERT( source, ); TNL_ASSERT( source, );
...@@ -412,14 +412,14 @@ template< typename Element1, ...@@ -412,14 +412,14 @@ template< typename Element1,
typename Index > typename Index >
bool bool
ArrayOperations< Devices::MIC, Devices::Host >:: ArrayOperations< Devices::MIC, Devices::Host >::
compareMemory( const Element1* hostData, compare( const Element1* hostData,
const Element2* deviceData, const Element2* deviceData,
const Index size ) const Index size )
{ {
TNL_ASSERT( hostData, ); TNL_ASSERT( hostData, );
TNL_ASSERT( deviceData, ); TNL_ASSERT( deviceData, );
TNL_ASSERT( size >= 0, std::cerr << "size = " << size ); TNL_ASSERT( size >= 0, std::cerr << "size = " << size );
return ArrayOperations< Devices::Host, Devices::MIC >::compareMemory( deviceData, hostData, size ); return ArrayOperations< Devices::Host, Devices::MIC >::compare( deviceData, hostData, size );
} }
} // namespace Algorithms } // namespace Algorithms
......
...@@ -402,7 +402,7 @@ struct CudaReductionKernelLauncher ...@@ -402,7 +402,7 @@ struct CudaReductionKernelLauncher
//// ////
// Copy result on CPU // Copy result on CPU
ResultType result; ResultType result;
ArrayOperations< Devices::Host, Devices::Cuda >::copyMemory( &result, output, 1 ); ArrayOperations< Devices::Host, Devices::Cuda >::copy( &result, output, 1 );
return result; return result;
} }
...@@ -438,8 +438,8 @@ struct CudaReductionKernelLauncher ...@@ -438,8 +438,8 @@ struct CudaReductionKernelLauncher
//// ////
// Copy result on CPU // Copy result on CPU
ResultType result; ResultType result;
ArrayOperations< Devices::Host, Devices::Cuda >::copyMemory( &result, output, 1 ); ArrayOperations< Devices::Host, Devices::Cuda >::copy( &result, output, 1 );
ArrayOperations< Devices::Host, Devices::Cuda >::copyMemory( &argument, idxOutput, 1 ); ArrayOperations< Devices::Host, Devices::Cuda >::copy( &argument, idxOutput, 1 );
return result; return result;
} }
......
...@@ -76,11 +76,11 @@ reduce( Operation& operation, ...@@ -76,11 +76,11 @@ reduce( Operation& operation,
*/ */
if( n * ldInput1 < Multireduction_minGpuDataSize ) { if( n * ldInput1 < Multireduction_minGpuDataSize ) {
DataType1 hostArray1[ Multireduction_minGpuDataSize ]; DataType1 hostArray1[ Multireduction_minGpuDataSize ];
ArrayOperations< Devices::Host, Devices::Cuda >::copyMemory( hostArray1, deviceInput1, n * ldInput1 ); ArrayOperations< Devices::Host, Devices::Cuda >::copy( hostArray1, deviceInput1, n * ldInput1 );
if( deviceInput2 ) { if( deviceInput2 ) {
using _DT2 = typename std::conditional< std::is_same< DataType2, void >::value, DataType1, DataType2 >::type; using _DT2 = typename std::conditional< std::is_same< DataType2, void >::value, DataType1, DataType2 >::type;
_DT2 hostArray2[ Multireduction_minGpuDataSize ]; _DT2 hostArray2[ Multireduction_minGpuDataSize ];
ArrayOperations< Devices::Host, Devices::Cuda >::copyMemory( hostArray2, (_DT2*) deviceInput2, size ); ArrayOperations< Devices::Host, Devices::Cuda >::copy( hostArray2, (_DT2*) deviceInput2, size );
Multireduction< Devices::Host >::reduce( operation, n, size, hostArray1, ldInput1, hostArray2, hostResult ); Multireduction< Devices::Host >::reduce( operation, n, size, hostArray1, ldInput1, hostArray2, hostResult );
} }
else { else {
...@@ -117,7 +117,7 @@ reduce( Operation& operation, ...@@ -117,7 +117,7 @@ reduce( Operation& operation,
* Transfer the reduced data from device to host. * Transfer the reduced data from device to host.
*/ */
ResultType resultArray[ n * reducedSize ]; ResultType resultArray[ n * reducedSize ];
ArrayOperations< Devices::Host, Devices::Cuda >::copyMemory( resultArray, deviceAux1, n * reducedSize ); ArrayOperations< Devices::Host, Devices::Cuda >::copy( resultArray, deviceAux1, n * reducedSize );
#ifdef CUDA_REDUCTION_PROFILING #ifdef CUDA_REDUCTION_PROFILING
timer.stop(); timer.stop();
......
...@@ -326,7 +326,7 @@ Reduction< Devices::Cuda >:: ...@@ -326,7 +326,7 @@ Reduction< Devices::Cuda >::
* Transfer the reduced data from device to host. * Transfer the reduced data from device to host.
*/ */
std::unique_ptr< ResultType[] > resultArray{ new ResultType[ reducedSize ] }; std::unique_ptr< ResultType[] > resultArray{ new ResultType[ reducedSize ] };
ArrayOperations< Devices::Host, Devices::Cuda >::copyMemory( resultArray.get(), deviceAux1, reducedSize ); ArrayOperations< Devices::Host, Devices::Cuda >::copy( resultArray.get(), deviceAux1, reducedSize );
#ifdef CUDA_REDUCTION_PROFILING #ifdef CUDA_REDUCTION_PROFILING
timer.stop(); timer.stop();
...@@ -427,8 +427,8 @@ reduceWithArgument( const Index size, ...@@ -427,8 +427,8 @@ reduceWithArgument( const Index size,
*/ */
std::unique_ptr< ResultType[] > resultArray{ new ResultType[ reducedSize ] }; std::unique_ptr< ResultType[] > resultArray{ new ResultType[ reducedSize ] };
std::unique_ptr< IndexType[] > indexArray{ new IndexType[ reducedSize ] }; std::unique_ptr< IndexType[] > indexArray{ new IndexType[ reducedSize ] };
ArrayOperations< Devices::Host, Devices::Cuda >::copyMemory( resultArray.get(), deviceAux1, reducedSize ); ArrayOperations< Devices::Host, Devices::Cuda >::copy( resultArray.get(), deviceAux1, reducedSize );
ArrayOperations< Devices::Host, Devices::Cuda >::copyMemory( indexArray.get(), deviceIndexes, reducedSize ); ArrayOperations< Devices::Host, Devices::Cuda >::copy( indexArray.get(), deviceIndexes, reducedSize );
#ifdef CUDA_REDUCTION_PROFILING #ifdef CUDA_REDUCTION_PROFILING
timer.stop(); timer.stop();
......
...@@ -57,7 +57,7 @@ Array( Value* data, ...@@ -57,7 +57,7 @@ Array( Value* data,
: allocator( allocator ) : allocator( allocator )
{ {
this->setSize( size ); this->setSize( size );
Algorithms::ArrayOperations< Device >::copyMemory( this->getData(), data, size ); Algorithms::ArrayOperations< Device >::copy( this->getData(), data, size );
} }
template< typename Value, template< typename Value,
...@@ -68,7 +68,7 @@ Array< Value, Device, Index, Allocator >:: ...@@ -68,7 +68,7 @@ Array< Value, Device, Index, Allocator >::
Array( const Array< Value, Device, Index, Allocator >& array ) Array( const Array< Value, Device, Index, Allocator >& array )
{ {
this->setSize( array.getSize() ); this->setSize( array.getSize() );
Algorithms::ArrayOperations< Device >::copyMemory( this->getData(), array.getData(), array.getSize() ); Algorithms::ArrayOperations< Device >::copy( this->getData(), array.getData(), array.getSize() );
} }
template< typename Value, template< typename Value,
...@@ -81,7 +81,7 @@ Array( const Array< Value, Device, Index, Allocator >& array, ...@@ -81,7 +81,7 @@ Array( const Array< Value, Device, Index, Allocator >& array,
: allocator( allocator ) : allocator( allocator )
{ {
this->setSize( array.getSize() ); this->setSize( array.getSize() );
Algorithms::ArrayOperations< Device >::copyMemory( this->getData(), array.getData(), array.getSize() ); Algorithms::ArrayOperations< Device >::copy( this->getData(), array.getData(), array.getSize() );
} }
template< typename Value, template< typename Value,
...@@ -101,7 +101,7 @@ Array( const Array< Value, Device, Index, Allocator >& array, ...@@ -101,7 +101,7 @@ Array( const Array< Value, Device, Index, Allocator >& array,
TNL_ASSERT_LE( begin + size, array.getSize(), "End of array is out of bounds." ); TNL_ASSERT_LE( begin + size, array.getSize(), "End of array is out of bounds." );
this->setSize( size ); this->setSize( size );
Algorithms::ArrayOperations< Device >::copyMemory( this->getData(), &array.getData()[ begin ], size ); Algorithms::ArrayOperations< Device >::copy( this->getData(), &array.getData()[ begin ], size );
} }
template< typename Value, template< typename Value,
...@@ -118,7 +118,7 @@ Array( const std::initializer_list< InValue >& list, ...@@ -118,7 +118,7 @@ Array( const std::initializer_list< InValue >& list,
// Here we assume that the underlying array for std::initializer_list is // Here we assume that the underlying array for std::initializer_list is
// const T[N] as noted here: // const T[N] as noted here:
// https://en.cppreference.com/w/cpp/utility/initializer_list // https://en.cppreference.com/w/cpp/utility/initializer_list
Algorithms::ArrayOperations< Device, Devices::Host >::copyMemory( this->getData(), &( *list.begin() ), list.size() ); Algorithms::ArrayOperations< Device, Devices::Host >::copy( this->getData(), &( *list.begin() ), list.size() );
} }
template< typename Value, template< typename Value,
...@@ -146,7 +146,7 @@ Array( const std::vector< InValue >& vector, ...@@ -146,7 +146,7 @@ Array( const std::vector< InValue >& vector,
: allocator( allocator ) : allocator( allocator )
{ {
this->setSize( vector.size() ); this->setSize( vector.size() );
Algorithms::ArrayOperations< Device, Devices::Host >::copyMemory( this->getData(), vector.data(), vector.size() ); Algorithms::ArrayOperations< Device, Devices::Host >::copy( this->getData(), vector.data(), vector.size() );
} }
template< typename Value, template< typename Value,
...@@ -494,7 +494,7 @@ setElement( const Index& i, const Value& x ) ...@@ -494,7 +494,7 @@ setElement( const Index& i, const Value& x )
{ {
TNL_ASSERT_GE( i, (Index) 0, "Element index must be non-negative." ); TNL_ASSERT_GE( i, (Index) 0, "Element index must be non-negative." );
TNL_ASSERT_LT( i, this->getSize(), "Element index is out of bounds." ); TNL_ASSERT_LT( i, this->getSize(), "Element index is out of bounds." );
return Algorithms::ArrayOperations< Device >::setMemoryElement( &( this->data[ i ] ), x ); return Algorithms::ArrayOperations< Device >::setElement( &( this->data[ i ] ), x );
} }
template< typename Value, template< typename Value,
...@@ -507,7 +507,7 @@ getElement( const Index& i ) const ...@@ -507,7 +507,7 @@ getElement( const Index& i ) const
{ {
TNL_ASSERT_GE( i, (Index) 0, "Element index must be non-negative." ); TNL_ASSERT_GE( i, (Index) 0, "Element index must be non-negative." );
TNL_ASSERT_LT( i, this->getSize(), "Element index is out of bounds." ); TNL_ASSERT_LT( i, this->getSize(), "Element index is out of bounds." );
return Algorithms::ArrayOperations< Device >::getMemoryElement( & ( this->data[ i ] ) ); return Algorithms::ArrayOperations< Device >::getElement( & ( this->data[ i ] ) );
} }
template< typename Value, template< typename Value,
...@@ -551,7 +551,7 @@ operator=( const Array< Value, Device, Index, Allocator >& array ) ...@@ -551,7 +551,7 @@ operator=( const Array< Value, Device, Index, Allocator >& array )
this->setLike( array ); this->setLike( array );
if( this->getSize() > 0 ) if( this->getSize() > 0 )
Algorithms::ArrayOperations< Device >:: Algorithms::ArrayOperations< Device >::
copyMemory( this->getData(), copy( this->getData(),
array.getData(), array.getData(),
array.getSize() ); array.getSize() );
return *this; return *this;
...@@ -619,7 +619,7 @@ operator=( const std::vector< InValue >& vector ) ...@@ -619,7 +619,7 @@ operator=( const std::vector< InValue >& vector )
{ {
if( this->getSize() != vector.size() ) if( this->getSize() != vector.size() )
this->setSize( vector.size() ); this->setSize( vector.size() );
Algorithms::ArrayOperations< Device, Devices::Host >::copyMemory( this->getData(), vector.data(), vector.size() ); Algorithms::ArrayOperations< Device, Devices::Host >::copy( this->getData(), vector.data(), vector.size() );
return *this; return *this;
} }
...@@ -637,7 +637,7 @@ operator==( const ArrayT& array ) const ...@@ -637,7 +637,7 @@ operator==( const ArrayT& array ) const
if( this->getSize() == 0 ) if( this->getSize() == 0 )
return true; return true;
return Algorithms::ArrayOperations< Device, typename ArrayT::DeviceType >:: return Algorithms::ArrayOperations< Device, typename ArrayT::DeviceType >::
compareMemory( this->getData(), compare( this->getData(),
array.getData(), array.getData(),
array.getSize() ); array.getSize() );
} }
...@@ -667,7 +667,7 @@ setValue( const ValueType& v, ...@@ -667,7 +667,7 @@ setValue( const ValueType& v,
TNL_ASSERT_TRUE( this->getData(), "Attempted to set a value of an empty array." ); TNL_ASSERT_TRUE( this->getData(), "Attempted to set a value of an empty array." );
if( end == 0 ) if( end == 0 )
end = this->getSize(); end = this->getSize();
Algorithms::ArrayOperations< Device >::setMemory( &this->getData()[ begin ], v, end - begin ); Algorithms::ArrayOperations< Device >::set( &this->getData()[ begin ], v, end - begin );
} }
template< typename Value, template< typename Value,
......
...@@ -125,7 +125,7 @@ operator=( const ArrayView& view ) ...@@ -125,7 +125,7 @@ operator=( const ArrayView& view )
{ {
TNL_ASSERT_EQ( getSize(), view.getSize(), "The sizes of the array views must be equal, views are not resizable." ); TNL_ASSERT_EQ( getSize(), view.getSize(), "The sizes of the array views must be equal, views are not resizable." );
if( getSize() > 0 ) if( getSize() > 0 )
Algorithms::ArrayOperations< Device >::copyMemory( getData(), view.getData(), getSize() ); Algorithms::ArrayOperations< Device >::copy( getData(), view.getData(), getSize() );
return *this; return *this;
} }
...@@ -229,7 +229,7 @@ setElement( Index i, Value value ) ...@@ -229,7 +229,7 @@ setElement( Index i, Value value )
{ {
TNL_ASSERT_GE( i, 0, "Element index must be non-negative." ); TNL_ASSERT_GE( i, 0, "Element index must be non-negative." );
TNL_ASSERT_LT( i, this->getSize(), "Element index is out of bounds." ); TNL_ASSERT_LT( i, this->getSize(), "Element index is out of bounds." );
return Algorithms::ArrayOperations< Device >::setMemoryElement( &data[ i ], value ); return Algorithms::ArrayOperations< Device >::setElement( &data[ i ], value );
} }
template< typename Value, template< typename Value,
...@@ -241,7 +241,7 @@ getElement( Index i ) const ...@@ -241,7 +241,7 @@ getElement( Index i ) const
{ {
TNL_ASSERT_GE( i, 0, "Element index must be non-negative." ); TNL_ASSERT_GE( i, 0, "Element index must be non-negative." );
TNL_ASSERT_LT( i, this->getSize(), "Element index is out of bounds." ); TNL_ASSERT_LT( i, this->getSize(), "Element index is out of bounds." );
return Algorithms::ArrayOperations< Device >::getMemoryElement( &data[ i ] ); return Algorithms::ArrayOperations< Device >::getElement( &data[ i ] );
} }
template< typename Value, template< typename Value,
...@@ -282,7 +282,7 @@ operator==( const ArrayT& array ) const ...@@ -282,7 +282,7 @@ operator==( const ArrayT& array ) const
if( this->getSize() == 0 ) if( this->getSize() == 0 )
return true; return true;
return Algorithms::ArrayOperations< DeviceType, typename ArrayT::DeviceType >:: return Algorithms::ArrayOperations< DeviceType, typename ArrayT::DeviceType >::
compareMemory( this->getData(), compare( this->getData(),
array.getData(), array.getData(),
array.getSize() ); array.getSize() );
} }
...@@ -308,7 +308,7 @@ setValue( Value value, const Index begin, Index end ) ...@@ -308,7 +308,7 @@ setValue( Value value, const Index begin, Index end )
TNL_ASSERT_GT( size, 0, "Attempted to set value to an empty array view." ); TNL_ASSERT_GT( size, 0, "Attempted to set value to an empty array view." );
if( end == 0 ) if( end == 0 )
end = this->getSize(); end = this->getSize();
Algorithms::ArrayOperations< Device >::setMemory( &getData()[ begin ], value, end - begin ); Algorithms::ArrayOperations< Device >::set( &getData()[ begin ], value, end - begin );
} }
template< typename Value, template< typename Value,
......
...@@ -136,9 +136,9 @@ bool operator==( const Containers::VectorView< Real1, Device1, Index >& a, const ...@@ -136,9 +136,9 @@ bool operator==( const Containers::VectorView< Real1, Device1, Index >& a, const
if( a.getSize() == 0 ) if( a.getSize() == 0 )
return true; return true;
return Containers::Algorithms::ArrayOperations< Device1, Device2 >:: return Containers::Algorithms::ArrayOperations< Device1, Device2 >::
compareMemory( a.getData(), compare( a.getData(),
b.getData(), b.getData(),
a.getSize() ); a.getSize() );
} }
//// ////
...@@ -163,9 +163,9 @@ bool operator!=( const Containers::VectorView< Real1, Device1, Index >& a, const ...@@ -163,9 +163,9 @@ bool operator!=( const Containers::VectorView< Real1, Device1, Index >& a, const
if( a.getSize() == 0 ) if( a.getSize() == 0 )
return true; return true;
return !Containers::Algorithms::ArrayOperations< Device1, Device2 >:: return !Containers::Algorithms::ArrayOperations< Device1, Device2 >::
compareMemory( a.getData(), compare( a.getData(),
b.getData(), b.getData(),
a.getSize() ); a.getSize() );
} }
//// ////
......
...@@ -341,7 +341,7 @@ public: ...@@ -341,7 +341,7 @@ public:
// TODO: use static storage, e.g. from the CudaReductionBuffer, to avoid frequent reallocations // TODO: use static storage, e.g. from the CudaReductionBuffer, to avoid frequent reallocations
Containers::Vector< RealType, Devices::Cuda, IndexType > xDevice; Containers::Vector< RealType, Devices::Cuda, IndexType > xDevice;
xDevice.setSize( n ); xDevice.setSize( n );
Containers::Algorithms::ArrayOperations< Devices::Cuda, Devices::Host >::copyMemory< RealType, RealType, IndexType >( xDevice.getData(), x, n ); Containers::Algorithms::ArrayOperations< Devices::Cuda, Devices::Host >::copy< RealType, RealType, IndexType >( xDevice.getData(), x, n );
// desGridSize = blocksPerMultiprocessor * numberOfMultiprocessors // desGridSize = blocksPerMultiprocessor * numberOfMultiprocessors
const int desGridSize = 32 * Devices::CudaDeviceInfo::getCudaMultiprocessors( Devices::CudaDeviceInfo::getActiveDevice() ); const int desGridSize = 32 * Devices::CudaDeviceInfo::getCudaMultiprocessors( Devices::CudaDeviceInfo::getActiveDevice() );
......
...@@ -460,7 +460,7 @@ hauseholder_apply_trunc( HostView out, ...@@ -460,7 +460,7 @@ hauseholder_apply_trunc( HostView out,
// The upper (m+1)x(m+1) submatrix of Y is duplicated in the YL buffer, // The upper (m+1)x(m+1) submatrix of Y is duplicated in the YL buffer,
// which resides on host and is broadcasted from rank 0 to all processes. // which resides on host and is broadcasted from rank 0 to all processes.
HostView YL_i( &YL[ i * (restarting_max + 1) ], restarting_max + 1 ); HostView YL_i( &YL[ i * (restarting_max + 1) ], restarting_max + 1 );
Containers::Algorithms::ArrayOperations< Devices::Host, DeviceType >::copyMemory( YL_i.getData(), Traits::getLocalVectorView( y_i ).getData(), YL_i.getSize() ); Containers::Algorithms::ArrayOperations< Devices::Host, DeviceType >::copy( YL_i.getData(), Traits::getLocalVectorView( y_i ).getData(), YL_i.getSize() );
// no-op if the problem is not distributed // no-op if the problem is not distributed
CommunicatorType::Bcast( YL_i.getData(), YL_i.getSize(), 0, Traits::getCommunicationGroup( *this->matrix ) ); CommunicatorType::Bcast( YL_i.getData(), YL_i.getSize(), 0, Traits::getCommunicationGroup( *this->matrix ) );
...@@ -475,7 +475,7 @@ hauseholder_apply_trunc( HostView out, ...@@ -475,7 +475,7 @@ hauseholder_apply_trunc( HostView out,
} }
if( std::is_same< DeviceType, Devices::Cuda >::value ) { if( std::is_same< DeviceType, Devices::Cuda >::value ) {
RealType host_z[ i + 1 ]; RealType host_z[ i + 1 ];
Containers::Algorithms::ArrayOperations< Devices::Host, Devices::Cuda >::copyMemory( host_z, Traits::getLocalVectorView( z ).getData(), i + 1 ); Containers::Algorithms::ArrayOperations< Devices::Host, Devices::Cuda >::copy( host_z, Traits::getLocalVectorView( z ).getData(), i + 1 );
for( int k = 0; k <= i; k++ ) for( int k = 0; k <= i; k++ )
out[ k ] = host_z[ k ] - YL_i[ k ] * aux; out[ k ] = host_z[ k ] - YL_i[ k ] * aux;
} }
......
...@@ -83,7 +83,7 @@ TYPED_TEST( AllocatorsTest, CudaManaged ) ...@@ -83,7 +83,7 @@ TYPED_TEST( AllocatorsTest, CudaManaged )
ASSERT_NE( data, nullptr ); ASSERT_NE( data, nullptr );
// set data on the device // set data on the device
Containers::Algorithms::ArrayOperations< Devices::Cuda >::setMemory( data, (ValueType) 0, ARRAY_TEST_SIZE ); Containers::Algorithms::ArrayOperations< Devices::Cuda >::set( data, (ValueType) 0, ARRAY_TEST_SIZE );
ASSERT_NO_THROW( TNL_CHECK_CUDA_DEVICE ); ASSERT_NO_THROW( TNL_CHECK_CUDA_DEVICE );
// check values on the host // check values on the host
...@@ -103,7 +103,7 @@ TYPED_TEST( AllocatorsTest, Cuda ) ...@@ -103,7 +103,7 @@ TYPED_TEST( AllocatorsTest, Cuda )
ASSERT_NE( data, nullptr ); ASSERT_NE( data, nullptr );
// set data on the device // set data on the device
Containers::Algorithms::ArrayOperations< Devices::Cuda >::setMemory( data, (ValueType) 0, ARRAY_TEST_SIZE ); Containers::Algorithms::ArrayOperations< Devices::Cuda >::set( data, (ValueType) 0, ARRAY_TEST_SIZE );
ASSERT_NO_THROW( TNL_CHECK_CUDA_DEVICE ); ASSERT_NO_THROW( TNL_CHECK_CUDA_DEVICE );
allocator.deallocate( data, ARRAY_TEST_SIZE ); allocator.deallocate( data, ARRAY_TEST_SIZE );
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment