Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
O
openfpm_data
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openfpm
openfpm_data
Compare Revisions
master...insitu_visualization
Source
insitu_visualization
Select Git revision
...
Target
master
Select Git revision
Compare
Commits (2)
Added shared memory support
· 88943949
incardon
authored
Apr 18, 2019
88943949
Adding refactorization for Ata work
· 14682857
incardon
authored
Aug 13, 2019
14682857
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
90 additions
and
11 deletions
+90
-11
src/CMakeLists.txt
src/CMakeLists.txt
+1
-1
src/Grid/grid_base_impl_layout.hpp
src/Grid/grid_base_impl_layout.hpp
+43
-2
src/Grid/grid_base_implementation.hpp
src/Grid/grid_base_implementation.hpp
+31
-8
src/Vector/map_vector.hpp
src/Vector/map_vector.hpp
+10
-0
src/memory_ly/memory_c.hpp
src/memory_ly/memory_c.hpp
+5
-0
No files found.
src/CMakeLists.txt
View file @
14682857
...
...
@@ -8,7 +8,7 @@ else()
set
(
CUDA_SOURCES
)
endif
()
add_executable
(
mem_map ../../openfpm_devices/src/Memleak_check.cpp main.cpp util/multi_array_openfpm/multi_array_ref_openfpm_unit_test.cpp memory_ly/memory_conf_unit_tests.cpp Space/tests/SpaceBox_unit_tests.cpp Grid/copy_grid_unit_test.cpp NN/Mem_type/Mem_type_unit_tests.cpp
${
CUDA_SOURCES
}
../../openfpm_devices/src/memory/HeapMemory.cpp ../../openfpm_devices/src/memory/PtrMemory.cpp
)
add_executable
(
mem_map ../../openfpm_devices/src/Memleak_check.cpp main.cpp util/multi_array_openfpm/multi_array_ref_openfpm_unit_test.cpp memory_ly/memory_conf_unit_tests.cpp Space/tests/SpaceBox_unit_tests.cpp Grid/copy_grid_unit_test.cpp NN/Mem_type/Mem_type_unit_tests.cpp
${
CUDA_SOURCES
}
../../openfpm_devices/src/memory/
ShmAllocator_manager.cpp ../../openfpm_devices/src/memory/SemManager.cpp ../../openfpm_devices/src/memory/ShmAllocator.cpp ../../openfpm_devices/src/memory/
HeapMemory.cpp ../../openfpm_devices/src/memory/PtrMemory.cpp
)
if
(
CMAKE_COMPILER_IS_GNUCC
)
target_compile_options
(
mem_map PRIVATE
"-Wno-deprecated-declarations"
)
...
...
src/Grid/grid_base_impl_layout.hpp
View file @
14682857
...
...
@@ -119,15 +119,51 @@ struct mem_get<p,layout,data_type,g1_type,key_type,1>
}
};
template
<
typename
layout
,
typename
data_type
,
bool
is_empty
,
unsigned
int
sel
=
2
*
is_layout_mlin
<
layout
>::
value
+
is_layout_inte
<
layout
>::
value
>
struct
mem_shmem
{
__host__
static
inline
void
set_shmem_handle
(
data_type
&
data_
,
handle_shmem
sh
)
{}
__host__
static
inline
handle_shmem
get_shmem_handle
(
data_type
&
data_
)
{
handle_shmem
sh
;
sh
.
id
=
-
1
;
return
sh
;
}
};
template
<
typename
layout
,
typename
data_type
>
struct
mem_shmem
<
layout
,
data_type
,
false
,
2
>
{
__host__
static
inline
void
set_shmem_handle
(
data_type
&
data_
,
handle_shmem
sh
)
{
data_
.
mem
->
set_shmem_handle
(
sh
);
}
__host__
static
inline
handle_shmem
get_shmem_handle
(
data_type
&
data_
)
{
return
data_
.
mem
->
get_shmem_handle
();
}
};
//! Case memory_traits_lin
template
<
typename
S
,
typename
layout
,
typename
data_type
,
typename
g1_type
,
unsigned
int
sel
=
2
*
is_layout_mlin
<
layout
>::
value
+
is_layout_inte
<
layout
>::
value
>
struct
mem_setm
{
static
inline
void
setMemory
(
data_type
&
data_
,
const
g1_type
&
g1
,
bool
&
is_mem_init
)
static
inline
void
init_shmem
(
data_type
&
data_
,
handle_shmem
shid
)
{
data_
.
init_shmem
(
shid
);
}
static
inline
void
setMemory
(
data_type
&
data_
,
const
g1_type
&
g1
,
bool
&
is_mem_init
,
handle_shmem
shid
)
{
S
*
mem
=
new
S
();
mem
->
set_shmem_handle
(
shid
);
//! Create and set the memory allocator
data_
.
setMemory
(
*
mem
);
...
...
@@ -142,7 +178,12 @@ struct mem_setm
template
<
typename
S
,
typename
layout
,
typename
data_type
,
typename
g1_type
>
struct
mem_setm
<
S
,
layout
,
data_type
,
g1_type
,
1
>
{
static
inline
void
setMemory
(
data_type
&
data_
,
const
g1_type
&
g1
,
bool
&
is_mem_init
)
static
inline
void
init_shmem
(
data_type
&
data_
,
handle_shmem
shid
)
{
// TODO implement shared memory implementation
}
static
inline
void
setMemory
(
data_type
&
data_
,
const
g1_type
&
g1
,
bool
&
is_mem_init
,
handle_shmem
sh
)
{
//! Create an allocate object
allocate
<
S
>
all
(
g1
.
size
());
...
...
src/Grid/grid_base_implementation.hpp
View file @
14682857
...
...
@@ -233,6 +233,9 @@ private:
//! The memory allocator is not internally created
bool
isExternal
;
// shared_memory handle
handle_shmem
sh_handle
;
#ifdef SE_CLASS1
/*! \brief Check that the key is inside the grid
...
...
@@ -430,7 +433,7 @@ private:
while
(
it
.
isNext
())
{
// get the grid
key
// get the grid
sh_handle
grid_key_dx
<
dim
>
key
=
it
.
get
();
// create a copy element
...
...
@@ -474,6 +477,7 @@ public:
grid_base_impl
()
THROW
:
g1
(
0
),
isExternal
(
false
)
{
sh_handle
.
id
=
-
1
;
// Add this pointer
#ifdef SE_CLASS2
check_new
(
this
,
8
,
GRID_EVENT
,
1
);
...
...
@@ -489,6 +493,7 @@ public:
grid_base_impl
(
const
grid_base_impl
&
g
)
THROW
:
isExternal
(
false
)
{
sh_handle
.
id
=
-
1
;
this
->
operator
=
(
g
);
}
...
...
@@ -500,6 +505,7 @@ public:
grid_base_impl
(
const
size_t
&
sz
)
THROW
:
g1
(
sz
),
isExternal
(
false
)
{
sh_handle
.
id
=
-
1
;
// Add this pointer
#ifdef SE_CLASS2
check_new
(
this
,
8
,
GRID_EVENT
,
1
);
...
...
@@ -516,6 +522,7 @@ public:
grid_base_impl
(
const
size_t
(
&
sz
)[
dim
])
THROW
:
g1
(
sz
),
isExternal
(
false
)
{
sh_handle
.
id
=
-
1
;
// Add this pointer
#ifdef SE_CLASS2
check_new
(
this
,
8
,
GRID_EVENT
,
1
);
...
...
@@ -683,7 +690,7 @@ public:
check_valid
(
this
,
8
);
#endif
mem_setm
<
S
,
layout_base
<
T
>
,
decltype
(
this
->
data_
),
decltype
(
this
->
g1
)
>::
setMemory
(
data_
,
g1
,
is_mem_init
);
mem_setm
<
S
,
layout_base
<
T
>
,
decltype
(
this
->
data_
),
decltype
(
this
->
g1
)
>::
setMemory
(
data_
,
g1
,
is_mem_init
,
sh_handle
);
}
/*! \brief Get the object that provide memory
...
...
@@ -705,12 +712,6 @@ public:
//! Is external
isExternal
=
true
;
//! Create and set the memory allocator
// data_.setMemory(m);
//! Allocate the memory and create the reppresentation
// if (g1.size() != 0) data_.allocate(g1.size());
bool
skip_ini
=
skip_init
<
has_noPointers
<
T
>::
value
,
T
>::
skip_
();
mem_setmemory
<
decltype
(
data_
),
S
,
layout_base
<
T
>>::
template
setMemory
<
p
>
(
data_
,
m
,
g1
.
size
(),
skip_ini
);
...
...
@@ -995,6 +996,8 @@ public:
grid_base_impl
<
dim
,
T
,
S
,
layout
,
layout_base
>
grid_new
(
sz
);
grid_new
.
set_shmem_handle
(
this
->
get_shmem_handle
());
resize_impl_memset
(
grid_new
);
...
...
@@ -1328,6 +1331,16 @@ public:
return
grid_key_dx_iterator_sub
<
dim
>
(
g1
,
m
);
}
inline
handle_shmem
get_shmem_handle
()
{
return
mem_shmem
<
layout_base
<
T
>
,
decltype
(
this
->
data_
),
boost
::
mpl
::
size
<
typename
T
::
type
>::
type
::
value
==
0
>::
get_shmem_handle
(
data_
);
}
inline
void
set_shmem_handle
(
handle_shmem
sh
)
{
this
->
sh_handle
=
sh
;
}
/*! \brief Return a grid iterator
*
* Return a grid iterator, to iterate through the grid
...
...
@@ -1440,6 +1453,16 @@ public:
return
-
1
;
#endif
}
/*! \brief give a path for key generation for shared memory
*
* \
*
*/
void
init_shmem
(
handle_shmem
shid
)
{
mem_setm
<
S
,
layout_base
<
T
>
,
decltype
(
this
->
data_
),
decltype
(
this
->
g1
)
>::
init_shmem
(
data_
,
shid
);
}
};
...
...
src/Vector/map_vector.hpp
View file @
14682857
...
...
@@ -1823,6 +1823,16 @@ namespace openfpm
return
v
;
}
/*! \brief give a path for key generation for shared memory
*
* \
*
*/
void
init_shmem
(
handle_shmem
shid
)
{
base
.
init_shmem
(
shid
);
}
void
*
internal_get_size_pointer
()
{
return
&
v_size
;}
void
print_size
()
...
...
src/memory_ly/memory_c.hpp
View file @
14682857
...
...
@@ -204,6 +204,11 @@ class memory_c<T,MEMORY_C_STANDARD,D>
mem_obj
.
mem_r
.
swap
(
mem_r
);
}
void
init_shmem
(
handle_shmem
shid
)
{
mem
->
set_shmem_handle
(
shid
);
}
};
...
...