Commit bab62b83 authored by Yaroslav's avatar Yaroslav

Cell list bal. and mem. with no pointers

parent 328de551
<doxygenlayout version="1.0">
<!-- Generated by doxygen 1.8.6 -->
<!-- Navigation index tabs for HTML output -->
<navindex>
<tab type="mainpage" visible="yes" title=""/>
<tab type="pages" visible="yes" title="" intro=""/>
<tab type="modules" visible="yes" title="" intro=""/>
<tab type="namespaces" visible="yes" title="">
<tab type="namespacelist" visible="yes" title="" intro=""/>
<tab type="namespacemembers" visible="yes" title="" intro=""/>
</tab>
<tab type="classes" visible="yes" title="">
<tab type="classlist" visible="yes" title="" intro=""/>
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="hierarchy" visible="yes" title="" intro=""/>
<tab type="classmembers" visible="yes" title="" intro=""/>
</tab>
<tab type="files" visible="yes" title="">
<tab type="filelist" visible="yes" title="" intro=""/>
<tab type="globals" visible="yes" title="" intro=""/>
</tab>
<tab type="examples" visible="yes" title="" intro=""/>
</navindex>
<!-- Layout definition for a class page -->
<class>
<briefdescription visible="yes"/>
<detaileddescription title=""/>
<includes visible="$SHOW_INCLUDE_FILES"/>
<inheritancegraph visible="$CLASS_GRAPH"/>
<collaborationgraph visible="$COLLABORATION_GRAPH"/>
<memberdecl>
<nestedclasses visible="yes" title=""/>
<publictypes title=""/>
<services title=""/>
<interfaces title=""/>
<publicslots title=""/>
<signals title=""/>
<publicmethods title=""/>
<publicstaticmethods title=""/>
<publicattributes title=""/>
<publicstaticattributes title=""/>
<protectedtypes title=""/>
<protectedslots title=""/>
<protectedmethods title=""/>
<protectedstaticmethods title=""/>
<protectedattributes title=""/>
<protectedstaticattributes title=""/>
<packagetypes title=""/>
<packagemethods title=""/>
<packagestaticmethods title=""/>
<packageattributes title=""/>
<packagestaticattributes title=""/>
<properties title=""/>
<events title=""/>
<privatetypes title=""/>
<privateslots title=""/>
<privatemethods title=""/>
<privatestaticmethods title=""/>
<privateattributes title=""/>
<privatestaticattributes title=""/>
<friends title=""/>
<related title="" subtitle=""/>
<membergroups visible="yes"/>
</memberdecl>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<enums title=""/>
<services title=""/>
<interfaces title=""/>
<constructors title=""/>
<functions title=""/>
<related title=""/>
<variables title=""/>
<properties title=""/>
<events title=""/>
</memberdef>
<allmemberslink visible="yes"/>
<usedfiles visible="$SHOW_USED_FILES"/>
<authorsection visible="yes"/>
</class>
<!-- Layout definition for a namespace page -->
<namespace>
<briefdescription visible="yes"/>
<memberdecl>
<nestednamespaces visible="yes" title=""/>
<constantgroups visible="yes" title=""/>
<classes visible="yes" title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
</memberdef>
<authorsection visible="yes"/>
</namespace>
<!-- Layout definition for a file page -->
<file>
<briefdescription visible="yes"/>
<includes visible="$SHOW_INCLUDE_FILES"/>
<includegraph visible="$INCLUDE_GRAPH"/>
<includedbygraph visible="$INCLUDED_BY_GRAPH"/>
<sourcelink visible="yes"/>
<memberdecl>
<classes visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<constantgroups visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
</memberdef>
<authorsection/>
</file>
<!-- Layout definition for a group page -->
<group>
<briefdescription visible="yes"/>
<groupgraph visible="$GROUP_GRAPHS"/>
<memberdecl>
<nestedgroups visible="yes" title=""/>
<dirs visible="yes" title=""/>
<files visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<classes visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<pagedocs/>
<inlineclasses title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
</memberdef>
<authorsection visible="yes"/>
</group>
<!-- Layout definition for a directory page -->
<directory>
<briefdescription visible="yes"/>
<directorygraph visible="yes"/>
<memberdecl>
<dirs visible="yes"/>
<files visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
</directory>
</doxygenlayout>
......@@ -2,9 +2,6 @@
# Make a directory in /tmp/OpenFPM_data
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda-6.5/lib64"
export PATH="$PATH:/usr/local/cuda-6.5/bin"
mkdir /tmp/openfpm_data
mv * .[^.]* /tmp/openfpm_data
mv /tmp/openfpm_data OpenFPM_data
......@@ -16,7 +13,12 @@ git clone git@ppmcore.mpi-cbg.de:incardon/openfpm_devices.git OpenFPM_devices
cd "$1/OpenFPM_data"
sh ./autogen.sh
sh ./configure --disable-gpu
if [ "$2" == "master" ]
then
sh ./configure --disable-gpu
else
sh ./configure
fi
make
./src/mem_map
......
......@@ -25,6 +25,26 @@ AC_PROG_CXX
AC_CANONICAL_HOST
###### Check for test coverage
AC_MSG_CHECKING(whether to build with test coverage)
test_cov=no
AC_ARG_ENABLE(test-coverage,
AC_HELP_STRING(
[--enable-test-coverage],
[enable test coverage]
),
test_cov="$enableval"
)
AC_MSG_RESULT($test_cov)
if test x"$test_cov" = x"yes"; then
AC_DEFINE([TEST_COVERAGE_MODE],[],[Test coverage mode])
CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage "
fi
###### Check for debug compilation
AC_MSG_CHECKING(whether to build with debug information)
......@@ -135,6 +155,11 @@ if [ test x"$memcheck" = x"yes" ]; then
else
echo "* memcheck: no *"
fi
if [ test x"$test_cov" = x"yes" ]; then
echo "* test coverage: yes *"
else
echo "* test coverage: no *"
fi
if [ test x"$debuger" = x"yes" ]; then
echo "* debug: yes *"
else
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -8,10 +8,15 @@
#ifndef GRAPH_UNIT_TEST_HPP_
#define GRAPH_UNIT_TEST_HPP_
#include "config.h"
#include "map_graph.hpp"
#include "Point_test.hpp"
#ifdef TEST_COVERAGE_MODE
#define GS_SIZE 8
#else
#define GS_SIZE 128
#endif
BOOST_AUTO_TEST_SUITE( graph_test )
......@@ -19,8 +24,10 @@ BOOST_AUTO_TEST_CASE( graph_use)
{
std::cout << "Graph unit test start" << "\n";
//! [Define vertex and edge of the graph]
typedef Point_test<float> V;
typedef Point_test<float> E;
//! [Define vertex and edge of the graph]
// Point
Point_test<float> p;
......@@ -43,14 +50,12 @@ BOOST_AUTO_TEST_CASE( graph_use)
p.get<V::t>()[2][1] = 3.0;
p.get<V::t>()[2][2] = 11.0;
//! define a test graph where the vertex and edge store several scalar vectorial and tensorial quantities
//! [Create a Cartesian graph]
//! define a test graph where the vertex and edge store several scalar vectorial and tensorial quantities
Graph_CSR<V,E> g;
//! Create a point
//! try to construct a 2D dimensional cartesian graph
//! construct a 2D dimensional Cartesian graph
// first create the vertex
......@@ -91,6 +96,8 @@ BOOST_AUTO_TEST_CASE( graph_use)
}
}
//! [Create a Cartesian graph]
// Test if duplicate work
Graph_CSR<V,E> g_dup = g.duplicate();
......@@ -120,6 +127,7 @@ BOOST_AUTO_TEST_CASE( graph_use)
// Test the no edge case
//! [Create a tree graph with no edge properties]
Graph_CSR<V> g_no_edge;
// Create a tree
......@@ -164,6 +172,8 @@ BOOST_AUTO_TEST_CASE( graph_use)
g_no_edge.addVertex(p);
g_no_edge.addEdge(6,14);
//! [Create a tree graph with no edge properties]
// Check that each vertex has 2 child
for (size_t i = 0 ; i < g_no_edge.getNVertex() ; i++)
......
......@@ -51,8 +51,6 @@
#define NO_EDGE -1
/*! \brief class with no edge
*
*
*
*/
class no_edge
......@@ -244,16 +242,13 @@ public:
};
/*! \brief Graph that store a CSR graph format
*
* Graph that store a CSR graph format
/*! \brief Structure that store a graph in CSR format or basically in compressed adjacency matrix format
*
* \param V each vertex will encapsulate have this type
* \param E each edge will encapsulate this type
* \param device Type of device / basicaly it select the layout
* for device_cpu is (x_1, p1_1, p2_1, p3_1 ....), ... ( x_n, p1_1, p2_1, p3_1, ...)
* for device_gpu is (x_1, ... , x_n) ... (p1_n, ... pn_n)
*
* where x_1 is the index where it end the list of the neighborhood list and pj_k is
* the property j for the vertex j. Basically in the first case one array will store
* index and property of each vertex, in the second case several array will store
......@@ -262,9 +257,16 @@ public:
* \param VertexList structure that store the list of Vertex
* \param EdgeList structure that store the list of edge
*
* WARNING: This graph is suitable only when we know the graph structure and we build
* \warning This graph is suitable only when we know the graph structure and we build
* the graph adding vertexes and edges, removing vertex and edge is EXTREMLY expensive
*
* ### Define vertex and edge of the graph
* \snippet graph_unit_tests.hpp Define vertex and edge of the graph
* ### Create a Cartesian graph
* \snippet graph_unit_tests.hpp Create a Cartesian graph
* ### Create a tree graph with no edge properties
* \snippet graph_unit_tests.hpp Create a tree graph with no edge properties
*
*/
template<typename V, typename E=no_edge,template<typename> class device=openfpm::device_cpu,template<typename, typename,typename, typename, unsigned int> class VertexList=openfpm::vector, template<typename,typename,typename,typename, unsigned int> class EdgeList=openfpm::vector, typename Memory=HeapMemory, typename grow_p=openfpm::grow_policy_double>
......@@ -476,8 +478,7 @@ public:
*
* operator to access the vertex
*
*
* \param i property to access
* \tparam i property to access
* \param id of the vertex to access
*
*/
......@@ -486,10 +487,9 @@ public:
return v.template get<i>(id);
}
/*! \brief Function to access the vertexes
*
/*! \brief Access the vertex
*
* \param i property to access
* \tparam i property to access
* \param id of the vertex to access
*
*/
......@@ -503,9 +503,9 @@ public:
* \param id of the vertex to access
*
*/
auto vertex(size_t id) -> decltype( v.template get(id) )
auto vertex(size_t id) -> decltype( v.get(id) )
{
return v.template get(id);
return v.get(id);
}
/*! \brief operator to access the vertex
......@@ -515,9 +515,9 @@ public:
* \param id of the vertex to access
*
*/
auto vertex(grid_key_dx<1> id) -> decltype( v.template get(id.get(0)) )
auto vertex(grid_key_dx<1> id) -> decltype( v.get(id.get(0)) )
{
return v.template get(id.get(0));
return v.get(id.get(0));
}
/*! \brief operator to access the vertex
......@@ -527,17 +527,14 @@ public:
* \param id of the vertex to access
*
*/
auto vertex(openfpm::vector_key_iterator id) -> decltype( v.template get(0) )
auto vertex(openfpm::vector_key_iterator id) -> decltype( v.get(0) )
{
return v.template get(id.get());
return v.get(id.get());
}
/*! \brief operator to access the edge
*
* operator to access the edge
*
/*! \brief Access the edge
*
* \param i property to access
* \tparam i property to access
* \param id of the edge to access
*
*/
......@@ -547,12 +544,9 @@ public:
}
/*! \brief operator to access the edge
*
* operator to access the edge
/*! \brief Access the edge
*
*
* \param i property to access
* \tparam i property to access
* \param id of the edge to access
*
*/
......@@ -561,16 +555,14 @@ public:
return e.template get<i>(id);
}
/*! \brief operator to access the edge
*
* operator to access the edge
/*! \brief Access the edge
*
* \param id of the edge to access
*
*/
auto edge(grid_key_dx<1> id) -> decltype ( e.template get(id.get(0)) )
auto edge(grid_key_dx<1> id) -> decltype ( e.get(id.get(0)) )
{
return e.template get(id.get(0));
return e.get(id.get(0));
}
/*! \brief operator to access the edge
......@@ -578,9 +570,9 @@ public:
* \param ek key of the edge
*
*/
auto edge(edge_key ek) -> decltype ( e.template get(0) )
auto edge(edge_key ek) -> decltype ( e.get(0) )
{
return e.template get(e_l.template get<e_map::eid>(ek.pos * v_slot + ek.pos_e));
return e.get(e_l.template get<e_map::eid>(ek.pos * v_slot + ek.pos_e));
}
/*! \brief operator to access the edge
......@@ -590,9 +582,9 @@ public:
* \param id of the edge to access
*
*/
auto edge(size_t id) -> decltype ( e.template get(id) )
auto edge(size_t id) -> decltype ( e.get(id) )
{
return e.template get(id);
return e.get(id);
}
/*! \brief Return the number of childs of a vertex
......@@ -612,12 +604,11 @@ public:
/*! \brief Return the number of childs of a vertex
*
* \param c Child id
* \param c child id
*
* \return the number of childs
*
*/
inline size_t getNChilds(typename VertexList<V,dev_V_sel,Memory,grow_p,openfpm::vect_isel<V>::value>::iterator_key & c)
{
// Get the number of childs
......@@ -625,13 +616,12 @@ public:
return v_l.template get<0>(c.get());
}
/*! \brief Get the child edge
/*! \brief Get the vertex edge
*
* \param c Child
* \param e edge id within the child
* \param v vertex
* \param v_e edge id
*
*/
inline auto getChildEdge(size_t v, size_t v_e) -> decltype(e.get(0))
{
#ifdef DEBUG
......
......@@ -19,11 +19,11 @@
*
*/
template<unsigned int p,typename T>
template<unsigned int p,typename mem>
struct type_cpu_prop
{
//! return a boost::fusion::vector<memory_c<....>....>
typedef typename T::memory_lin::vtype vtype;
typedef typename mem::vtype vtype;
//! return a memory_c<...>
typedef typename boost::fusion::result_of::at< vtype,boost::mpl::int_<p> >::type type;
};
......@@ -37,11 +37,11 @@ struct type_cpu_prop
*
*/
template<unsigned int p,typename T>
template<unsigned int p,typename Mem>
struct type_gpu_prop
{
//! return a boost::fusion::vector<memory_c<....>....>
typedef typename T::memory_int vtype;
typedef Mem vtype;
//! return a memory_c<...>
typedef typename boost::fusion::result_of::at< vtype,boost::mpl::int_<p> >::type rtype;
//! remove the reference
......@@ -64,14 +64,21 @@ struct type_gpu_prop
template<unsigned int dim,typename T,typename Mem>
class encapc
{
public:
typedef typename T::type type;
private:
type & data;
public:
typedef int yes_i_am_encap;
typedef T T_type;
static const int max_prop = T::max_prop;
// constructor require a key and a memory data
encapc(type & data)
:data(data)
......@@ -92,10 +99,10 @@ public:
* \return the reference
*
*/
template <unsigned int p> typename type_cpu_prop<p,T>::type get()
template <unsigned int p> typename type_cpu_prop<p,Mem>::type get()
{
#ifdef MEMLEAK_CHECK
check_valid(&boost::fusion::at_c<p>(data),sizeof(typename type_cpu_prop<p,T>::type));
check_valid(&boost::fusion::at_c<p>(data),sizeof(typename type_cpu_prop<p,Mem>::type));
#endif
return boost::fusion::at_c<p>(data);
}
......@@ -105,16 +112,16 @@ public:
* \return the reference
*
*/
template <unsigned int p> const typename type_cpu_prop<p,T>::type get() const
template <unsigned int p> const typename type_cpu_prop<p,Mem>::type get() const
{
#ifdef MEMLEAK_CHECK
check_valid(&boost::fusion::at_c<p>(data),sizeof(typename type_cpu_prop<p,T>::type));
check_valid(&boost::fusion::at_c<p>(data),sizeof(typename type_cpu_prop<p,Mem>::type));
#endif
return boost::fusion::at_c<p>(data);
}
// access the data
template <unsigned int p> void set(typename type_cpu_prop<p,T>::type & ele)
template <unsigned int p> void set(typename type_cpu_prop<p,Mem>::type & ele)
{
#ifdef MEMLEAK_CHECK
check_valid(&boost::fusion::at_c<p>(data),sizeof(typename type_cpu_prop<p,T>::type));
......@@ -168,6 +175,8 @@ class encapg
public:
typedef int yes_i_am_encap;
typedef T T_type;
// constructor require a key and a memory data
......@@ -176,10 +185,29 @@ public:
{}
// access the data
template <unsigned int p> typename type_gpu_prop<p,T>::type::reference get()
template <unsigned int p> typename type_gpu_prop<p,Mem>::type::reference get()
{
return boost::fusion::at_c<p>(data).mem_r->operator[](k);
}
};
#include "util/common.hpp"
template<typename T, typename Sfinae = void>
struct is_encap: std::false_type {};
/*! \brief is_encap check if the type is an encap type
*
* ### Example
*
* \snippet util.hpp Check is_encap
*