monolish  0.17.3-dev.16
MONOlithic LInear equation Solvers for Highly-parallel architecture
Public Member Functions | Private Attributes | List of all members
monolish::view1D< TYPE, Float > Class Template Reference

1D view class More...

#include <monolish_view1D.hpp>

Collaboration diagram for monolish::view1D< TYPE, Float >:
Collaboration graph

Public Member Functions

Float * begin ()
 returns begin iterator (include offset) More...
 
Float * begin () const
 returns begin iterator (include offset) More...
 
Float * data ()
 returns a direct pointer to the vector (dont include offset) More...
 
Float * data () const
 returns a direct pointer to the original vector (dont include offset) More...
 
Float * end ()
 returns a end iterator More...
 
Float * end () const
 returns a end iterator More...
 
void fill (Float value)
 fill vector elements with a scalar value More...
 
size_t get_alloc_nnz () const
 
size_t get_device_mem_stat () const
 true: sended, false: not send More...
 
size_t get_first () const
 get first position More...
 
size_t get_last () const
 get end position More...
 
size_t get_nnz () const
 get view1D size (same as size()) More...
 
size_t get_offset () const
 get first position (same as get_first()) More...
 
std::shared_ptr< Float > get_val () const
 
void operator= (const std::vector< Float > &vec)
 copy vector from std::vector More...
 
void operator= (const vector< Float > &vec)
 copy vector, It is same as copy ( Copy the memory on CPU and GPU ) More...
 
void operator= (const view1D< matrix::Dense< Float >, Float > &vec)
 copy vector, It is same as copy ( Copy the memory on CPU and GPU ) More...
 
void operator= (const view1D< tensor::tensor_Dense< Float >, Float > &vec)
 copy vector, It is same as copy ( Copy the memory on CPU and GPU ) More...
 
void operator= (const view1D< vector< Float >, Float > &vec)
 copy vector, It is same as copy ( Copy the memory on CPU and GPU ) More...
 
Float & operator[] (const size_t i)
 reference to the element at position More...
 
void print_all (bool force_cpu=false) const
 print all elements to standart I/O More...
 
void recv ()
 recv data from GPU, and free data on GPU More...
 
void resize (size_t N)
 change last postion More...
 
void send () const
 send data to GPU More...
 
void set_first (size_t i)
 change first position More...
 
void set_last (size_t i)
 change last position More...
 
size_t size () const
 get view1D size (range) More...
 
std::string type () const
 get format name "view1D" More...
 
 view1D (matrix::Dense< Float > &A, const size_t start, const size_t size)
 create view1D(start:start+range) from Dense matrix More...
 
 view1D (tensor::tensor_Dense< Float > &A, const size_t start, const size_t size)
 create view1D(start:start+range) from Dense tensor More...
 
 view1D (vector< Float > &x, const size_t start, const size_t size)
 create view1D(start:start+range) from vector More...
 
 view1D (view1D< matrix::Dense< Float >, Float > &x, const size_t start, const size_t size)
 create view1D(start:start+range) from monolish::matrix::Dense More...
 
 view1D (view1D< tensor::tensor_Dense< Float >, Float > &x, const size_t start, const size_t size)
 create view1D(start:start+range) from monolish::tensor::tensor_Dense More...
 
 view1D (view1D< vector< Float >, Float > &x, const size_t start, const size_t size)
 create view1D(start:start+range) from monolish::vector More...
 

Private Attributes

size_t first
 
size_t last
 
size_t range
 
TYPE & target
 
Float * target_data
 

Detailed Description

template<typename TYPE, typename Float>
class monolish::view1D< TYPE, Float >

1D view class

Note
  • Multi-threading: true
  • GPU acceleration: true

Definition at line 50 of file monolish_view1D.hpp.

Constructor & Destructor Documentation

◆ view1D() [1/6]

template<typename TYPE , typename Float >
monolish::view1D< TYPE, Float >::view1D ( vector< Float > &  x,
const size_t  start,
const size_t  size 
)
inline

create view1D(start:start+range) from vector

Parameters
xvector
startstart position
sizesize
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 69 of file monolish_view1D.hpp.

Here is the call graph for this function:

◆ view1D() [2/6]

template<typename TYPE , typename Float >
monolish::view1D< TYPE, Float >::view1D ( matrix::Dense< Float > &  A,
const size_t  start,
const size_t  size 
)
inline

create view1D(start:start+range) from Dense matrix

Parameters
ADense matrix
startstart position
sizesize
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 86 of file monolish_view1D.hpp.

Here is the call graph for this function:

◆ view1D() [3/6]

template<typename TYPE , typename Float >
monolish::view1D< TYPE, Float >::view1D ( tensor::tensor_Dense< Float > &  A,
const size_t  start,
const size_t  size 
)
inline

create view1D(start:start+range) from Dense tensor

Parameters
ADense matrix
startstart position
sizesize
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 104 of file monolish_view1D.hpp.

Here is the call graph for this function:

◆ view1D() [4/6]

template<typename TYPE , typename Float >
monolish::view1D< TYPE, Float >::view1D ( view1D< vector< Float >, Float > &  x,
const size_t  start,
const size_t  size 
)
inline

create view1D(start:start+range) from monolish::vector

Parameters
xview1D create from monolish::vector
startstart position (x.first + start)
sizesize
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 122 of file monolish_view1D.hpp.

Here is the call graph for this function:

◆ view1D() [5/6]

template<typename TYPE , typename Float >
monolish::view1D< TYPE, Float >::view1D ( view1D< matrix::Dense< Float >, Float > &  x,
const size_t  start,
const size_t  size 
)
inline

create view1D(start:start+range) from monolish::matrix::Dense

Parameters
xview1D create from monolish::matrix::Dense
startstart position (x.first + start)
sizesize
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 140 of file monolish_view1D.hpp.

Here is the call graph for this function:

◆ view1D() [6/6]

template<typename TYPE , typename Float >
monolish::view1D< TYPE, Float >::view1D ( view1D< tensor::tensor_Dense< Float >, Float > &  x,
const size_t  start,
const size_t  size 
)
inline

create view1D(start:start+range) from monolish::tensor::tensor_Dense

Parameters
xview1D create from monolish::tensor::tensor_Dense
startstart position (x.first + start)
sizesize
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 159 of file monolish_view1D.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ begin() [1/2]

template<typename TYPE , typename Float >
Float* monolish::view1D< TYPE, Float >::begin ( )
inline

returns begin iterator (include offset)

Returns
A pointer to the first element
Note
  • # of computation: 1

Definition at line 303 of file monolish_view1D.hpp.

Here is the call graph for this function:

◆ begin() [2/2]

template<typename TYPE , typename Float >
Float* monolish::view1D< TYPE, Float >::begin ( ) const
inline

returns begin iterator (include offset)

Returns
A pointer to the first element
Note
  • # of computation: 1

Definition at line 295 of file monolish_view1D.hpp.

Here is the call graph for this function:

◆ data() [1/2]

template<typename TYPE , typename Float >
Float* monolish::view1D< TYPE, Float >::data ( )
inline

returns a direct pointer to the vector (dont include offset)

Returns
A pointer to the first element
Note
  • # of computation: 1

Definition at line 287 of file monolish_view1D.hpp.

◆ data() [2/2]

template<typename TYPE , typename Float >
Float* monolish::view1D< TYPE, Float >::data ( ) const
inline

returns a direct pointer to the original vector (dont include offset)

Returns
A pointer to the first element
Note
  • # of computation: 1

Definition at line 279 of file monolish_view1D.hpp.

◆ end() [1/2]

template<typename TYPE , typename Float >
Float* monolish::view1D< TYPE, Float >::end ( )
inline

returns a end iterator

Returns
end iterator
Note
  • # of computation: 1

Definition at line 319 of file monolish_view1D.hpp.

◆ end() [2/2]

template<typename TYPE , typename Float >
Float* monolish::view1D< TYPE, Float >::end ( ) const
inline

returns a end iterator

Returns
end iterator
Note
  • # of computation: 1

Definition at line 311 of file monolish_view1D.hpp.

◆ fill()

template<typename TYPE , typename Float >
void monolish::view1D< TYPE, Float >::fill ( Float  value)

fill vector elements with a scalar value

Parameters
valuescalar value
Note
  • # of computation: N
  • Multi-threading: true
  • GPU acceleration: true

◆ get_alloc_nnz()

template<typename TYPE , typename Float >
size_t monolish::view1D< TYPE, Float >::get_alloc_nnz ( ) const
inline

Definition at line 241 of file monolish_view1D.hpp.

◆ get_device_mem_stat()

template<typename TYPE , typename Float >
size_t monolish::view1D< TYPE, Float >::get_device_mem_stat ( ) const
inline

true: sended, false: not send

Returns
gpu status
Note
  • # of data transfer: 0
  • Multi-threading: false
  • GPU acceleration: true

Definition at line 268 of file monolish_view1D.hpp.

◆ get_first()

template<typename TYPE , typename Float >
size_t monolish::view1D< TYPE, Float >::get_first ( ) const
inline

get first position

Returns
first position
Note
  • # of computation: 1

Definition at line 221 of file monolish_view1D.hpp.

◆ get_last()

template<typename TYPE , typename Float >
size_t monolish::view1D< TYPE, Float >::get_last ( ) const
inline

get end position

Returns
end position
Note
  • # of computation: 1

Definition at line 229 of file monolish_view1D.hpp.

◆ get_nnz()

template<typename TYPE , typename Float >
size_t monolish::view1D< TYPE, Float >::get_nnz ( ) const
inline

get view1D size (same as size())

Returns
view1D size
Note
  • # of computation: 1

Definition at line 213 of file monolish_view1D.hpp.

◆ get_offset()

template<typename TYPE , typename Float >
size_t monolish::view1D< TYPE, Float >::get_offset ( ) const
inline

get first position (same as get_first())

Returns
first position
Note
  • # of computation: 1

Definition at line 237 of file monolish_view1D.hpp.

Here is the caller graph for this function:

◆ get_val()

template<typename TYPE , typename Float >
std::shared_ptr<Float> monolish::view1D< TYPE, Float >::get_val ( ) const
inline

Definition at line 239 of file monolish_view1D.hpp.

◆ operator=() [1/5]

template<typename TYPE , typename Float >
void monolish::view1D< TYPE, Float >::operator= ( const std::vector< Float > &  vec)

copy vector from std::vector

Parameters
vecsource std::vector
Returns
output vector
Note
  • # of computation: N
  • Multi-threading: true
  • GPU acceleration: false

◆ operator=() [2/5]

template<typename TYPE , typename Float >
void monolish::view1D< TYPE, Float >::operator= ( const vector< Float > &  vec)

copy vector, It is same as copy ( Copy the memory on CPU and GPU )

Parameters
vecsource vector
Returns
output vector
Note
  • # of computation: N
  • Multi-threading: false
  • GPU acceleration: true
    • # of data transfer: 0
      • if gpu_statius == true; coping data on GPU
      • else; coping data on CPU

◆ operator=() [3/5]

template<typename TYPE , typename Float >
void monolish::view1D< TYPE, Float >::operator= ( const view1D< matrix::Dense< Float >, Float > &  vec)

copy vector, It is same as copy ( Copy the memory on CPU and GPU )

Parameters
vecsource view1D from monolish::matrix::Dense
Returns
output vector
Note
  • # of computation: N
  • Multi-threading: false
  • GPU acceleration: true
    • # of data transfer: 0
      • if gpu_statius == true; coping data on GPU
      • else; coping data on CPU

◆ operator=() [4/5]

template<typename TYPE , typename Float >
void monolish::view1D< TYPE, Float >::operator= ( const view1D< tensor::tensor_Dense< Float >, Float > &  vec)

copy vector, It is same as copy ( Copy the memory on CPU and GPU )

Parameters
vecsource view1D from monolish::tensor::tensor_Dense
Returns
output vector
Note
  • # of computation: N
  • Multi-threading: false
  • GPU acceleration: true
    • # of data transfer: 0
      • if gpu_statius == true; coping data on GPU
      • else; coping data on CPU

◆ operator=() [5/5]

template<typename TYPE , typename Float >
void monolish::view1D< TYPE, Float >::operator= ( const view1D< vector< Float >, Float > &  vec)

copy vector, It is same as copy ( Copy the memory on CPU and GPU )

Parameters
vecsource view1D from monolish::vector
Returns
output vector
Note
  • # of computation: N
  • Multi-threading: false
  • GPU acceleration: true
    • # of data transfer: 0
      • if gpu_statius == true; coping data on GPU
      • else; coping data on CPU

◆ operator[]()

template<typename TYPE , typename Float >
Float& monolish::view1D< TYPE, Float >::operator[] ( const size_t  i)
inline

reference to the element at position

Parameters
iPosition of an element in the vector
Returns
vector element (v[i])
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 436 of file monolish_view1D.hpp.

◆ print_all()

template<typename TYPE , typename Float >
void monolish::view1D< TYPE, Float >::print_all ( bool  force_cpu = false) const

print all elements to standart I/O

Parameters
force_cpuIgnore device status and output CPU data
Note
  • # of computation: end-start
  • Multi-threading: false
  • GPU acceleration: true (doesn't work in parallel)

◆ recv()

template<typename TYPE , typename Float >
void monolish::view1D< TYPE, Float >::recv ( )
inline

recv data from GPU, and free data on GPU

Note
  • # of data transfer: N
  • Multi-threading: false
  • GPU acceleration: true

Definition at line 197 of file monolish_view1D.hpp.

◆ resize()

template<typename TYPE , typename Float >
void monolish::view1D< TYPE, Float >::resize ( size_t  N)
inline

change last postion

Parameters
Nvector length
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: true
Warning
Cannot be resized beyond the range of the referenced vector

Definition at line 351 of file monolish_view1D.hpp.

◆ send()

template<typename TYPE , typename Float >
void monolish::view1D< TYPE, Float >::send ( ) const
inline

send data to GPU

Note
  • # of data transfer: N
  • Multi-threading: false
  • GPU acceleration: true

Definition at line 188 of file monolish_view1D.hpp.

◆ set_first()

template<typename TYPE , typename Float >
void monolish::view1D< TYPE, Float >::set_first ( size_t  i)
inline

change first position

Note
  • # of computation: 1

Definition at line 248 of file monolish_view1D.hpp.

◆ set_last()

template<typename TYPE , typename Float >
void monolish::view1D< TYPE, Float >::set_last ( size_t  i)
inline

change last position

Note
  • # of computation: 1

Definition at line 255 of file monolish_view1D.hpp.

◆ size()

template<typename TYPE , typename Float >
size_t monolish::view1D< TYPE, Float >::size ( ) const
inline

get view1D size (range)

Returns
view1D size
Note
  • # of computation: 1

Definition at line 205 of file monolish_view1D.hpp.

Here is the caller graph for this function:

◆ type()

template<typename TYPE , typename Float >
std::string monolish::view1D< TYPE, Float >::type ( ) const
inline

get format name "view1D"

Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 175 of file monolish_view1D.hpp.

Member Data Documentation

◆ first

template<typename TYPE , typename Float >
size_t monolish::view1D< TYPE, Float >::first
private

Definition at line 54 of file monolish_view1D.hpp.

◆ last

template<typename TYPE , typename Float >
size_t monolish::view1D< TYPE, Float >::last
private

Definition at line 55 of file monolish_view1D.hpp.

◆ range

template<typename TYPE , typename Float >
size_t monolish::view1D< TYPE, Float >::range
private

Definition at line 56 of file monolish_view1D.hpp.

◆ target

template<typename TYPE , typename Float >
TYPE& monolish::view1D< TYPE, Float >::target
private

Definition at line 52 of file monolish_view1D.hpp.

◆ target_data

template<typename TYPE , typename Float >
Float* monolish::view1D< TYPE, Float >::target_data
private

Definition at line 53 of file monolish_view1D.hpp.


The documentation for this class was generated from the following files: