Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sbalzarini Lab
S
Software
P
Parallel Computing
OpenFPM
openfpm_vcluster
Commits
6e360fcb
Commit
6e360fcb
authored
Jan 29, 2016
by
Pietro Incardona
Browse files
Elinimation garbabe
parent
9803a7ad
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/Makefile.am
View file @
6e360fcb
...
...
@@ -13,7 +13,7 @@ libvcluster_a_CXXFLAGS = $(INCLUDES_PATH) $(BOOST_CPPFLAGS)
libvcluster_a_CFLAGS
=
nobase_include_HEADERS
=
MPI_wrapper/MPI_IallreduceW.hpp MPI_wrapper/MPI_IrecvW.hpp MPI_wrapper/MPI_IsendW.hpp MPI_wrapper/MPI_util.hpp MPI_wrapper/MPI_IAllGather.hpp
\
VCluster.hpp VCluster_object.hpp
VCluster_object_array.hpp VObject.hpp
\
VCluster.hpp VCluster_object.hpp
\
util/Vcluster_log.hpp
.cu.o
:
...
...
src/VCluster.hpp
View file @
6e360fcb
...
...
@@ -5,7 +5,6 @@
#include <mpi.h>
#include "MPI_wrapper/MPI_util.hpp"
#include "VCluster_object.hpp"
#include "VCluster_object_array.hpp"
#include "Vector/map_vector.hpp"
#include "MPI_wrapper/MPI_IallreduceW.hpp"
#include "MPI_wrapper/MPI_IrecvW.hpp"
...
...
@@ -308,26 +307,6 @@ public:
return
rank
;
}
/*! \brief Allocate a set of objects
*
* \tparam obj
* \param n number of object
*
* \return an object representing an array of objects
*
*/
template
<
typename
obj
>
Vcluster_object_array
<
obj
>
allocate
(
size_t
n
)
{
// Vcluster object array
Vcluster_object_array
<
obj
>
vo
;
// resize the array
vo
.
resize
(
n
);
// Create the object on memory and return a Vcluster_object_array
return
vo
;
}
/*! \brief Sum the numbers across all processors and get the result
*
* \param num to reduce, input and output
...
...
src/VCluster_object_array.hpp
deleted
100644 → 0
View file @
9803a7ad
/*
* Vcluster_object_array.hpp
*
* Created on: Feb 4, 2015
* Author: Pietro Incardona
*/
#ifndef VCLUSTER_OBJECT_ARRAY_HPP_
#define VCLUSTER_OBJECT_ARRAY_HPP_
#include <vector>
#include "VObject.hpp"
/*! \brief Encapsulate any object created by the Virtual cluster machine
*
* \tparam original object
*
*/
template
<
typename
T
>
class
Vcluster_object_array
:
public
VObject
{
std
::
vector
<
T
>
objects
;
public:
/*! \brief Constructor of object array
*
*/
Vcluster_object_array
()
{
}
/*! \brief Return the size of the objects array
*
* \return the size of the array
*
*/
size_t
size
()
const
{
return
objects
.
size
();
}
/*! \brief Return the element i
*
* \return a reference to the object i
*
*/
T
&
get
(
unsigned
int
i
)
{
return
objects
[
i
];
}
/*! \brief Return the element i
*
* \return a reference to the object i
*
*/
const
T
&
get
(
unsigned
int
i
)
const
{
return
objects
[
i
];
}
/*! \brief Check if this Object is an array
*
* \return true, it is an array
*
*/
bool
isArray
()
{
return
true
;
}
/*! \brief Destroy the object
*
*/
virtual
void
destroy
()
{
// Destroy the objects
objects
.
clear
();
}
/*! \brief Get the size of the memory needed to pack the object
*
* \return the size of the message to pack the object
*
*/
size_t
packObjectSize
()
{
size_t
message
=
0
;
// Destroy each objects
for
(
size_t
i
=
0
;
i
<
objects
.
size
()
;
i
++
)
{
message
+=
objects
[
i
].
packObjectSize
();
}
return
message
;
}
/*! \brief Get the size of the memory needed to pack the object
*
* \param Memory where to write the packed object
*
* \return the size of the message to pack the object
*
*/
size_t
packObject
(
void
*
mem
)
{
// Pointer is zero
size_t
ptr
=
0
;
unsigned
char
*
m
=
(
unsigned
char
*
)
mem
;
// pack each object
for
(
size_t
i
=
0
;
i
<
objects
.
size
()
;
i
++
)
{
ptr
+=
objects
[
i
].
packObject
(
&
m
[
ptr
]);
}
#ifdef DEBUG
if
(
ptr
!=
packObjectSize
())
{
std
::
cerr
<<
"Error "
<<
__FILE__
<<
" "
<<
__LINE__
<<
" the pack object size does not match the message"
<<
"
\n
"
;
}
#endif
return
ptr
;
}
/*! \brief Calculate the size to pack an object in the array
*
* \param array object index
*
*/
size_t
packObjectInArraySize
(
size_t
i
)
{
return
objects
[
i
].
packObjectSize
();
}
/*! \brief pack the object in the array (the message produced can be used to move one)
* object from one processor to another
*
* \param i index of the object to pack
* \param p Memory of the packed object message
*
*/
size_t
packObjectInArray
(
size_t
i
,
void
*
p
)
{
return
objects
[
i
].
packObject
(
p
);
}
/*! \brief Destroy an object from the array
*
* \param i object to destroy
*
*/
void
destroy
(
size_t
i
)
{
objects
.
erase
(
objects
.
begin
()
+
i
);
}
/*! \brief Return the object j in the array
*
* \param j element j
*
*/
T
&
operator
[](
size_t
j
)
{
return
objects
[
j
];
}
/*! \brief Return the object j in the array
*
* \param j element j
*
*/
const
T
&
operator
[](
size_t
j
)
const
{
return
objects
[
j
];
}
/*! \brief Resize the array
*
* \param size
*
*/
void
resize
(
size_t
n
)
{
objects
.
resize
(
n
);
}
};
#endif
/* VCLUSTER_OBJECT_HPP_ */
src/VObject.hpp
deleted
100644 → 0
View file @
9803a7ad
/*
* VObject.hpp
*
* Created on: Feb 5, 2015
* Author: i-bird
*/
#ifndef VOBJECT_HPP_
#define VOBJECT_HPP_
/*! \brief VObject
*
* Any object produced by the Virtual cluster (MUST) inherit this class
*
*/
class
VObject
{
public:
// Check if this Object is an array
virtual
bool
isArray
()
=
0
;
// destroy the object
virtual
void
destroy
()
=
0
;
// get the size of the memory needed to pack the object
virtual
size_t
packObjectSize
()
=
0
;
// pack the object
virtual
size_t
packObject
(
void
*
)
=
0
;
// get the size of the memory needed to pack the object in the array
virtual
size_t
packObjectInArraySize
(
size_t
i
)
=
0
;
// pack the object in the array (the message produced can be used to move one)
// object from one processor to another
virtual
size_t
packObjectInArray
(
size_t
i
,
void
*
p
)
=
0
;
// destroy an element from the array
virtual
void
destroy
(
size_t
n
)
=
0
;
};
#endif
/* VOBJECT_HPP_ */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment