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
Showing
with 0 additions and 3851 deletions
#!groovy
parallel (
"nyu" : {node ('nyu')
{
deleteDir()
checkout scm
stage ('build_nyu')
{
sh "./build.sh $WORKSPACE $NODE_NAME pdata"
}
stage ('run_nyu')
{
parallel (
"1" : {sh "./run.sh $WORKSPACE $NODE_NAME 1"},
"2" : {sh "./run.sh $WORKSPACE $NODE_NAME 2"},
"3" : {sh "./run.sh $WORKSPACE $NODE_NAME 3"})
sh "./run.sh $WORKSPACE $NODE_NAME 5"
sh "./success.sh 2 nyu opefpm_pdata"
}
}
},
"sb15" : {node ('sbalzarini-mac-15')
{
deleteDir()
env.PATH = "/usr/local/bin:${env.PATH}"
checkout scm
stage ('build_sb15')
{
sh "./build.sh $WORKSPACE $NODE_NAME pdata"
}
stage ('run_sb15')
{
parallel (
"1" : {sh "./run.sh $WORKSPACE $NODE_NAME 1"},
"2" : {sh "./run.sh $WORKSPACE $NODE_NAME 2"},
"3" : {sh "./run.sh $WORKSPACE $NODE_NAME 3"}
)
sh "./run.sh $WORKSPACE $NODE_NAME 4"
sh "./run.sh $WORKSPACE $NODE_NAME 5"
sh "./run.sh $WORKSPACE $NODE_NAME 6"
sh "./run.sh $WORKSPACE $NODE_NAME 7"
sh "./success.sh 2 sbalzarini-mac-15 opefpm_pdata"
}
}
},
"gin" : {node ('gin')
{
deleteDir()
env.PATH = "/usr/local/bin:${env.PATH}"
checkout scm
stage ('build_gin')
{
sh "./build.sh $WORKSPACE $NODE_NAME pdata"
}
stage ('run_gin')
{
parallel (
"p1" : {sh "./run.sh $WORKSPACE $NODE_NAME 1"},
"p2" : {sh "./run.sh $WORKSPACE $NODE_NAME 2"},
"p3" : {sh "./run.sh $WORKSPACE $NODE_NAME 3"},
"p4" : {sh "./run.sh $WORKSPACE $NODE_NAME 5"}
)
sh "./success.sh 2 gin opefpm_pdata"
}
}
}
)
#!groovy
parallel (
"gin" : {node ('gin')
{
deleteDir()
checkout scm
stage ('build_gin')
{
sh "./build.sh $WORKSPACE $NODE_NAME pdata full && make install"
}
stage ('run_example_gin')
{
sh "source $HOME/openfpm_vars && cd example && make"
}
}},
"sb15" : {node ('sbalzarini-mac-15')
{
deleteDir()
checkout scm
env.PATH = "/usr/local/bin:${env.PATH}"
stage ('build_sb15')
{
sh "./build.sh $WORKSPACE $NODE_NAME pdata full && make install"
}
stage ('run_example_sb15')
{
sh "source $HOME/openfpm_vars && cd example && make"
}
}
}
)
#!groovy
parallel (
"gin" : {node ('gin')
{
deleteDir()
checkout scm
stage ('build_gin')
{
sh "./build.sh $WORKSPACE $NODE_NAME numerics"
}
stage ('run_gin')
{
parallel (
"1" : {sh "cd openfpm_numerics && ./run.sh $WORKSPACE $NODE_NAME 1"},
"2" : {sh "cd openfpm_numerics && ./run.sh $WORKSPACE $NODE_NAME 2"},
"3" : {sh "cd openfpm_numerics && ./run.sh $WORKSPACE $NODE_NAME 3"},
"4" : {sh "cd openfpm_numerics && ./run.sh $WORKSPACE $NODE_NAME 4"}
)
sh "./success.sh 2 gin openfpm_numerics"
}
}
},
"sb15" : {node ('sbalzarini-mac-15')
{
deleteDir()
env.PATH = "/usr/local/bin:${env.PATH}"
checkout scm
stage ('build_sb15')
{
sh "./build.sh $WORKSPACE $NODE_NAME numerics"
}
stage ('run_sb15')
{
parallel (
"1" : {sh "cd openfpm_numerics && ./run.sh $WORKSPACE $NODE_NAME 1"},
"2" : {sh "cd openfpm_numerics && ./run.sh $WORKSPACE $NODE_NAME 2"},
"3" : {sh "cd openfpm_numerics && ./run.sh $WORKSPACE $NODE_NAME 3"},
"4" : {sh "cd openfpm_numerics && ./run.sh $WORKSPACE $NODE_NAME 4"}
)
sh "./success.sh 2 sbalzarini-mac-15 openfpm_numerics"
}
}
}
)
SUBDIRS = src images openfpm_data openfpm_io openfpm_devices openfpm_vcluster openfpm_numerics
bin_PROGRAMS =
pdata:
cd src && make
data:
cd openfpm_data/src && make
devices:
cd openfpm_devices/src && make
vcluster:
cd openfpm_vcluster/src && make
io:
cd openfpm_io/src && make
numerics:
cd openfpm_numerics/src && make
test_pdata:
cd src && make test
test_data:
cd openfpm_data/src && make test
test_devices:
cd openfpm_devices/src && make test
test_vcluster:
cd openfpm_vcluster/src && make test
test_io:
cd openfpm_io/src && make test
test_numerics:
cd openfpm_numerics/src && make test
test: test_devices test_data test_vcluster test_pdata test_io test_numerics
.PHONY: test_pdata test_data test_devices test_vcluster test_io test_numerics
Openfpm is a library for computer simulation, but with our documentation it is also a valid resource
to drive people to do simulation.
There are at the moment 3 way to try openfpm.
1) Without installation: We provide ready to use Docker image compatible with codenvy and IDE on browser. More ...
2) We provide Docker image, Ubuntu Virtual Machine and OSX Virtual Machine with OpenFPM preinstalled. More ...
3) Installation from source. More ...
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
if [ "$2" == "gin" ]
then
echo "Compiling on gin\n"
source ~/.bashrc
module load gcc/4.9.2
if [ x"$4" == x"full" ]; then
./install -s -c "--prefix=/home/jenkins/openfpm_install"
elif [ x"$3" == x"numerics" ]; then
./install -m -s -c "--prefix=/home/jenkins/openfpm_install"
make $3
else
./install -m -s -c "--prefix=/home/jenkins/openfpm_install --no-recursion"
make $3
fi
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
source $HOME/openfpm_vars
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 -m -s -c "--with-boost=/sw/apps/boost/1.54.0/ CXX=mpic++ --no-recursion"
make $3
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" == "taurus" ]
then
echo "Compiling on taurus"
source /etc/profile
echo "$PATH"
module load eigen/3.2.0
module load suitesparse/4.2.1-gnu-multimkl
module load boost/1.60.0
module load gcc/5.3.0
module load openmpi/1.10.2-gnu
module unload bullxmpi
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/incard/PARMETIS/lib:/home/incard/METIS/lib:/home/incard/HDF5/lib"
./install -m -i "/scratch/p_ppm/" -s -c"CXX=mpic++ --no-recursion"
make $3
source $HOME/openfpm_vars
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
if [ x"$4" == x"full" ]; then
./install -s -c "--prefix=/Users/jenkins/openfpm_install"
elif [ x"$3" == x"numerics" ]; then
./install -m -s -c "--prefix=/home/jenkins/openfpm_install"
make $3
else
./install -m -s -c "--prefix=/Users/jenkins/openfpm_install --no-recursion"
make $3
fi
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
#! /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
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
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
make install
source $HOME/openfpm_vars
if [ x"$3" == x"no_test" ]; then
exit 0;
fi
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
source $HOME/openfpm_vars
## 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 eigen/3.2.0
module load suitesparse/4.2.1-gnu-multimkl
module load boost/1.60.0
module load gcc/5.3.0
module load openmpi/1.10.2-gnu
module unload bullxmpi
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/incard/PARMETIS/lib:/home/incard/METIS/lib:/home/incard/HDF5/lib"
./install -i "/scratch/p_ppm/" -s -c"CXX=mpic++"
make
source $HOME/openfpm_vars
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
export
which salloc
salloc --nodes=1 --ntasks-per-node=24 --time=00:15: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 --time=00:15: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 --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 --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 --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
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
if [ x"$3" == x"no_test" ]; then
exit 0;
fi
source $HOME/openfpm_vars
mpirun -np 1 ./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 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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
#! /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
if [ "$2" == "taurus" ]; then
echo "Compiling on taurus with intel compiler"
source /etc/profile
echo "$PATH"
module load gcc/4.9.3
module load intel/2017.0.020
echo "3" > input_install
echo "1" >> input_install
echo "1" >> input_install
echo "24" >> input_install
echo "y" >> input_install
./install -i "/scratch/p_ppm/openfpm_deps_intel" < input_install
fi
# -*- 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([subdir-objects])
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([IMMDX_LIB_PARMETIS],,[m4_include([m4/immdx_lib_parmetis.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_LIB_PETSC],,[m4/ax_petsc_lib.m4])
m4_ifdef([AX_LIB_HILBERT],,[m4/ax_libhilbert.m4])
case $host_os in
*darwin*|*macosx*)
CXXFLAGS+=" --std=c++11 "
AC_DEFINE([HAVE_OSX],[],[We have OSX])
;;
*cygwin*)
# Do something specific for cygwin
CXXFLAGS+=" --std=gnu++11 "
;;
*)
#Default Case
CXXFLAGS+=" --std=c++11 "
;;
esac
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 LIBHILBERT
AX_LIB_HILBERT([],[echo "Cannot detect libhilbert, use the --with-libhilbert option if it is not installed in the default location"
exit 210])
##########
## Check for PETSC
AX_LIB_PETSC()
## Check for quadmath
have_quad_lib=no
have_quad_head=no
AC_CHECK_LIB(quadmath, sinq, [have_quad_lib=yes], [])
AC_CHECK_HEADER(quadmath.h,[have_quad_head=yes],[])
if [x"have_quad_math" == x"yes" $&& x"have_quad_math" == x"yes" ]; then
AC_DEFINE(HAVE_LIBQUADMATH,[],[Have quad math lib])
LIBQUADMATH=" -lquadmath "
fi
AC_CHECK_LIB(ifcore, for_cpystr, [ LIBIFCORE=-lifcore ], [ LIBIFCORE= ])
AC_SUBST(LIBIFCORE)
AC_SUBST(OPENMP_CFLAGS)
AC_SUBST(OPENMP_LDFLAGS)
echo "$OPENMP_CFLAGS" > openmp_flags
########
## 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
###### Checking for compiler flags -fext-numeric-literals
AC_LANG_PUSH([C++])
my_save_cflags="$CXXFLAGS"
CXXFLAGS=-fext-numeric-literals
AC_MSG_CHECKING([whether CXX supports -fext-numeric-literals])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])
AM_CXXFLAGS="-fext-numeric-literals"
echo "-fext-numeric-literals" > openfpm_flags
],
[
AC_MSG_RESULT([no])
echo "" > openfpm_flags
]
)
AC_LANG_POP([C++])
CXXFLAGS="$my_save_cflags"
AC_SUBST([AM_CXXFLAGS])
## Check for parMetis
IMMDX_LIB_PARMETIS([],[echo "Cannot detect parmetis, use the --with-parmetis option if it is not installed in the default location"
exit 208])
####### 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 unit test framework not usable"
exit 202
fi
if test x"$ax_cv_boost_iostreams" = x"no"; then
echo "Notify boost iostream not usable"
exit 202
fi
if test x"$ax_cv_boost_programs_options" = x"no"; then
echo "Notify boost program options 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)
AX_BLAS([],[])
AX_LAPACK([],[])
###### Checking for SUITESPARSE
AX_SUITESPARSE([],[])
###### Checking for EIGEN
AX_EIGEN([],[])
###### RT runtime lib
AC_CHECK_LIB(rt, clock_gettime, [AC_DEFINE([HAVE_CLOCK_GETTIME],[],[Have clock time])
OPT_LIBS="$OPT_LIBS -lrt"
])
####### 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)
AC_SUBST(OPT_LIBS)
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_CONFIG_FILES([Makefile src/Makefile images/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
run: all
mpirun -np 2 ./grid
.PHONY: clean all run
clean:
rm -f *.o *~ core grid
[pack]
files = main.cpp Makefile
#include "Grid/grid_dist_id.hpp"
#include "data_type/aggregate.hpp"
/*! \page grid Grid
*
* \subpage grid_0_simple
* \subpage Grid_1_stencil
* \subpage Grid_2_solve_eq
* \subpage Grid_3_gs
*
*/
/*! \page grid_0_simple Grid 0 simple
[TOC]
# Simple grid example # {#simple_grid_example}
This example show several basic functionalities of the distributed grid
\htmlonly
<a href="#" onclick="if (document.getElementById('grid-video-1').style.display == 'none') {document.getElementById('grid-video-1').style.display = 'block'} else {document.getElementById('grid-video-1').style.display = 'none'}" >Video</a>
<div style="display:none" id="grid-video-1">
<video id="vid1" width="1200" height="576" controls> <source src="http://ppmcore.mpi-cbg.de/upload/video/Lesson1-1.mp4" type="video/mp4"></video><script>document.getElementById('vid1').addEventListener('loadedmetadata', function() {this.currentTime = 236;}, false);</script>
</div>
\endhtmlonly
*/
int main(int argc, char* argv[])
{
/*! \page grid_0_simple Grid 0 simple
*
* ## Initialization ## {#e0_s_initialization}
*
* Here we:
* * Initialize the library
* * Create A 3D box that define our the domain
* * an array of 3 unsigned integer that will define the size of the grid on each dimensions
* * A Ghost object that will define the extension of the ghost part in physical units
*
* \snippet Grid/0_simple/main.cpp initialization
*
*/
//! \cond [initialization] \endcond
// Initialize the library
openfpm_init(&argc,&argv);
// 3D physical domain
Box<3,float> domain({0.0,0.0,0.0},{1.0,1.0,1.0});
// Grid size on eaxh dimension
size_t sz[3] = {100,100,100};
// Ghost part
Ghost<3,float> g(0.01);
//! \cond [initialization] \endcond
/*! \page grid_0_simple Grid 0 simple
*
* ## Grid instantiation ## {#e0_s_grid_inst}
*
* Here we are creating a distributed grid in defined by the following parameters
*
* * 3 dimensionality of the grid
* * float Type used for the spatial coordinates
* * each grid point contain a vector of dimension 3 (float[3]),
* * float[3] is the information stored by each grid point a float[3]
* the list of properties must be put into an aggregate data structure aggregate<prop1,prop2,prop3, ... >
*
* Constructor parameters:
*
* * sz: size of the grid on each dimension
* * domain: where the grid is defined
* * g: ghost extension
*
* \snippet Grid/0_simple/main.cpp grid instantiation
*
*/
//! \cond [grid instantiation] \endcond
grid_dist_id<3, float, aggregate<float[3]>> g_dist(sz,domain,g);
//! \cond [grid instantiation] \endcond
/*!
* \page grid_0_simple Grid 0 simple
*
* ## Loop over grid points ## {#e0_s_loop_gp}
*
* Get an iterator that go through all the grid points. In this
* example we use iterators. Iterators are convenient way to explore/iterate data-structures in an
* convenient and easy way.
*
* \snippet Grid/0_simple/main.cpp get iterator
* \snippet Grid/0_simple/main.cpp get iterator2
*
*/
//! \cond [get iterator] \endcond
// Get the iterator (No ghost)
auto dom = g_dist.getDomainIterator();
// Counter
size_t count = 0;
// Iterate over all the grid points
while (dom.isNext())
{
//! \cond [get iterator] \endcond
/*!
* \page grid_0_simple Grid 0 simple
*
* ## Grid coordinates ## {#e0_s_grid_coord}
*
* Get the local grid key, one local grid key* identify one point in the grid and store the local grid coordinates of such point
*
* <sub><sup>(*)Internally a local grid store 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().</sup></sub>
*
* \snippet Grid/0_simple/main.cpp local grid
*
*/
//! \cond [local grid] \endcond
// local grid key from iterator
auto key = dom.get();
//! \cond [local grid] \endcond
/*!
* \page grid_0_simple Grid 0 simple
*
* **Short explanation**
*
* In oder to get the real/global coordinates of the grid point we have to convert the object key with getGKey
*
*/
/*!
*
* \page grid_0_simple Grid 0 simple
*
\htmlonly <a href="#" onclick="if (document.getElementById('long-explanation-div').style.display == 'none') {document.getElementById('long-explanation-div').style.display = 'block'} else {document.getElementById('long-explanation-div').style.display = 'none'}" >Long Explanation</a> \endhtmlonly
*
*
\htmlonly
<div style="display:none" id="long-explanation-div">
<p>Even if the local grid key identify an unique point in the grid, it does not store the real/global coordinates of the points in grid units.</p>
<p>Consider this scheme</p>
<pre class="fragment">
+-----+-----+--*--+-----+-----+-----+ (6,6)
| | P1,3 |
| P1,1 *--------------------*
| | P1,2 |
+ + + | + + + +
| *--------------------*
*--------------* |
| | |
+ + + | + + + +
| | |
| P0,2 | P1,0 |
| | |
+ + + | # + + +
| | |
*--------------* |
| *--------------------*
+ + + | + + + +
| | |
| P0,0 | P0,1 |
| | |
+-----+-----+--*--+-----+-----+-----+
(0,0) (6,0)
+,# = grid point
*--*
| | = uderline decomposition in sub-domain
*--*
PX,Y Processor X, sub-domain Y</pre><p>The point # has</p>
<ul>
<li>Global/Real coordinates are (3,2)</li>
<li>Local grid coordinates are Sub-domain = 0, grid position = (0,0)</li>
</ul>
<p>Here we convert the local grid coordinates, into global coordinates. key_g internally store 3 integers that identify the position of the grid point in global coordinates</p>
<p>
</div>
\endhtmlonly
*/
/*! \page grid_0_simple Grid 0 simple
*
* \snippet Grid/0_simple/main.cpp global coord
*
*/
//! \cond [global coord] \endcond
auto key_g = g_dist.getGKey(key);
//! \cond [global coord] \endcond
/*!
* \page grid_0_simple Grid 0 simple
*
* ## Assign properties ## {#grid_assign}
*
* Each grid point has a vector property we write on the vector coordinates the global coordinate of the grid point.
* At the same time we also count the points
*
* \snippet Grid/0_simple/main.cpp assign
*
*/
//! \cond [assign] \endcond
g_dist.template get<0>(key)[0] = key_g.get(0);
g_dist.template get<0>(key)[1] = key_g.get(1);
g_dist.template get<0>(key)[2] = key_g.get(2);
// Count the points
count++;
//! \cond [assign] \endcond
//! \cond [get iterator2] \endcond
//! ...
// next point
++dom;
}
//! \cond [get iterator2] \endcond
/*!
* \page grid_0_simple Grid 0 simple
*
* Each sub-domain has an extended part, that is materially contained in
* another processor. The function ghost_get guarantee (after return) that this extended part
* is perfectly synchronized with the other processor.
*
* \snippet Grid/0_simple/main.cpp ghost get
*
*/
//! \cond [ghost get] \endcond
g_dist.template ghost_get<0>();
//! \cond [ghost get] \endcond
/*!
* \page grid_0_simple Grid 0 simple
*
* 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 sum, to sum numbers across processors. First we have to get an instance of Vcluster, queue an operation of sum 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
*
* \snippet Grid/0_simple/main.cpp reduce
*
*/
//! \cond [reduce] \endcond
// Get the VCluster object
Vcluster & vcl = create_vcluster();
// queue an operation of sum for the counter count
vcl.sum(count);
// execute the operation
vcl.execute();
// only master output
if (vcl.getProcessUnitID() == 0)
std::cout << "Number of points: " << count << "\n";
//! \cond [reduce] \endcond
/*!
* \page grid_0_simple Grid 0 simple
*
* ## VTK and visualization ## {#e0_s_VTK_vis}
*
* Finally we want a nice output to visualize the information stored by the distributed grid.
* The function write by default produce VTK files. One for each processor that can be visualized
* with the programs like paraview
*
* \snippet Grid/0_simple/main.cpp write
*
*/
//! \cond [write] \endcond
g_dist.write("output");
//! \cond [write] \endcond
/*!
* \page grid_0_simple Grid 0 simple
*
* ## Decomposition ## {#grid_dec}
*
* For debugging purpose and demonstration we also output the decomposition of the
* space across processor. This function produce VTK files that can be visualized with Paraview
*
* \snippet Grid/0_simple/main.cpp out_dec
*
*/
//! \cond [out_dec] \endcond
g_dist.getDecomposition().write("out_dec");
//! \cond [out_dec] \endcond
/*!
* \page grid_0_simple Grid 0 simple
*
* ## Finalize ## {#finalize}
*
* At the very end of the program we have always to de-initialize the library
*
* \snippet Vector/0_simple/main.cpp finalize
*
*/
//! \cond [finalize] \endcond
openfpm_finalize();
//! \cond [finalize] \endcond
/*!
* \page grid_0_simple Grid 0 simple
*
* # Full code # {#code}
*
* \include Grid/0_simple/main.cpp
*
*/
}
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
run: all
mpirun -np 3 ./stencil
.PHONY: clean all run
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"
/*!
* \page Grid_1_stencil Grid 1 stencil
*
*
* # Stencil example and ghost # {#e1_st}
*
* This example show how to move grid_key in order to create a Laplacian stencil,
* be careful, the function move is convenient, but not the fastest implementation.
* We also show how to do ghost communications
*
*/
/*!
* \page Grid_1_stencil Grid 1 stencil
*
* Define some convenient constants and types
*
* \snippet Grid/1_stencil/main.cpp useful constant
*
*/
//! \cond [useful constant] \endcond
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;
//! \cond [useful constant] \endcond
int main(int argc, char* argv[])
{
/*!
* \page Grid_1_stencil Grid 1 stencil
*
* ## Initialization ## {#e1_st_init}
*
* Initialize the library and several objects
*
* \see \ref e0_s_initialization
*
* \snippet Grid/1_stencil/main.cpp parameters
*
*
*/
//! \cond [parameters] \endcond
openfpm_init(&argc,&argv);
// domain
Box<3,float> domain({0.0,0.0,0.0},{1.0,1.0,1.0});
// grid sizes
size_t sz[3] = {100,100,100};
// ghost extension
Ghost<3,float> g(0.03);
//! \cond [parameters] \endcond
/*!
* \page Grid_1_stencil Grid 1 stencil
*
* ## Grid create ## {#e1_st_inst}
*
* Create a distributed grid in 3D. With typedef we create an alias name for aggregate<float[3],float[3]>.
* In practice the type of grid_point == aggregate<float[3],float[3]>
*
* \see \ref e0_s_grid_inst
*
* \snippet Grid/1_stencil/main.cpp grid
*
*/
//! \cond [grid] \endcond
// a convenient alias for aggregate<...>
typedef aggregate<float,float> grid_point;
grid_dist_id<3, float, grid_point> g_dist(sz,domain,g);
//! \cond [grid] \endcond
/*!
* \page Grid_1_stencil Grid 1 stencil
*
* ## Loop over grid points ## {#e1_s_loop_gp}
*
* Get an iterator that go through the point of the domain (No ghost)
*
* \see \ref e0_s_loop_gp
*
* \snippet Grid/1_stencil/main.cpp iterator
* \snippet Grid/1_stencil/main.cpp iterator2
*
*/
//! \cond [iterator] \endcond
auto dom = g_dist.getDomainIterator();
while (dom.isNext())
{
//! \cond [iterator] \endcond
/*!
* \page Grid_1_stencil Grid 1 stencil
*
* Inside the cycle we get the local grid key
*
* \see \ref e0_s_grid_coord
*
* \snippet Grid/1_stencil/main.cpp local key
*
*/
//! \cond [local key] \endcond
auto key = dom.get();
//! \cond [local key] \endcond
/*!
* \page Grid_1_stencil Grid 1 stencil
*
* 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
*
* \see \ref e0_s_grid_coord
*
* \snippet Grid/1_stencil/main.cpp global key
*
*/
//! \cond [global key] \endcond
auto key_g = g_dist.getGKey(key);
//! \cond [global key] \endcond
/*!
* \page Grid_1_stencil Grid 1 stencil
*
* we write on the grid point of position (i,j,k) the value i*i + j*j + k*k on the property A.
* Mathematically is equivalent to the function
*
* \f$ f(x,y,z) = x^2 + y^2 + z^2 \f$
*
* \snippet Grid/1_stencil/main.cpp function
*
*/
//! \cond [function] \endcond
g_dist.template get<A>(key) = key_g.get(0)*key_g.get(0) + key_g.get(1)*key_g.get(1) + key_g.get(2)*key_g.get(2);
//! \cond [function] \endcond
//! \cond [iterator2] \endcond
++dom;
}
//! \cond [iterator2] \endcond
/*!
* \page Grid_1_stencil Grid 1 stencil
*
* ## Ghost ## {#e1_s_ghost}
*
* Each sub-domain has an extended part, that is materially contained into another processor.
* In general is not synchronized
* ghost_get<A> synchronize the property A in the ghost part
*
* \snippet Grid/1_stencil/main.cpp ghost
*
*/
//! \cond [ghost] \endcond
g_dist.template ghost_get<A>();
//! \cond [ghost] \endcond
/*!
* \page Grid_1_stencil Grid 1 stencil
*
* Get again another iterator, iterate across all the domain points, calculating a Laplace stencil. Write the
* result on B
*
* \snippet Grid/1_stencil/main.cpp laplacian
*
*/
//! \cond [laplacian] \endcond
auto dom2 = g_dist.getDomainIterator();
while (dom2.isNext())
{
auto key = dom2.get();
// Laplace stencil
g_dist.template get<B>(key) = g_dist.template get<A>(key.move(x,1)) + g_dist.template get<A>(key.move(x,-1)) +
g_dist.template get<A>(key.move(y,1)) + g_dist.template get<A>(key.move(y,-1)) +
g_dist.template get<A>(key.move(z,1)) + g_dist.template get<A>(key.move(z,-1)) -
6*g_dist.template get<A>(key);
++dom2;
}
//! \cond [laplacian] \endcond
/*!
* \page Grid_1_stencil Grid 1 stencil
*
*
* Finally we want a nice output to visualize the information stored by the distributed grid
*
* \see \ref e0_s_VTK_vis
*
* \snippet Grid/1_stencil/main.cpp output
*
*/
//! \cond [output] \endcond
g_dist.write("output");
//! \cond [output] \endcond
/*!
* \page Grid_1_stencil Grid 1 stencil
*
* Deinitialize the library
*
* \snippet Grid/1_stencil/main.cpp finalize
*
*/
//! \cond [finalize] \endcond
openfpm_finalize();
//! \cond [finalize] \endcond
/*!
* \page Grid_1_stencil Grid 1 stencil
*
* # Full code # {#code}
*
* \include Grid/1_stencil/main.cpp
*
*/
}
include ../../example.mk
CC=mpic++
LDIR =
OBJ = main.o
%.o: %.cpp
$(CC) -O3 -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
periodic: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
all: periodic
run: all
mpirun -np 4 ./periodic
.PHONY: clean all run
clean:
rm -f *.o *~ core periodic
[pack]
files = main.cpp Makefile
#include "Grid/grid_dist_id.hpp"
#include "data_type/aggregate.hpp"
/*!
* \page Grid_2_solve_eq Grid 2 solve eq
*
* [TOC]
*
* # Simple example of grid usage to solve an equation # {#e2_solve_eq}
*
* This example show the usage of grid to solve the following equation
*
* \f$\frac{\partial^2 u}{\partial^2 x} + \frac{\partial^2 u}{\partial^2 y} = 1\f$
*
* \f$u(x,y) = 0 \f$
*
* at the boundary
*
*
* ## Field initialization ## {#e2_se_finit}
*
*/
//! \cond [field init] \endcond
void init(grid_dist_id<2,double,aggregate<double> > & g_dist, const size_t (& sz)[2])
{
/*!
* \page Grid_2_solve_eq Grid 2 solve eq
*
* In order to initialize the field U, first we get an iterator that cover
* domain + Ghost to iterate all the grid points.
* Inside the cycle we initialize domain and border (Ghost part to 0.0)
*
* \see \ref e0_s_loop_gp
*
*/
//! \cond [iterator] \endcond
// Get the iterator
auto it = g_dist.getDomainGhostIterator();
// For each point in the grid
while (it.isNext())
{
//! \cond [iterator] \endcond
/*!
* \page Grid_2_solve_eq Grid 2 solve eq
*
* Get the local grid key
*
* \see \ref e0_s_grid_coord
*
* \snippet Grid/2_solve_eq/main.cpp local key
*
*/
//! \cond [local key] \endcond
auto key = it.get();
//! \cond [local key] \endcond
/*!
* \page Grid_2_solve_eq Grid 2 solve eq
*
*
* 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
*
* \see \ref e0_s_grid_coord
*
* \snippet Grid/2_solve_eq/main.cpp global key
*
*/
//! \cond [global key] \endcond
auto key_g = g_dist.getGKey(key);
//! \cond [global key] \endcond
/*!
* \page Grid_2_solve_eq Grid 2 solve eq
*
* Initialize to 0, domain + boundary
*
* \snippet Grid/2_solve_eq/main.cpp init field zero
*
* The full function look like this
*
* \snippet Grid/2_solve_eq/main.cpp field init
*
*/
//! \cond [init field zero] \endcond
if (key_g.get(0) == 0 || key_g.get(0) == sz[0] ||
key_g.get(1) == 0 || key_g.get(1) == sz[1])
{
// Boundary part
g_dist.template get<0>(key) = 0.0;
}
else
{
// Internal part
g_dist.template get<0>(key) = 0.0;
}
//! \cond [init field zero] \endcond
//! \cond [iterator2] \endcond
++it;
}
//! \cond [iterator2] \endcond
}
//! \cond [field init] \endcond
constexpr int x = 0;
constexpr int y = 1;
int main(int argc, char* argv[])
{
/*!
* \page Grid_2_solve_eq Grid 2 solve eq
*
* ## Initialization ##
*
* Initialize the library
*
* \see \ref e0_s_initialization
*
* \snippet Grid/2_solve_eq/main.cpp ofp_init
*
*/
//! \cond [ofp_init] \endcond
openfpm_init(&argc,&argv);
//! \cond [ofp_init] \endcond
/*!
* \page Grid_2_solve_eq Grid 2 solve eq
*
* ## Grid instantiation and initialization ##
*
* Create
* * A 2D box that define the domain
* * an array of 2 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 grid point unit
*
* \snippet Grid/2_solve_eq/main.cpp ofp_par
*
*/
//! \cond [ofp_par] \endcond
Box<2,double> domain({-1.0,-1.0},{1.0,1.0});
size_t sz[2] = {64,64};
periodicity<2> bc = {NON_PERIODIC,NON_PERIODIC};
// Ghost in grid unit
Ghost<2,long int> g(1);
//! \cond [ofp_par] \endcond
/*!
* \page Grid_2_solve_eq Grid 2 solve eq
*
* Create a distributed grid in 2D (1° template parameter) space in with double precision (2° template parameter)
* each grid point contain a scalar (double),
*
* Constructor parameters:
*
* * sz: size of the grid on each dimension
* * domain: where the grid is defined
* * g: ghost extension
* * bc: boundary conditions
*
* \see \ref e0_s_grid_inst
*
* \snippet Grid/2_solve_eq/main.cpp grid inst
*
*/
//! \cond [grid inst] \endcond
grid_dist_id<2, double, aggregate<double>> g_dist(sz,domain,g,bc);
// spacing between two points
double spacing[2] = {g_dist.spacing(0),g_dist.spacing(1)};
//! \cond [grid inst] \endcond
/*!
* \page Grid_2_solve_eq Grid 2 solve eq
*
* Initialize U and fill the boundary conditions
*
* \see \ref e2_se_field_init
*
* \snippet Grid/2_solve_eq/main.cpp grid init
*
*/
//! \cond [grid init] \endcond
init(g_dist,sz);
//! \cond [grid init] \endcond
/*!
* \page Grid_2_solve_eq Grid 2 solve eq
*
* ## %Ghost synchronization ##
*
* Before the computation read the ghost point we have to guarantee that they have
* updated values.
*
* \snippet Grid/2_solve_eq/main.cpp ghost sync
*
*/
//! \cond [ghost sync] \endcond
// sync the ghost property 0
g_dist.template ghost_get<0>();
//! \cond [ghost sync] \endcond
/*!
* \page Grid_2_solve_eq Grid 2 solve eq
*
* ## Red-Black alghorithm ##
*
* Do 10000 iteration of Red-Black Gauss-Siedel iterations
*
*
*/
//! \cond [gs_alg] \endcond
// flag that indicate if we are processing red or black
// we start from red
bool red_black = true;
// 10000 iterations
for (size_t i = 0 ; i < 10000 ; i++)
{
/*!
* \page Grid_2_solve_eq Grid 2 solve eq
*
* Get an iterator that go through the points of the grid (No ghost)
* To compute one iteration.
*
* \see \ref e0_s_loop_gp
* \see \ref e0_s_grid_coord
*
* \snippet Grid/2_solve_eq/main.cpp gs_it
*
*/
//! \cond [gs_it] \endcond
auto dom = g_dist.getDomainIterator();
// Iterate over all the points
while (dom.isNext())
{
// Get the local grid key
auto key = dom.get();
// 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);
//
// If we are processing red and is odd jump to the next point
// If we are processing black and is even jump to the next point
//
if (red_black == false && (key_g.get(0) + key_g.get(1)) % 2 == 0)
{++dom; continue;}
else if (red_black == true && (key_g.get(0) + key_g.get(1)) % 2 == 1)
{++dom; continue;}
//
// Update the grid values
//
// P.S. The keyword template is removed, it is possible only if we are in a function
// without template parameters (if you are unsure use the keyword template)
//
g_dist.get<0>(key) = (g_dist.get<0>(key.move(x,1)) + g_dist.template get<0>(key.move(x,-1)) +
g_dist.get<0>(key.move(y,1)) + g_dist.template get<0>(key.move(y,-1)) +
- 1.0)/4.0;
//
// next point (red/black)
++dom;
}
//! \cond [gs_it] \endcond
/*!
* \page Grid_2_solve_eq Grid 2 solve eq
*
*
* Once an iteration is done we have to synchronize the ghosts
* to start a new iteration. Consider that we calculated the red points
* in the next iteration the red points in the ghost are used in reading.
* This mean that the ghost must have the updated values
*
* \snippet Grid/2_solve_eq/main.cpp ghost sync2
*
*
*/
//! \cond [ghost sync2] \endcond
g_dist.template ghost_get<0>();
// switch from red to black or black to red
red_black = !red_black;
//! \cond [ghost sync2] \endcond
}
/*!
* \page Grid_2_solve_eq Grid 2 solve eq
*
* The full Algorithm look like this
*
* \snippet Grid/2_solve_eq/main.cpp gs_alg
*/
//! \cond [gs_alg] \endcond
/*!
* \page Grid_2_solve_eq Grid 2 solve eq
*
* ## Solution statistic ##
*
* Once we got the solution we want to check if it really satisfy the equation,
* and calculate the error (norm infinity)
*
* \snippet Grid/2_solve_eq/main.cpp sol stat
*
*/
//! \cond [sol stat] \endcond
// It contain the error
double error = 0.0;
// Get the iterator
auto dom = g_dist.getDomainIterator();
// Iterate over all the points
while (dom.isNext())
{
// same the the grid point and the global grid point
auto key = dom.get();
// Calculate the error on each point
// The error is how much the solution does not respect the equation
double error_tmp = abs((g_dist.get<0>(key.move(x,1)) + g_dist.get<0>(key.move(x,-1)) +
g_dist.get<0>(key.move(y,1)) + g_dist.get<0>(key.move(y,-1)) +
- 4.0*g_dist.get<0>(key)) - 1.0);
// In the norm infinity the maximum error across all the point is
// important
if (error_tmp > error)
error = error_tmp;
// next point
++dom;
}
// Get the maximum across processor to calculate the norm infinity of the error
// Norm infinity of the error is the maximum error across all the grid points
Vcluster & v_cl = create_vcluster();
v_cl.max(error);
v_cl.execute();
// Only master print the norm infinity
if (v_cl.getProcessUnitID() == 0)
std::cout << "Error norm infinity: " << error << std::endl;
//! \cond [sol stat] \endcond
/*!
* \page Grid_2_solve_eq Grid 2 solve eq
*
* ## VTK Write and visualization ##
*
* Finally we want a nice output to visualize the information stored by the distributed grid.
* The function write by default produce VTK files. One for each processor that can be visualized
* with the programs like paraview
*
* \see \ref e0_s_VTK_vis
*
* \snippet Grid/2_solve_eq/main.cpp write
*
*/
//! \cond [write] \endcond
g_dist.write("output");
//! \cond [write] \endcond
/*!
* \page Grid_2_solve_eq Grid 2 solve eq
*
* ## Finalize ##
*
* At the very end of the program we have always to de-initialize the library
*
* \snippet Grid/2_solve_eq/main.cpp finalize
*
*/
//! \cond [finalize] \endcond
openfpm_finalize();
//! \cond [finalize] \endcond
/*!
* \page Grid_2_solve_eq Grid 2 solve eq
*
* # Full code # {#code}
*
* \include Grid/2_solve_eq/main.cpp
*
*/
}
include ../../example.mk
CC=mpic++
LDIR =
OBJ = main.o
%.o: %.cpp
$(CC) -O3 -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
gray_scott: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
all: gray_scott
run: all
mpirun -np 4 ./gray_scott
.PHONY: clean all run
clean:
rm -f *.o *~ core gray_scott