Commit dc6f03a1 authored by incardon's avatar incardon

Adding example file

parent 8b352412
include ../../example.mk
CC=mpic++
LDIR =
OBJ = main.o
all: md_dyn
%.o: %.cpp
$(CC) -O3 -g -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
md_dyn: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
run: all
mpirun -np 3 ./md_dyn;
.PHONY: clean all run
clean:
rm -f *.o *~ core md_dyn
This diff is collapsed.
......@@ -1073,9 +1073,8 @@ int main(int argc, char* argv[])
particles vd(0,domain,bc,g,DEC_GRAN(512));
// vd.setCapacity(200000);
vd.setCapacity(200000);
// openfpm_finalize();
//! \cond [vector inst] \endcond
......@@ -1359,8 +1358,6 @@ int main(int argc, char* argv[])
//! \cond [load balancing] \endcond
openfpm_finalize();
// Now that we fill the vector with particles
ModelCustom md;
......
......@@ -6,13 +6,13 @@ if(CUDA_FOUND)
set(CUDA_SOURCES ../openfpm_devices/src/memory/CudaMemory.cu)
endif()
add_executable(cart_dec CartDecomposition_gen_vtk.cpp ../src/lib/pdata.cpp ${CUDA_SOURCES} ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp)
add_executable(cart_dec CartDecomposition_gen_vtk.cpp ../src/lib/pdata.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 ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp)
add_executable(metis_dec Metis_gen_vtk.cpp ../src/lib/pdata.cpp ${CUDA_SOURCES} ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp)
add_executable(metis_dec Metis_gen_vtk.cpp ../src/lib/pdata.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 ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp)
add_executable(dom_box domain_gen_vtk.cpp ../src/lib/pdata.cpp ${CUDA_SOURCES} ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp)
add_executable(dom_box domain_gen_vtk.cpp ../src/lib/pdata.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 ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp)
add_executable(vector_dist vector.cpp ${CUDA_SOURCES} ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_devices/src/Memleak_check.cpp)
add_executable(vector_dist vector.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_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_devices/src/Memleak_check.cpp)
###########################
......
openfpm_data @ 14682857
Subproject commit 88943949bb64102b77d88eeafed10f31c7c15ef2
Subproject commit 14682857a31aa1424227535a7de94b9fc68aea27
openfpm_devices @ 22b0ed11
Subproject commit cba90c37fbf3fb822db0ff5ced765ac7b2a37267
Subproject commit 22b0ed11ce799f286c8435544d5af8abcb5a131a
......@@ -9,7 +9,7 @@ else()
set(CUDA_SOURCES)
endif()
add_executable(pdata ${OPENFPM_INIT_FILE} ${CUDA_SOURCES} main.cpp Debug/debug_test.cpp Grid/tests/grid_dist_id_HDF5_chckpnt_restart_test.cpp Grid/tests/grid_dist_id_unit_test.cpp Grid/tests/staggered_grid_dist_unit_test.cpp Vector/tests/vector_dist_cell_list_tests.cpp Vector/tests/vector_dist_complex_prp_unit_test.cpp Vector/tests/vector_dist_HDF5_chckpnt_restart_test.cpp Vector/tests/vector_dist_MP_unit_tests.cpp Vector/tests/vector_dist_NN_tests.cpp Vector/tests/vector_dist_unit_test.cpp pdata_performance.cpp Decomposition/tests/CartDecomposition_unit_test.cpp Decomposition/tests/shift_vect_converter_tests.cpp Vector/performance/vector_dist_performance_util.cpp lib/pdata.cpp test_multiple_o.cpp ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp)
add_executable(pdata ${OPENFPM_INIT_FILE} ${CUDA_SOURCES} main.cpp Debug/debug_test.cpp Grid/tests/grid_dist_id_HDF5_chckpnt_restart_test.cpp Grid/tests/grid_dist_id_unit_test.cpp Grid/tests/staggered_grid_dist_unit_test.cpp Vector/tests/vector_dist_cell_list_tests.cpp Vector/tests/vector_dist_complex_prp_unit_test.cpp Vector/tests/vector_dist_HDF5_chckpnt_restart_test.cpp Vector/tests/vector_dist_MP_unit_tests.cpp Vector/tests/vector_dist_NN_tests.cpp Vector/tests/vector_dist_unit_test.cpp pdata_performance.cpp Decomposition/tests/CartDecomposition_unit_test.cpp Decomposition/tests/shift_vect_converter_tests.cpp Vector/performance/vector_dist_performance_util.cpp lib/pdata.cpp test_multiple_o.cpp ../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 ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp)
if ( CMAKE_COMPILER_IS_GNUCC )
target_compile_options(pdata PRIVATE "-Wno-deprecated-declarations")
......
......@@ -272,6 +272,8 @@ BOOST_AUTO_TEST_CASE( vector_dist_particle_shmem_test )
// Distributed vector
vector_dist<3,float, part_prop > vd(0,box,bc,ghost);
vd.visualize();
vd.setCapacity(10000);
vd.resize(1000);
......
......@@ -37,6 +37,7 @@
#include "NN/CellList/ProcKeys.hpp"
#include "Vector/vector_dist_kernel.hpp"
#include "NN/CellList/cuda/CellList_gpu.hpp"
#include "memory/ShmAllocator_manager.hpp"
#define DEC_GRAN(gr) ((size_t)gr << 32)
......@@ -257,6 +258,11 @@ private:
//! reordered v_prp buffer
openfpm::vector<Point<dim, St>,Memory,typename layout_base<Point<dim,St>>::type,layout_base> v_pos_out;
//! Shared memory handle for position vector
handle_shmem hpos;
//! Shared memory handle for property vector
handle_shmem hprp;
//! Virtual cluster
Vcluster<Memory> & v_cl;
......@@ -378,18 +384,7 @@ private:
}
}
/*! /brief set shared memory
*
*
*/
void set_shm()
{
if (global_option == init_options::in_situ_visualization)
{
v_pos.init_shmem("/tmp",v_cl.rank());
v_prp.init_shmem("/home",v_cl.rank());
}
}
public:
......@@ -465,7 +460,6 @@ public:
vector_dist()
:v_cl(create_vcluster<Memory>()),opt(opt)
{
set_shm();
}
......@@ -481,8 +475,6 @@ public:
check_new(this,8,VECTOR_DIST_EVENT,4);
#endif
set_shm();
this->operator=(v);
}
......@@ -498,8 +490,6 @@ public:
check_new(this,8,VECTOR_DIST_EVENT,4);
#endif
set_shm();
this->operator=(v);
#ifdef SE_CLASS3
......@@ -519,7 +509,6 @@ public:
#ifdef SE_CLASS2
check_new(this,8,VECTOR_DIST_EVENT,4);
#endif
set_shm();
init_structures(np);
......@@ -547,7 +536,6 @@ public:
#ifdef SE_CLASS2
check_new(this,8,VECTOR_DIST_EVENT,4);
#endif
set_shm();
if (opt >> 32 != 0)
this->setDecompositionGranularity(opt >> 32);
......@@ -568,6 +556,26 @@ public:
#ifdef SE_CLASS2
check_delete(this);
#endif
create_shmanager().destroy(hpos);
create_shmanager().destroy(hprp);
}
/*! /brief set shared memory
*
*
*/
void visualize()
{
if (global_option == init_options::in_situ_visualization)
{
hpos = create_shmanager().create("/tmp",v_cl.rank());
hprp = create_shmanager().create("/home",v_cl.rank());
v_pos.init_shmem(hpos);
v_prp.init_shmem(hprp);
}
}
/*! \brief remove all the elements
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment