Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • mosaic/software/parallel-computing/openfpm/openfpm_pdata
  • argupta/openfpm_pdata
2 results
Show changes
Commits on Source (3521)
Showing
with 61 additions and 3030 deletions
......@@ -25,6 +25,7 @@
*.log
*.sql
*.sqlite
*.xml
# OS generated files #
######################
......@@ -36,39 +37,42 @@
ehthumbs.db
Thumbs.db
# CLion IDE-related
.idea/
cmake-build-debug/
cmake-build-release/
# Script-generated build folder
build/
###### Other
*.vtk
AUTHORS
COPYING
INSTALL
NEWS
README
**/vtk/Makefile
**/src/Makefile
./Makefile
Makefile.in
config.status
configure
numerics
Makefile
**/.deps
**/src/config
aclocal.m4
**/autom4te.cache
example.mk
src/pdata
vtk/cart_dec
vtk/dom_box
vtk/metis_dec
.autotools
.cproject
.project
.settings
ar-lib
compile
config.guess
config.sub
depcomp
install-sh
missing
install_dir
**/*.vtk
!**/test_data/*.vtk
*.csv
*.h5
*.json
*.html
Makefile
/build
*CMake*
*cmake*
**/*cmake*
**/*CMake*
**/.gitignore
.gitignore
/doxygen/
[submodule "openfpm_vcluster"]
path = openfpm_vcluster
url = ssh://git@ppmcore.mpi-cbg.de/incardon/openfpm_vcluster.git
[submodule "openfpm_devices"]
path = openfpm_devices
url = ssh://git@ppmcore.mpi-cbg.de/incardon/openfpm_devices.git
[submodule "openfpm_io"]
path = openfpm_io
url = ssh://git@ppmcore.mpi-cbg.de/incardon/openfpm_io.git
[submodule "openfpm_data"]
path = openfpm_data
url = ssh://git@ppmcore.mpi-cbg.de/incardon/openfpm_data.git
[submodule "openfpm_numerics"]
path = openfpm_numerics
url = ssh://git@ppmcore.mpi-cbg.de/incardon/openfpm_numerics.git
# Change Log
All notable changes to this project will be documented in this file.
## [0.1.0] - 2015-02-05
### Added
- PSE 1D example
- Cell list example
- Verlet list example
- Kickstart for OpenFPM_numeric
- Automated dependency installation for SUITESPRASE EIGEN OPENBLAS(LAPACK)
### Fixed
- CRITICAL BUG in periodic bondary condition
- BOOST auto updated to 1.60
- Compilation with multiple .cpp files
### Changed
- Nothing to report
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(openfpm_pdata LANGUAGES C CXX)
if (POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
set(openfpm_VERSION 5.0.0)
if (METIS_FOUND)
set(DEFINE_HAVE_METIS "#define HAVE_METIS 1")
else()
message( FATAL_ERROR "Metis is required in order to install OpenFPM" )
endif()
if (PARMETIS_FOUND)
set(DEFINE_HAVE_PARMETIS "#define HAVE_PARMETIS 1")
else()
message( FATAL_ERROR "ParMetis is required in order to install OpenFPM")
endif()
add_subdirectory (src)
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/src/cmake/openfpmConfig-configure.cmake CMAKE_OPENFPM_CONFIG_VARS)
set(CMAKE_OPENFPM_CONFIG_VARS "${CMAKE_OPENFPM_CONFIG_VARS}\nmessage(STATUS \"Found OpenFPM version ${openfpm_VERSION} (\$\{CMAKE_CURRENT_LIST_FILE\})\")")
set(CMAKE_OPENFPM_CONFIG_VARS "${CMAKE_OPENFPM_CONFIG_VARS}\nset(OPENFPM_CUDA_ON_BACKEND \"${CUDA_ON_BACKEND}\")")
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/src/cmake/openfpmConfig-Vars.cmake "${CMAKE_OPENFPM_CONFIG_VARS}")
get_directory_property(hasParent PARENT_DIRECTORY)
if(hasParent)
set(DEFINE_HAVE_METIS ${DEFINE_HAVE_METIS} CACHE INTERNAL "")
set(DEFINE_HAVE_PARMETIS ${DEFINE_HAVE_PARMETIS} CACHE INTERNAL "")
endif()
SUBDIRS = src vtk openfpm_data openfpm_io openfpm_devices openfpm_vcluster
bin_PROGRAMS =
This diff is collapsed.
#! /bin/bash
# Make a directory in /tmp/OpenFPM_pdata
echo "Directory: $1"
echo "Machine: $2"
mkdir src/config
git submodule init
if [ $? -ne 0 ]; then
echo -e "Configure\033[91;5;1m FAILED \033[0m"
exit 1
fi
git submodule update
if [ $? -ne 0 ]; then
echo -e "Configure\033[91;5;1m FAILED \033[0m"
exit 1
fi
mkdir openfpm_numerics/src/config
# pull from all the projects
cd openfpm_data
git checkout develop
mkdir src/config
git pull origin develop
if [ $? -ne 0 ]; then
echo -e "Configure\033[91;5;1m FAILED \033[0m"
exit 1
fi
cd ..
cd openfpm_devices
mkdir src/config
git pull origin master
if [ $? -ne 0 ]; then
echo -e "Configure\033[91;5;1m FAILED \033[0m"
exit 1
fi
cd ..
cd openfpm_vcluster
mkdir src/config
git pull origin master
if [ $? -ne 0 ]; then
echo -e "Configure\033[91;5;1m FAILED \033[0m"
exit 1
fi
cd ..
cd openfpm_io
mkdir src/config
git pull origin master
if [ $? -ne 0 ]; then
echo -e "Configure\033[91;5;1m FAILED \033[0m"
exit 1
fi
cd ..
if [ "$2" == "gin" ]
then
echo "Compiling on gin\n"
source ~/.bashrc
module load gcc/4.9.2
./install -s -c "--prefix=/home/jenkins/openfpm_install"
make
make install
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
mpirun -np 2 ./src/pdata
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
mpirun -np 3 ./src/pdata
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
mpirun -np 4 ./src/pdata
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
mpirun -np 5 ./src/pdata
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
mpirun -np 6 ./src/pdata
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
mpirun -np 7 ./src/pdata
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
mpirun -np 8 ./src/pdata
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
mpirun -np 9 ./src/pdata
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
mpirun -np 10 ./src/pdata
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
mpirun -np 11 ./src/pdata
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
mpirun -np 12 ./src/pdata
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
elif [ "$2" == "wetcluster" ]
then
echo "Compiling on wetcluster"
## produce the module path
source ~/.bashrc
module load gcc/4.9.2
module load openmpi/1.8.1
module load boost/1.54.0
sh ./autogen.sh
./install -s -c "--with-boost=/sw/apps/boost/1.54.0/ CXX=mpic++"
make
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
## Run on the cluster
bsub -o output_run2.%J -K -n 2 -R "span[hosts=1]" "module load openmpi/1.8.1 ; module load gcc/4.9.2; module load boost/1.54.0; mpirun -np 2 ./src/pdata"
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
bsub -o output_run3.%J -K -n 3 -R "span[hosts=1]" "module load openmpi/1.8.1 ; module load gcc/4.9.2; module load boost/1.54.0; mpirun -np 3 ./src/pdata"
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
bsub -o output_run4.%J -K -n 4 -R "span[hosts=1]" "module load openmpi/1.8.1 ; module load gcc/4.9.2; module load boost/1.54.0; mpirun -np 4 ./src/pdata"
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
bsub -o output_run5.%J -K -n 5 -R "span[hosts=1]" "module load openmpi/1.8.1 ; module load gcc/4.9.2; module load boost/1.54.0; mpirun -np 5 ./src/pdata"
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
bsub -o output_run6.%J -K -n 6 -R "span[hosts=1]" "module load openmpi/1.8.1 ; module load gcc/4.9.2; module load boost/1.54.0; mpirun -np 6 ./src/pdata"
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
bsub -o output_run7.%J -K -n 7 -R "span[hosts=1]" "module load openmpi/1.8.1 ; module load gcc/4.9.2; module load boost/1.54.0; mpirun -np 7 ./src/pdata"
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
bsub -o output_run8.%J -K -n 8 -R "span[hosts=1]" "module load openmpi/1.8.1 ; module load gcc/4.9.2; module load boost/1.54.0; mpirun -np 8 ./src/pdata"
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
bsub -o output_run9.%J -K -n 9 -R "span[hosts=1]" "module load openmpi/1.8.1 ; module load gcc/4.9.2; module load boost/1.54.0; mpirun -np 9 ./src/pdata"
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
bsub -o output_run10.%J -K -n 10 -R "span[hosts=1]" "module load openmpi/1.8.1 ; module load gcc/4.9.2; module load boost/1.54.0; mpirun -np 10 ./src/pdata"
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
bsub -o output_run11.%J -K -n 11 -R "span[hosts=1]" "module load openmpi/1.8.1 ; module load gcc/4.9.2; module load boost/1.54.0; mpirun -np 11 ./src/pdata"
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
bsub -o output_run12.%J -K -n 12 -R "span[hosts=1]" "module load openmpi/1.8.1 ; module load gcc/4.9.2; module load boost/1.54.0; mpirun -np 12 ./src/pdata"
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
# bsub -o output_run32.%J -K -n 32 "module load openmpi/1.8.1 ; module load gcc/4.9.2; mpirun -np 32 ./src/vcluster"
# if [ $? -ne 0 ]; then exit 1 ; fi
# bsub -o output_run32.%J -K -n 64 "module load openmpi/1.8.1 ; module load gcc/4.9.2; mpirun -np 64 ./src/vcluster"
# if [ $? -ne 0 ]; then exit 1 ; fi
# bsub -o output_run32.%J -K -n 128 "module load openmpi/1.8.1 ; module load gcc/4.9.2; mpirun -np 128 ./src/vcluster"
# if [ $? -ne 0 ]; then exit 1 ; fi
elif [ "$2" == "taurus" ]
then
echo "Compiling on taurus"
source /etc/profile
echo "$PATH"
module load boost/1.56.0-gnu4.9.1
module unload gcc/4.9.1
module load gcc/4.9.3
module load openmpi/1.8.8-gnu
module unload bullxmpi
module load metis/5.1.0
./install -s -c"--with-metis=/sw/global/libraries/metis/5.1.0/x86_64/ --with-boost=/sw/taurus/libraries/boost/1.56.0-gnu4.9.1 CXX=mpic++"
make
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
salloc --nodes=1 --ntasks-per-node=24 --exclude=taurusi[6300-6400],taurusi[5400-5500] --time=00:5:00 --mem-per-cpu=1900 --partition=haswell bash -c "ulimit -s unlimited && mpirun -np 24 src/pdata --report_level=no"
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
salloc --nodes=2 --ntasks-per-node=24 --exclude=taurusi[6300-6400],taurusi[5400-5500] --time=00:5:00 --mem-per-cpu=1900 --partition=haswell bash -c "ulimit -s unlimited && mpirun -np 48 src/pdata --report_level=no"
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
salloc --nodes=4 --ntasks-per-node=24 --exclude=taurusi[6300-6400],taurusi[5400-5500] --time=00:5:00 --mem-per-cpu=1900 --partition=haswell bash -c "ulimit -s unlimited && mpirun -np 96 src/pdata --report_level=no"
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
salloc --nodes=8 --ntasks-per-node=24 --exclude=taurusi[6300-6400],taurusi[5400-5500] --time=00:5:00 --mem-per-cpu=1900 --partition=haswell bash -c "ulimit -s unlimited && mpirun -np 192 src/pdata --report_level=no"
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
salloc --nodes=10 --ntasks-per-node=24 --exclude=taurusi[6300-6400],taurusi[5400-5500] --time=00:5:00 --mem-per-cpu=1900 --partition=haswell bash -c "ulimit -s unlimited && mpirun -np 240 src/pdata --report_level=no"
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
else
echo "Compiling general"
source ~/.bashrc
./install -s
mpirun -np 2 ./src/pdata
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
mpirun -np 3 ./src/pdata
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
mpirun -np 4 ./src/pdata
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
fi
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Info:\", \"color\": \"#00FF00\", \"text\":\"$2 completed succeffuly the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
## Take all the options with the exception of --enable-install-req
AC_PREREQ(2.59)
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
AC_CANONICAL_SYSTEM
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_SUBDIRS([openfpm_data openfpm_devices openfpm_vcluster openfpm_io openfpm_numerics])
#### Adding --with-pdata option and openfpm_pdata to prefix folder
if test "$prefix" = "NONE"; then
prefix=/usr/local
fi
base=$prefix
prefix="$prefix/openfpm_pdata"
echo "Installation dir is: $prefix"
ac_configure_args="$ac_configure_args --with-pdata=../../src"
########################
AM_INIT_AUTOMAKE
AC_CONFIG_HEADER([src/config/config.h])
m4_ifdef([ACX_PTHREAD],,[m4_include([m4/acx_pthread.m4])])
m4_ifdef([ACX_MPI],,[m4_include([m4/acx_mpi.m4])])
m4_ifdef([AX_OPENMP],,[m4_include([m4/ax_openmp.m4])])
m4_ifdef([AX_CUDA],,[m4_include([m4/ax_cuda.m4])])
m4_ifdef([IMMDX_LIB_METIS],,[m4_include([m4/immdx_lib_metis.m4])])
m4_ifdef([AX_BOOST_BASE],,[m4_include([m4/ax_boost_base.m4])])
m4_ifdef([AX_BOOST_IOSTREAMS],,[m4_include([m4/ax_boost_iostreams.m4])])
m4_ifdef([AX_BOOST_PROGRAM_OPTIONS],,[m4_include([m4/ax_boost_program_options.m4])])
m4_ifdef([AX_BOOST_UNIT_TEST_FRAMEWORK],,[m4_include([m4/ax_boost_unit_test_framework.m4])])
m4_ifdef([AX_BLAS],,[m4_include([m4/ax_blas.m4])])
m4_ifdef([AX_LAPACK],,[m4_include([m4/ax_lapack.m4])])
m4_ifdef([AX_SUITESPARSE],,[m4_include([m4/ax_suitesparse.m4])])
m4_ifdef([AX_EIGEN],,[m4_include([m4/ax_eigen.m4])])
m4_ifdef([AX_LIB_HDF5],,[m4_include([m4/ax_lib_hdf5.m4])]])
m4_ifdef([AX_H5HUT],,[m4_include([m4/ax_h5hut.m4])])
CXXFLAGS+=" --std=c++11 "
NVCCFLAGS=" "
INCLUDES_PATH=" "
# Create a file with the install base folder
echo "$base" > install_dir
# Needed for build library
AC_PROG_RANLIB
AM_PROG_AR
# Checks for programs.
AC_PROG_CXX
# Checks g++ flags
AC_CANONICAL_HOST
# Check that the compiler support mpi
AC_LANG_PUSH([C++])
AC_CHECK_HEADER(mpi.h,[],[echo "mpi.h not found"
exit 200])
AC_LANG_POP([C++])
# Check target architetture
#AX_GCC_ARCHFLAG([], [CXXFLAGS="$CXXFLAGS $ax_cv_gcc_archflag"], [])
###### Check for debug compilation
AC_MSG_CHECKING(whether to build with debug information)
debuger=no
AC_ARG_ENABLE(debug,
AC_HELP_STRING(
[--enable-debug],
[enable debug data generation (def=no)]
),
debuger="$enableval"
)
AC_MSG_RESULT($debuger)
if test x"$debuger" = x"yes"; then
AC_DEFINE([DEBUG_MODE],[],[Debug])
AC_DEFINE([DEBUG],[],[Debug])
CXXFLAGS="$CXXFLAGS -g3 -Wall -O0 "
NVCCFLAGS+="$NVCCFLAGS -g -O0 "
else
CXXFLAGS="$CXXFLAGS -Wall -O3 -g3 -funroll-loops "
NVCCFLAGS+="$NVCCFLAGS -O3 "
fi
#########
## Check for Metis
IMMDX_LIB_METIS([],[echo "Cannot detect metis, use the --with-metis option if it is not installed in the default location"
exit 201])
#########
## Check for HDF5
AX_LIB_HDF5([parallel])
if test x"$with_hdf5" = x"no"; then
echo "Cannot detect hdf5, use the --with-hdf5 option if it is not installed in the default location"
exit 207
fi
#########
## Check for H5HUT
save_CC=$CC
CC=$CXX
AX_H5HUT([],[echo "Cannot detect h5hut, use the --with-h5hut option if it is not installed in the default location"
exit 208])
CC=$save_CC
########
## Enable scan coverty
AC_MSG_CHECKING(whether to build for scan coverty compilation)
AC_ARG_ENABLE(scan-coverty,
AC_HELP_STRING(
[--enable-scan-coverty],
[enable scan-coverty compilation (def=no)]
),
scancoverty="$enableval"
)
AC_MSG_RESULT($scancoverty)
if test x"$scancoverty" = x"yes"; then
AC_DEFINE([COVERTY_SCAN],[],[Compile for coverty scan])
fi
####### include OpenFPM_devices include path
INCLUDES_PATH+="-I. -Iconfig/ -I../openfpm_io/src -I../openfpm_data/src -I../openfpm_devices/src -I../openfpm_vcluster/src/"
###### Check for se-class1
AC_MSG_CHECKING(whether to build with security enhancement class1)
se_class1=no
AC_ARG_ENABLE(se-class1,
AC_HELP_STRING(
[--enable-se-class1],
[enable security enhancement class1]
),
se_class1="$enableval"
)
AC_MSG_RESULT($se_class1)
if test x"$se_class1" = x"yes"; then
AC_DEFINE([SE_CLASS1],[],[Security enhancement class 1])
fi
###### Check for se-class 2
AC_MSG_CHECKING(whether to build with security enhancement class 2)
se_class2=no
AC_ARG_ENABLE(se-class2,
AC_HELP_STRING(
[--enable-se-class2],
[enable security enhancement class 2]
),
se_class2="$enableval"
)
AC_MSG_RESULT($se_class2)
if test x"$se_class2" = x"yes"; then
AC_DEFINE([SE_CLASS2],[],[Security enhancement class 2])
fi
###### Check for se-class 3
AC_MSG_CHECKING(whether to build with security enhancement class 3)
se_class3=no
AC_ARG_ENABLE(se-class3,
AC_HELP_STRING(
[--enable-se-class3],
[enable security enhancement class 3]
),
se_class3="$enableval"
)
AC_MSG_RESULT($se_class3)
if test x"$se_class3" = x"yes"; then
AC_DEFINE([SE_CLASS3],[],[Security enhancement class 3])
fi
###### Check for action on error
action_on_e=continue
AC_ARG_WITH([action-on-error],
AS_HELP_STRING([--with-action-on-error=stop,throw,continue],
[specify the action to do in case of error]),
[action_on_e="$withval"],
[action_on_e=continue])
if test x"$action_on_e" = x"stop"; then
AC_DEFINE([STOP_ON_ERROR],[],[If an error occur stop the program])
fi
if test x"$action_on_e" = x"throw"; then
AC_DEFINE([THROW_ON_ERROR],[],[when an error accur continue but avoid unsafe operation])
fi
##### CHECK FOR BOOST ##############
AX_BOOST_BASE([1.52],[],[echo "boost not found"
exit 202])
AX_BOOST_UNIT_TEST_FRAMEWORK
AX_BOOST_PROGRAM_OPTIONS
AX_BOOST_IOSTREAMS
if test x"$ax_cv_boost_unit_test_framework" = x"no"; then
echo "Notify boost not usable"
exit 202
fi
if test x"$ax_cv_boost_iostreams" = x"no"; then
echo "Notify boost not usable"
exit 202
fi
if test x"$ax_cv_boost_programs_options" = x"no"; then
echo "Notify boost not usable"
exit 202
fi
### Unfortunately a lot of linux distros install a pretty old MPI in the system wide folder,
### override such MPI with the installed one is extremely difficult and tricky, because we want
### to include "some" system library but exclude mpi. One possibility is to give specifically
### the wanted libmpi.so directly to the linker. But this is not possible because this lib is
### given by mpic++ in the form -L/path/to/mpi -lmpi, the other is completely eliminate every
### -L with a system default library
###
# eliminate any /usr/lib and and /usr/include from $BOOST_LIB and $BOOST_INCLUDE
BOOST_LDFLAGS=$(echo "$BOOST_LDFLAGS" | sed -e 's/ -L\/usr\/lib64[ \b]//g' | sed -e 's/ -L\/usr\/lib[ \b]//g')
BOOST_CPPFLAGS=$(echo "$BOOST_CPPFLAGS" | sed -e 's/-I\/usr\/include[ \b]//g')
AC_SUBST(BOOST_LDFLAGS)
AC_SUBST(BOOST_CPPFLAGS)
###### Checking for OpenBLAS
AX_BLAS([],[echo "blas not found"
exit 204])
AX_LAPACK([],[echo "lapack not found"
exit 204])
###### Checking for SUITESPARSE
AX_SUITESPARSE([],[echo "suitesparse not found"
exit 205])
###### Checking for EIGEN
AX_EIGEN([],[echo "eigen not found"
exit 206])
####### Checking for GPU support
AX_CUDA
## detect for NVCC
if test x"$NVCC_EXIST" = x"yes"; then
AC_MSG_CHECKING(whether to build with GPU support)
gpu_support=yes
AC_ARG_ENABLE(gpu,
AC_HELP_STRING(
[--enable-gpu],
[enable gpu support]
),
gpu_support="$enableval"
)
AC_MSG_RESULT($gpu_support)
if test x"$gpu_support" = x"yes"; then
AC_DEFINE([GPU],[],[GPU support])
else
CUDA_LIBS=""
CUDA_CFLAGS=""
fi
else
gpu_support=no
fi
if test x$gpu_support = x"no"; then
CUDA_LIBS=""
CUDA_CFLAGS=""
fi
# Set this conditional if cuda is wanted
AM_CONDITIONAL(BUILDCUDA, test ! x$NVCC = x"no")
###########################
# Define that there is MPI
AC_DEFINE([HAVE_MPI],[],[MPI Enabled])
AC_SUBST(NVCCFLAGS)
AC_SUBST(INCLUDES_PATH)
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_CONFIG_FILES([Makefile src/Makefile vtk/Makefile ])
AC_OUTPUT
echo ""
echo "***********************************"
echo "* *"
if [ test x"$profiler" = x"yes" ]; then
echo "* profiler: yes *"
else
echo "* profiler: no *"
fi
if [ test x"$memcheck" = x"yes" ]; then
echo "* memcheck: yes *"
else
echo "* memcheck: no *"
fi
if [ test x"$debuger" = x"yes" ]; then
echo "* debug: yes *"
else
echo "* debug: no *"
fi
if [ test x"$se_class1" = x"yes" ]; then
echo "* se-class1: yes *"
else
echo "* se-class1: no *"
fi
if [ test x"$se_class2" = x"yes" ]; then
echo "* se-class2: yes *"
else
echo "* se-class2: no *"
fi
if [ test x"$se_class3" = x"yes" ]; then
echo "* se-class3: yes *"
else
echo "* se-class3: no *"
fi
if [ test x"$gpu_support" = x"no" ]; then
echo "* gpu: no *"
else
echo "* gpu: yes *"
fi
echo "* *"
echo "***********************************"
include ../../example.mk
CC=mpic++
LDIR =
OBJ = main.o
%.o: %.cpp
$(CC) -O3 -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
grid: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
all: grid
.PHONY: clean all
clean:
rm -f *.o *~ core grid
[pack]
files = main.cpp Makefile
#include "Grid/grid_dist_id.hpp"
#include "data_type/aggregate.hpp"
#include "Decomposition/CartDecomposition.hpp"
/*
* ### WIKI 1 ###
*
* ## Simple example
*
* This example show several basic functionalities of the distributed grid
*
* ### WIKI END ###
*
*/
int main(int argc, char* argv[])
{
//
// ### WIKI 2 ###
//
// Initialize the library and several objects
//
init_global_v_cluster(&argc,&argv);
//
// ### WIKI 3 ###
//
// Create
// * A 3D box that define the domain
// * an array of 3 unsigned integer that will define the size of the grid on each dimension
// * A Ghost object that will define the extension of the ghost part for each sub-domain in physical units
Box<3,float> domain({0.0,0.0,0.0},{1.0,1.0,1.0});
size_t sz[3];
sz[0] = 100;
sz[1] = 100;
sz[2] = 100;
// Ghost
Ghost<3,float> g(0.01);
//
// ### WIKI 4 ###
//
// Create a distributed grid in 3D (1° template parameter) space in with float precision (2° template parameter)
// each grid point contain a vector of dimension 3 (float[3]),
// using a CartesianDecomposition strategy (4° parameter) (the parameter 1° and 2° inside CartDecomposition must match 1° and 2°
// of grid_dist_id)
//
// Constructor parameters:
//
// * sz: size of the grid on each dimension
// * domain: where the grid is defined
// * g: ghost extension
//
grid_dist_id<3, float, aggregate<float[3]>, CartDecomposition<3,float>> g_dist(sz,domain,g);
// ### WIKI 5 ###
//
// Get an iterator that go through the points of the grid (No ghost)
//
auto dom = g_dist.getDomainIterator();
// ### WIKI END ###
size_t count = 0;
// Iterate over all the points
while (dom.isNext())
{
//
// ### WIKI 6 ###
//
// Get the local grid key, the local grid key store internally the sub-domain id (each sub-domain contain a grid)
// and the local grid point id identified by 2 integers in 2D 3 integer in 3D and so on. These two distinct elements are
// available with key.getSub() and key.getKey()
//
auto key = dom.get();
//
// ### WIKI 7 ###
//
// Here we convert the local grid position, into global position, key_g contain 3 integers that identify the position
// of the grid point in global coordinates
//
//
auto key_g = g_dist.getGKey(key);
//
// ### WIKI 8 ###
//
// we write on the grid point of position (i,j,k) the value i*i + j*j + k*k on the component [0] of the vector
g_dist.template get<0>(key)[0] = key_g.get(0)*key_g.get(0) + key_g.get(1)*key_g.get(1) + key_g.get(2)*key_g.get(2);
// ### WIKI END ###
// Count the points
count++;
//
// ### WIKI 9 ###
//
// next point
++dom;
// ### WIKI END ###
}
//
// ### WIKI 10 ###
//
// Each sub-domain has an extended part, that is materially contained from another processor that in general is not synchronized
// ghost_get<0> synchronize the property 0 (the vector) in the ghost part
//
//
g_dist.template ghost_get<0>();
//
// ### WIKI 11 ###
//
// count contain the number of points the local processor contain, if we are interested to count the total number across the processor
// we can use the function add, to sum across processors. First we have to get an instance of Vcluster, queue an operation of add with
// the variable count and finally execute. All the operation are asynchronous, execute work like a barrier and ensure that all the
// queued operations are executed
//
Vcluster & vcl = g_dist.getVC();
vcl.sum(count);
vcl.execute();
// only master output
if (vcl.getProcessUnitID() == 0)
std::cout << "Number of points: " << count << "\n";
//
// ### WIKI 12 ###
//
// Finally we want a nice output to visualize the information stored by the distributed grid
//
g_dist.write("output");
//
// ### WIKI 13 ###
//
// For debugging purpose and demonstration we output the decomposition
//
g_dist.getDecomposition().write("out_dec");
//
// ### WIKI 14 ###
//
// Deinitialize the library
//
delete_global_v_cluster();
}
include ../../example.mk
CC=mpic++
LDIR =
OBJ = main.o
%.o: %.cpp
$(CC) -O3 -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
stencil: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
all: stencil
.PHONY: clean all
clean:
rm -f *.o *~ core stencil
[pack]
files = main.cpp Makefile
#include "Grid/grid_dist_id.hpp"
#include "data_type/aggregate.hpp"
#include "Decomposition/CartDecomposition.hpp"
/*
* ### WIKI 1 ###
*
* ## Simple example
*
* This example show how to move grid_key in order to create a Laplacian stencil,
* be careful, the function move are convenient, but not the fastest implementation
*
* ### WIKI END ###
*
*/
/*
*
* ### WIKI 2 ###
*
* Define some convenient constants and types
*
*/
constexpr size_t x = 0;
constexpr size_t y = 1;
constexpr size_t z = 2;
constexpr size_t A = 0;
constexpr size_t B = 0;
typedef aggregate<float[3],float[3]> grid_point;
int main(int argc, char* argv[])
{
//
// ### WIKI 3 ###
//
// Initialize the library and several objects
//
init_global_v_cluster(&argc,&argv);
//
// ### WIKI 4 ###
//
// Create several object needed later, in particular
// * A 3D box that define the domain
// * an array of 3 unsigned integer that define the size of the grid on each dimension
// * A Ghost object that will define the extension of the ghost part for each sub-domain in physical units
Box<3,float> domain({0.0,0.0,0.0},{1.0,1.0,1.0});
size_t sz[3];
sz[0] = 100;
sz[1] = 100;
sz[2] = 100;
// Ghost
Ghost<3,float> g(0.03);
//
// ### WIKI 4 ###
//
// Create a distributed grid in 3D (1° template parameter) space in with float precision (2° template parameter)
// each grid point contain a vector of dimension 3 (float[3]),
// using a CartesianDecomposition strategy (4° parameter) (the parameter 1° and 2° inside CartDecomposition must match 1° and 2°
// of grid_dist_id)
//
// Constructor parameters:
//
// * sz: size of the grid on each dimension
// * domain: where the grid is defined
// * g: ghost extension
//
grid_dist_id<3, float, grid_point, CartDecomposition<3,float>> g_dist(sz,domain,g);
// ### WIKI 5 ###
//
// Get an iterator that go throught the point of the domain (No ghost)
//
auto dom = g_dist.getDomainIterator();
// ### WIKI END ###
while (dom.isNext())
{
//
// ### WIKI 6 ###
//
// Get the local grid key, the local grid key store internally the sub-domain id (each sub-domain contain a grid)
// and the local grid point id identified by 2 integers in 2D 3 integer in 3D and so on. These two distinct elements are
// available with key.getSub() and key.getKey()
//
auto key = dom.get();
//
// ### WIKI 7 ###
//
// Here we convert the local grid position, into global position, key_g contain 3 integers that identify the position
// of the grid point in global coordinates
//
//
auto key_g = g_dist.getGKey(key);
//
// ### WIKI 8 ###
//
// we write on the grid point of position (i,j,k) the value i*i + j*j + k*k on the component [0] of the vector
g_dist.template get<0>(key)[0] = key_g.get(0)*key_g.get(0) + key_g.get(1)*key_g.get(1) + key_g.get(2)*key_g.get(2);
//
// ### WIKI 9 ###
//
// next point
++dom;
// ### WIKI END ###
}
//
// ### WIKI 10 ###
//
// Each sub-domain has an extended part, that is materially contained from another processor that in general is not synchronized
// ghost_get<0> synchronize the property 0 (the vector) in the ghost part
//
//
g_dist.template ghost_get<0>();
//
// ### WIKI 11 ###
//
// Get again another iterator, iterate across all the domain points, calculating a Laplace stencil
//
//
auto dom2 = g_dist.getDomainIterator();
while (dom2.isNext())
{
auto key = dom2.get();
// Laplace stencil
g_dist.template get<B>(key)[1] = g_dist.template get<A>(key.move(x,1))[0] + g_dist.template get<A>(key.move(x,-1))[0] +
g_dist.template get<A>(key.move(y,1))[0] + g_dist.template get<A>(key.move(y,-1))[0] +
g_dist.template get<A>(key.move(z,1))[0] + g_dist.template get<A>(key.move(z,-1))[0] -
6*g_dist.template get<A>(key)[0];
++dom2;
}
//
// ### WIKI 12 ###
//
// Finally we want a nice output to visualize the information stored by the distributed grid
//
g_dist.write("output");
//
// ### WIKI 14 ###
//
// Deinitialize the library
//
delete_global_v_cluster();
}
SUBDIRS := $(wildcard */.)
all clean:
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir $@; \
done
clean: $(SUBDIRS)
.PHONY: all clean $(SUBDIRS)
SUBDIRS := $(wildcard */.)
all clean:
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir $@; \
done
clean: $(SUBDIRS)
.PHONY: all clean $(SUBDIRS)
SUBDIRS := $(wildcard */.)
all clean:
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir $@; \
done
clean: $(SUBDIRS)
.PHONY: all clean $(SUBDIRS)
include ../../../example.mk
CC=mpic++
LDIR =
OBJ = main.o
%.o: %.cpp
$(CC) -O3 -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
pse_1d: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
all: pse_1d
.PHONY: clean all
clean:
rm -f *.o *~ core pse_1d
/*
* ### WIKI 1 ###
*
* ## Simple example
*
* In this example we show 1D PSE derivative function approximation
*
* ### WIKI END ###
*
*/
#include "Vector/vector_dist.hpp"
#include "Decomposition/CartDecomposition.hpp"
#include "Kernels.hpp"
#include "data_type/aggregate.hpp"
#include <cmath>
/*
* ### WIKI 2 ###
*
* Here we define the function x*e^(-x*x) and its
* second derivative in analytic form
*
* 2x*(2*x-3)*e^(-x^2)
*
*/
double f_xex2(double x)
{
return x*exp(-x*x);
}
double f_xex2(Point<1,double> & x)
{
return x.get(0)*exp(-x.get(0)*x.get(0));
}
double Lapf_xex2(Point<1,double> & x)
{
return 2.0*x.get(0)*(2.0*x.get(0)*x.get(0) - 3.0)*exp(-x.get(0)*x.get(0));
}
/*
*
* ### WIKI END ###
*
*/
int main(int argc, char* argv[])
{
//
// ### WIKI 3 ###
//
// Some useful parameters. Like
//
// * Number of particles
// * Minimum number of padding particles
// * The computational domain
// * The spacing
// * The mollification length
// * Second order Laplacian kernel in 1D
//
// Number of particles
const size_t Npart = 1000;
// Number of padding particles (At least)
const size_t Npad = 20;
// The domain
Box<1,double> box({0.0},{4.0});
// Calculated spacing
double spacing = box.getHigh(0) / Npart;
// Epsilon of the particle kernel
const double eps = 2*spacing;
// Laplacian PSE kernel 1 dimension, on double, second order
Lap<1,double,2> lker(eps);
//
// ### WIKI 2 ###
//
// Here we Initialize the library and we define Ghost size
// and non-periodic boundary conditions
//
init_global_v_cluster(&argc,&argv);
Vcluster & v_cl = *global_v_cluster;
size_t bc[1]={NON_PERIODIC};
Ghost<1,double> g(12*eps);
//
// ### WIKI 3 ###
//
// Here we are creating a distributed vector defined by the following parameters
//
// we create a set of N+1 particles to have a fully covered domain of particles between 0.0 and 4.0
// Suppose we have a spacing given by 1.0 you need 4 +1 particles to cover your domain
//
vector_dist<1,double, aggregate<double>, CartDecomposition<1,double> > vd(Npart+1,box,bc,g);
//
// ### WIKI 4 ###
//
// We assign the position to the particles, the scalar property is set to
// the function x*e^(-x*x) value.
// Each processor has parts of the particles and fill part of the space, the
// position is assigned independently from the decomposition.
//
// In this case, if there are 1001 particles and 3 processors the in the
// domain from 0.0 to 4.0
//
// * processor 0 place particles from 0.0 to 1.332 (334 particles)
// * processor 1 place particles from 1.336 to 2.668 (334 particles)
// * processor 2 place particles from 2.672 to 4.0 (333 particles)
//
// It return how many particles the processors with id < rank has in total
size_t base = vd.init_size_accum(Npart+1);
auto it2 = vd.getIterator();
while (it2.isNext())
{
auto key = it2.get();
// set the position of the particles
vd.template getPos<0>(key)[0] = (key.getKey() + base) * spacing;
//set the property of the particles
vd.template getProp<0>(key) = f_xex2((key.getKey() + base) * spacing);
++it2;
}
//
// ### WIKI 5 ###
//
// Once defined the position, we distribute them across the processors
// following the decomposition, finally we get the ghost part
//
vd.map();
vd.ghost_get<0>();
//
// ### WIKI 6 ###
//
// near the boundary we have two options, or we use one sided kernels,
// or we add additional particles, it is required that such particles
// produces a 2 time differentiable function. In order to obtain such
// result we extend for x < 0.0 and x > 4.0 with the test function xe^(-x*x).
//
// Note that for x < 0.0 such extension is equivalent to mirror the
// particles changing the sign of the strength
//
// \verbatim
//
// 0.6 -0.5 0.5 0.6 Strength
// +----+----*----*----*-
// 0.0 Position
//
// with * = real particle
// + = mirror particle
//
// \endverbatim
//
//
Box<1,double> m_pad({0.0},{0.1});
Box<1,double> m_pad2({3.9},{4.0});
double enlarge = 0.1;
// Create a box
if (Npad * spacing > 0.1)
{
m_pad.setHigh(0,Npad * spacing);
m_pad2.setLow(0,4.0 - Npad*spacing);
enlarge = Npad * spacing;
}
auto it = vd.getDomainIterator();
while (it.isNext())
{
auto key = it.get();
// set the position of the particles
if (m_pad.isInsideNB(vd.template getPos<0>(key)) == true)
{
vd.add();
vd.template getLastPos<0>()[0] = - vd.template getPos<0>(key)[0];
vd.template getLastProp<0>() = - vd.template getProp<0>(key);
}
// set the position of the particles
if (m_pad2.isInsideNB(vd.template getPos<0>(key)) == true)
{
vd.add();
vd.template getLastPos<0>()[0] = 2.0 * box.getHigh(0) - vd.template getPos<0>(key)[0];
vd.template getLastProp<0>() = f_xex2(vd.template getLastPos<0>()[0]);
}
++it;
}
//
// ### WIKI 6 ###
//
// We create a CellList with cell spacing 12 sigma
//
// get and construct the Cell list
Ghost<1,double> gp(enlarge);
auto cl = vd.getCellList(8*eps,gp);
// Maximum infinity norm
double linf = 0.0;
//
// ### WIKI 6 ###
//
// For each particle get the neighborhood of each particle
//
// This cycle is literally the formula from PSE operator approximation
//
//
//
//
auto it_p = vd.getDomainIterator();
while (it_p.isNext())
{
// double PSE integration accumulator
double pse = 0;
// key
vect_dist_key_dx key = it_p.get();
// Get the position of the particles
Point<1,double> p = vd.template getPos<0>(key);
// We are not interested in calculating out the domain
// note added padding particle are considered domain particles
if (p.get(0) < 0.0 || p.get(0) >= 4.0)
{
++it_p;
continue;
}
// Get f(x) at the position of the particle
double prp_x = vd.template getProp<0>(key);
// Get the neighborhood of the particles
auto NN = cl.template getNNIterator<NO_CHECK>(cl.getCell(p));
while(NN.isNext())
{
auto nnp = NN.get();
// Calculate contribution given by the kernel value at position p,
// given by the Near particle
if (nnp != key.getKey())
{
// W(x-y)
double ker = lker.value(p,vd.template getPos<0>(nnp));
// f(y)
double prp_y = vd.template getProp<0>(nnp);
// 1.0/(eps)^2 [f(y)-f(x)]*W(x,y)*V_q
double prp = 1.0/eps/eps * (prp_y - prp_x) * spacing;
pse += prp * ker;
}
// Next particle
++NN;
}
// Here we calculate the L_infinity norm or the maximum difference
// of the analytic solution from the PSE calculated
double sol = Lapf_xex2(p);
if (fabs(pse - sol) > linf)
linf = fabs(pse - sol);
++it_p;
}
//
// ### WIKI 7 ###
//
// Calculate the maximum infinity norm across processors and
// print it
//
v_cl.max(linf);
v_cl.execute();
if (v_cl.getProcessUnitID() == 0)
std::cout << "Norm infinity: " << linf << "\n";
//
// ### WIKI 8 ###
//
// Deinitialize the library
//
delete_global_v_cluster();
}
SUBDIRS := $(wildcard */.)
all clean:
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir $@; \
done
clean: $(SUBDIRS)
.PHONY: all clean $(SUBDIRS)