monolish  0.14.0
MONOlithic LIner equation Solvers for Highly-parallel architecture
Public Member Functions | Private Attributes | List of all members
monolish::vector< Float > Class Template Reference

vector class More...

#include <monolish_coo.hpp>

Collaboration diagram for monolish::vector< Float >:
Collaboration graph

Public Member Functions

Float * begin ()
 returns a begin iterator More...
 
const Float * begin () const
 returns a begin iterator More...
 
Float * data ()
 returns a direct pointer to the vector More...
 
const Float * data () const
 returns a direct pointer to the vector More...
 
void device_free () const
 free data on GPU More...
 
Float * end ()
 returns a end iterator More...
 
const Float * end () const
 returns a end iterator More...
 
bool equal (const vector< Float > &vec, bool compare_cpu_and_device=false) const
 Comparing matricies (A == mat) More...
 
bool equal (const view1D< matrix::Dense< Float >, Float > &vec, bool compare_cpu_and_device=false) const
 Comparing matricies (A == mat) More...
 
bool equal (const view1D< vector< Float >, Float > &vec, bool compare_cpu_and_device=false) const
 Comparing matricies (A == mat) More...
 
void fill (Float value)
 fill vector elements with a scalar value More...
 
bool get_device_mem_stat () const
 true: sended, false: not send More...
 
auto get_nnz () const
 get vector size More...
 
size_t get_offset () const
 
void nonfree_recv ()
 recv data from GPU (w/o free) More...
 
bool operator!= (const vector< Float > &vec) const
 Comparing vectors (v != vec) More...
 
bool operator!= (const view1D< matrix::Dense< Float >, Float > &vec) const
 Comparing vectors (v != vec) More...
 
bool operator!= (const view1D< vector< Float >, Float > &vec) const
 Comparing vectors (v != vec) More...
 
vector< Float > operator- ()
 Sign inversion. More...
 
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< vector< Float >, Float > &vec)
 copy vector, It is same as copy ( Copy the memory on CPU and GPU ) More...
 
bool operator== (const vector< Float > &vec) const
 Comparing vectors (v == vec) More...
 
bool operator== (const view1D< matrix::Dense< Float >, Float > &vec) const
 Comparing vectors (v == vec) More...
 
bool operator== (const view1D< vector< Float >, Float > &vec) const
 Comparing vectors (v == vec) More...
 
Float & operator[] (size_t i)
 refetrence to the element at position (v[i]) More...
 
void print_all (bool force_cpu=false) const
 print all elements to standart I/O More...
 
void print_all (std::string filename) const
 print all elements to file More...
 
void push_back (Float val)
 Add a new element at the end of the vector (only CPU) More...
 
void recv ()
 recv data from GPU, and free data on GPU More...
 
void resize (size_t N)
 resize vector (only CPU) More...
 
void send () const
 send data to GPU More...
 
auto size () const
 get vector size More...
 
 vector ()
 
 vector (const Float *start, const Float *end)
 copy from pointer More...
 
 vector (const size_t N)
 allocate size N vector More...
 
 vector (const size_t N, const Float min, const Float max)
 create N length rand(min~max) vector More...
 
 vector (const size_t N, const Float value)
 initialize size N vector, value to fill the container More...
 
 vector (const std::initializer_list< Float > &list)
 copy from initializer_list More...
 
 vector (const std::vector< Float > &vec)
 copy from std::vector More...
 
 vector (const vector< Float > &vec)
 copy from monolish::vector More...
 
 vector (const view1D< matrix::Dense< Float >, Float > &vec)
 copy from monolish::view1D from monolish::matrix::Dense More...
 
 vector (const view1D< vector< Float >, Float > &vec)
 copy from monolish::view1D from vector More...
 
 ~vector ()
 destructor of vector, free GPU memory More...
 

Private Attributes

bool gpu_status = false
 true: sended, false: not send More...
 
std::vector< Float > val
 size N vector data More...
 

Detailed Description

template<typename Float>
class monolish::vector< Float >

vector class

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

Definition at line 25 of file monolish_coo.hpp.

Constructor & Destructor Documentation

◆ vector() [1/10]

template<typename Float >
monolish::vector< Float >::vector ( )
inline

Definition at line 49 of file monolish_vector.hpp.

◆ vector() [2/10]

template<typename T >
template monolish::vector< Float >::vector ( const size_t  N)

allocate size N vector

Parameters
Nvector length
Note
  • # of computation: N
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 8 of file vector_constructor.cpp.

Here is the call graph for this function:

◆ vector() [3/10]

template<typename Float >
monolish::vector< Float >::vector ( const size_t  N,
const Float  value 
)

initialize size N vector, value to fill the container

Parameters
Nvector length
valuefill Float type value to all elements
Note
  • # of computation: N
  • Multi-threading: false
  • GPU acceleration: false

◆ vector() [4/10]

template<typename Float >
monolish::vector< Float >::vector ( const std::vector< Float > &  vec)

copy from std::vector

Parameters
vecinput std::vector
Note
  • # of computation: N
  • Multi-threading: false
  • GPU acceleration: false

◆ vector() [5/10]

template<typename Float >
monolish::vector< Float >::vector ( const std::initializer_list< Float > &  list)

copy from initializer_list

Parameters
listinput initializer_list
Note
  • # of computation: N
  • Multi-threading: false
  • GPU acceleration: false

◆ vector() [6/10]

template<typename Float >
monolish::vector< Float >::vector ( const vector< Float > &  vec)

copy from monolish::vector

Parameters
vecinput monolish::vector
Note
  • # of computation: N
  • Multi-threading: true
  • GPU acceleration: true
    • # of data transfer: N (only allocation)
      • if gpu_status == true; coping data on CPU and GPU respectively
      • else; coping data only on CPU

◆ vector() [7/10]

template<typename Float >
monolish::vector< Float >::vector ( const view1D< vector< Float >, Float > &  vec)

copy from monolish::view1D from vector

Parameters
vecinput monolish::view1D from vector
Note
  • # of computation: N
  • Multi-threading: true
  • GPU acceleration: true
    • # of data transfer: N (only allocation)
      • if gpu_status == true; coping data on CPU and GPU respectively
      • else; coping data only on CPU

◆ vector() [8/10]

template<typename Float >
monolish::vector< Float >::vector ( const view1D< matrix::Dense< Float >, Float > &  vec)

copy from monolish::view1D from monolish::matrix::Dense

Parameters
vecinput monolish::view1D from monolish::matrix::Dense
Note
  • # of computation: N
  • Multi-threading: true
  • GPU acceleration: true
    • # of data transfer: N (only allocation)
      • if gpu_status == true; coping data on CPU and GPU respectively
      • else; coping data only on CPU

◆ vector() [9/10]

template<typename Float >
monolish::vector< Float >::vector ( const Float *  start,
const Float *  end 
)

copy from pointer

Parameters
startstart pointer
endend pointer
Note
  • # of computation: N
  • Multi-threading: false
  • GPU acceleration: false

◆ vector() [10/10]

template<typename Float >
monolish::vector< Float >::vector ( const size_t  N,
const Float  min,
const Float  max 
)

create N length rand(min~max) vector

Parameters
Nvector length
minrand min
maxrand max
Note
  • # of computation: N
  • Multi-threading: true
  • GPU acceleration: false

◆ ~vector()

template<typename Float >
monolish::vector< Float >::~vector ( )
inline

destructor of vector, free GPU memory

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

Definition at line 213 of file monolish_vector.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ begin() [1/2]

template<typename Float >
Float* monolish::vector< Float >::begin ( )
inline

returns a begin iterator

Returns
begin iterator
Note
  • # of computation: 1

Definition at line 282 of file monolish_vector.hpp.

◆ begin() [2/2]

template<typename Float >
const Float* monolish::vector< Float >::begin ( ) const
inline

returns a begin iterator

Returns
begin iterator
Note
  • # of computation: 1

Definition at line 274 of file monolish_vector.hpp.

◆ data() [1/2]

template<typename Float >
Float* monolish::vector< Float >::data ( )
inline

returns a direct pointer to the vector

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

Definition at line 238 of file monolish_vector.hpp.

◆ data() [2/2]

template<typename Float >
const Float* monolish::vector< Float >::data ( ) const
inline

returns a direct pointer to the vector

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

Definition at line 230 of file monolish_vector.hpp.

Here is the caller graph for this function:

◆ device_free()

template<typename T >
template void monolish::vector< Float >::device_free ( ) const

free data on GPU

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

Definition at line 60 of file gpu_comm.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ end() [1/2]

template<typename Float >
Float* monolish::vector< Float >::end ( )
inline

returns a end iterator

Returns
end iterator
Note
  • # of computation: 1

Definition at line 298 of file monolish_vector.hpp.

Here is the call graph for this function:

◆ end() [2/2]

template<typename Float >
const Float* monolish::vector< Float >::end ( ) const
inline

returns a end iterator

Returns
end iterator
Note
  • # of computation: 1

Definition at line 290 of file monolish_vector.hpp.

Here is the call graph for this function:

◆ equal() [1/3]

template<typename Float >
bool monolish::vector< Float >::equal ( const vector< Float > &  vec,
bool  compare_cpu_and_device = false 
) const

Comparing matricies (A == mat)

Parameters
vecvector
compare_cpu_and_devicecompare data on both CPU and GPU
Returns
true or false
Note
  • # of computation: N
  • Multi-threading: true
  • GPU acceleration: true

◆ equal() [2/3]

template<typename Float >
bool monolish::vector< Float >::equal ( const view1D< matrix::Dense< Float >, Float > &  vec,
bool  compare_cpu_and_device = false 
) const

Comparing matricies (A == mat)

Parameters
vecvieq1D from monolish::matrix::Dense
compare_cpu_and_devicecompare data on both CPU and GPU
Returns
true or false
Note
  • # of computation: N
  • Multi-threading: true
  • GPU acceleration: true

◆ equal() [3/3]

template<typename Float >
bool monolish::vector< Float >::equal ( const view1D< vector< Float >, Float > &  vec,
bool  compare_cpu_and_device = false 
) const

Comparing matricies (A == mat)

Parameters
vecview1D from monolish::vector
compare_cpu_and_devicecompare data on both CPU and GPU
Returns
true or false
Note
  • # of computation: N
  • Multi-threading: true
  • GPU acceleration: true

◆ fill()

template<typename Float >
template void monolish::vector< Float >::fill ( Float  value)

fill vector elements with a scalar value

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

Definition at line 9 of file fill_vector.cpp.

Here is the call graph for this function:

◆ get_device_mem_stat()

template<typename Float >
bool monolish::vector< 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 204 of file monolish_vector.hpp.

Here is the caller graph for this function:

◆ get_nnz()

template<typename Float >
auto monolish::vector< Float >::get_nnz ( ) const
inline

get vector size

Returns
vector size
Note
  • # of computation: 1

Definition at line 314 of file monolish_vector.hpp.

◆ get_offset()

template<typename Float >
size_t monolish::vector< Float >::get_offset ( ) const
inline

Definition at line 219 of file monolish_vector.hpp.

◆ nonfree_recv()

template<typename T >
template void monolish::vector< Float >::nonfree_recv ( )

recv data from GPU (w/o free)

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

Definition at line 45 of file gpu_comm.cpp.

Here is the call graph for this function:

◆ operator!=() [1/3]

template<typename Float >
bool monolish::vector< Float >::operator!= ( const vector< Float > &  vec) const

Comparing vectors (v != vec)

Parameters
vecvector (size N)
Returns
true or false
Note
  • # of computation: N
  • Multi-threading: true
  • GPU acceleration: true
    • if gpu_status == true; compare data on GPU
    • else; compare data on CPU

◆ operator!=() [2/3]

template<typename Float >
bool monolish::vector< Float >::operator!= ( const view1D< matrix::Dense< Float >, Float > &  vec) const

Comparing vectors (v != vec)

Parameters
vecvector (size N)
Returns
true or false
Note
  • # of computation: N
  • Multi-threading: true
  • GPU acceleration: true
    • if gpu_status == true; compare data on GPU
    • else; compare data on CPU

◆ operator!=() [3/3]

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

Comparing vectors (v != vec)

Parameters
vecvector (size N)
Returns
true or false
Note
  • # of computation: N
  • Multi-threading: true
  • GPU acceleration: true
    • if gpu_status == true; compare data on GPU
    • else; compare data on CPU

◆ operator-()

template<typename T >
template vector< float > monolish::vector< Float >::operator- ( )

Sign inversion.

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

Definition at line 8 of file vector_minus.cpp.

Here is the call graph for this function:

◆ operator=() [1/4]

template<typename Float >
void monolish::vector< 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/4]

template<typename Float >
void monolish::vector< 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/4]

template<typename Float >
void monolish::vector< 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/4]

template<typename Float >
void monolish::vector< 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==() [1/3]

template<typename Float >
bool monolish::vector< Float >::operator== ( const vector< Float > &  vec) const

Comparing vectors (v == vec)

Parameters
vecvector (size N)
Returns
true or false
Note
  • # of computation: N
  • Multi-threading: true
  • GPU acceleration: true
    • if gpu_status == true; compare data on GPU
    • else; compare data on CPU

◆ operator==() [2/3]

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

Comparing vectors (v == vec)

Parameters
vecview1D from monolish::matrix::Dense (size N)
Returns
true or false
Note
  • # of computation: N
  • Multi-threading: true
  • GPU acceleration: true
    • if gpu_status == true; compare data on GPU
    • else; compare data on CPU

◆ operator==() [3/3]

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

Comparing vectors (v == vec)

Parameters
vecview1D from monolish::vector (size N)
Returns
true or false
Note
  • # of computation: N
  • Multi-threading: true
  • GPU acceleration: true
    • if gpu_status == true; compare data on GPU
    • else; compare data on CPU

◆ operator[]()

template<typename Float >
Float& monolish::vector< Float >::operator[] ( size_t  i)
inline

refetrence to the element at position (v[i])

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 421 of file monolish_vector.hpp.

Here is the call graph for this function:

◆ print_all() [1/2]

template<typename T >
template void monolish::vector< 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: N
  • Multi-threading: false
  • GPU acceleration: true (doesn't work in parallel)

Definition at line 17 of file IO_vector.cpp.

Here is the call graph for this function:

◆ print_all() [2/2]

template<typename T >
template void monolish::vector< Float >::print_all ( std::string  filename) const

print all elements to file

Parameters
filenameoutput filename
Note
  • # of computation: N
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 45 of file IO_vector.cpp.

Here is the call graph for this function:

◆ push_back()

template<typename Float >
void monolish::vector< Float >::push_back ( Float  val)
inline

Add a new element at the end of the vector (only CPU)

Parameters
valnew element
Note
  • # of computation: 1

Definition at line 261 of file monolish_vector.hpp.

Here is the call graph for this function:

◆ recv()

template<typename T >
template void monolish::vector< Float >::recv ( )

recv data from GPU, and free data on GPU

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

Definition at line 27 of file gpu_comm.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resize()

template<typename Float >
void monolish::vector< Float >::resize ( size_t  N)
inline

resize vector (only CPU)

Parameters
Nvector length
Note
  • # of computation: N
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 248 of file monolish_vector.hpp.

Here is the call graph for this function:

◆ send()

template<typename T >
template void monolish::vector< Float >::send ( ) const

send data to GPU

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

Definition at line 8 of file gpu_comm.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ size()

template<typename Float >
auto monolish::vector< Float >::size ( ) const
inline

get vector size

Returns
vector size
Note
  • # of computation: 1

Definition at line 306 of file monolish_vector.hpp.

Here is the caller graph for this function:

Member Data Documentation

◆ gpu_status

template<typename Float >
bool monolish::vector< Float >::gpu_status = false
mutableprivate

true: sended, false: not send

Definition at line 46 of file monolish_vector.hpp.

◆ val

template<typename Float >
std::vector<Float> monolish::vector< Float >::val
private

size N vector data

Definition at line 41 of file monolish_vector.hpp.


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