From b814eb8b54e4a22f8a15383cd4663c32fb33f466 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Fri, 23 Aug 2013 13:51:32 +0200 Subject: [PATCH 01/54] Compile Suite git integration - get new work from git_status_proxy - report back --- .../CompileSuite/autoTests/compileRun.sh | 2 +- buildsystem/CompileSuite/autoTests/config.sh | 11 +- .../CompileSuite/autoTests/get_work.sh | 110 ++++++++++++++++++ .../CompileSuite/autoTests/new_commits.sh | 53 +++++---- .../autoTests/{mails.sh => report.sh} | 46 +++++--- 5 files changed, 176 insertions(+), 46 deletions(-) create mode 100755 buildsystem/CompileSuite/autoTests/get_work.sh rename buildsystem/CompileSuite/autoTests/{mails.sh => report.sh} (78%) diff --git a/buildsystem/CompileSuite/autoTests/compileRun.sh b/buildsystem/CompileSuite/autoTests/compileRun.sh index dae3672792..0d64435553 100755 --- a/buildsystem/CompileSuite/autoTests/compileRun.sh +++ b/buildsystem/CompileSuite/autoTests/compileRun.sh @@ -32,7 +32,7 @@ # user="picman" -numParallel=3 +numParallel=2 exch="/home/"$user"/exchange" picExport=$exch"/pic_export" diff --git a/buildsystem/CompileSuite/autoTests/config.sh b/buildsystem/CompileSuite/autoTests/config.sh index 0e13341242..bdf96c6dd9 100755 --- a/buildsystem/CompileSuite/autoTests/config.sh +++ b/buildsystem/CompileSuite/autoTests/config.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright 2013 Axel Huebl +# Copyright 2013 Axel Huebl # # This file is part of PIConGPU. # @@ -21,11 +21,10 @@ # global configs ############################################################## # -cnf_branches[0]="branches/dev" +cnf_scheduler_secret="..." +cnf_scheduler="https://example.com?client="$cnf_scheduler_secret - -cnf_queue="queue.cnf" -cnf_svndir="$HOME/pic_svn/" +cnf_gitdir="$HOME/pic_git/" cnf_exportdir="$HOME/pic_export/" cnf_extfile="$HOME/machines/exchange.ext2" @@ -40,7 +39,7 @@ cnf_numParallel=2 # send a congrats mail if N commits in a row where successful # (kind of a heart beat for this script) -cnf_congrats=3 +cnf_congrats=10 # mail settings cnf_smtp="smtp.example.com:25" diff --git a/buildsystem/CompileSuite/autoTests/get_work.sh b/buildsystem/CompileSuite/autoTests/get_work.sh new file mode 100755 index 0000000000..7e859f1eda --- /dev/null +++ b/buildsystem/CompileSuite/autoTests/get_work.sh @@ -0,0 +1,110 @@ +#!/bin/bash +# +# Copyright 2013 Axel Huebl +# +# This file is part of PIConGPU. +# +# PIConGPU is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# PIConGPU is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with PIConGPU. +# If not, see . +# + +# Contact the scheduler and request a new task to work on +# create a read only, clean source +# image + +thisDir=$(cd `dirname $0` && pwd)"/" + +. "$thisDir"config.sh + +security_check $thisDir + +# clean up old stuff +# +rm -rf $cnf_gitdir/* +mkdir -p $cnf_gitdir +cd $cnf_gitdir +rm -rf $cnf_exportdir +mkdir -p $cnf_exportdir + +# check for work +# +sched=`curl -d'payload={"action":"request"}' $cnf_scheduler 2>/dev/null` +if [ $? -ne 0 ]; then + echo "Error contacting scheduler at $cnf_scheduler" + exit 1 +fi + +workType=`echo -e "$sched" | grep "etype" | awk -F':' '{print $2}' | awk -F'"' '{print $2}'` + +# HEAD commit properties +eventid=`echo -e "$sched" | grep "id" | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` +owner=`echo -e "$sched" | grep "owner" | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` +repo=`echo -e "$sched" | grep "repo" | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` +git=`echo -e "$sched" | grep "git" | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}' | sed 's|\\\/|\/|g'` +sha=`echo -e "$sched" | grep "sha" | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` + +echo $eventid > "$thisDir"runGuard + +if [ "$workType" == "commit" ] +then + git clone $git . + git checkout $sha +elif [ "$workType" == "pull" ] +then + # BASE repos commit properties + owner_b=`echo -e "$sched" | grep "owner" | tail -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` + repo_b=`echo -e "$sched" | grep "repo" | tail -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` + git_b=`echo -e "$sched" | grep "git" | tail -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}' | sed 's|\\\/|\/|g'` + sha_b=`echo -e "$sched" | grep "sha" | tail -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` + + git clone $git_b . + git checkout -b mergeTest $sha_b + git pull $git $sha + if [ $? -ne 0 ] ; then + # merge failed + cd - + exit 2 + fi +else + cd - + exit 1 +fi + +rsync -a --exclude=.git . $cnf_exportdir + +# iso +#genisoimage -D -iso-level 4 -quiet \ +# -input-charset=iso8859-1 \ +# -o $cnf_isofile $cnf_exportdir + +# raw (loop dev) +rm -rf $cnf_extfile +qemu-img create -f raw $cnf_extfile 1G +/sbin/mke2fs -q -F $cnf_extfile + +mntdir=$thisDir"tmp_mount" +mkdir $mntdir +fuseext2 -o rw+ $cnf_extfile $mntdir + +mkdir $mntdir/pic_export +cp $thisDir"compileRun.sh" $mntdir/ +cp -R $cnf_exportdir/* $mntdir/pic_export + +# unmount +sync +fusermount -u $mntdir +rm -rf $mntdir + +# go back +cd - diff --git a/buildsystem/CompileSuite/autoTests/new_commits.sh b/buildsystem/CompileSuite/autoTests/new_commits.sh index aa0bd86e3c..8126648a5c 100755 --- a/buildsystem/CompileSuite/autoTests/new_commits.sh +++ b/buildsystem/CompileSuite/autoTests/new_commits.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright 2013 Axel Huebl +# Copyright 2013 Axel Huebl # # This file is part of PIConGPU. # @@ -24,7 +24,7 @@ thisDir=$(cd `dirname $0` && pwd)"/" . "$thisDir"config.sh -. "$thisDir"mails.sh +. "$thisDir"report.sh security_check @@ -36,29 +36,26 @@ touch "$thisDir"runGuard # loop through each branch for new commits # -cd $cnf_svndir +rm -rf $cnf_gitdir/* +mkdir -p $cnf_gitdir +cd $cnf_gitdir # loop branches -for b in "${cnf_branches[@]}" -do - cd $b +#for b in "${cnf_branches[@]}" +#do +# cd $b - # loop commits + # loop work finished=0 while [ "$finished" -eq "0" ] do - myRev=`svnversion` - rev=$(( myRev + 1 )) - "$thisDir"update_branch.sh $b $rev + "$thisDir"get_work.sh finished=$? - # was this branch affected? - if [ "$finished" -eq "0" ]; then - logEntry=`svn log -v -r $rev` - commitLine=`echo $logEntry | sed 's/-//g'` - if [ -z "$commitLine" ] ; then - finished=1 - fi + # merge conflict occuted + if [ "$finished" -eq "2" ]; then + # ... @todo clean message as failure + echo "Merge conflict detected. Aborting..." fi # new version! :) @@ -66,11 +63,17 @@ do # state of this test state=0 #0: suite errored, <0 compile failed, >0: ok - # svn log infos - logEntry=`svn log -v -r $rev` - lastUser=`echo "$logEntry" | head -n 2 | tail -n 1 | awk -F"|" '{print $2}'` + # git log infos + logEntry=`git log -1` + lastUser=`git log -1 --format=%an` + lastUserMail=`git log -1 --format=%ae` + if [ -z "$lastUserMail" ] ; then + lastUserMail="example@example.com" + fi + sha=`git log -1 --format=%H` + eventid=`cat "$thisDir"runGuard` - echo "Testing new version $b:$rev" + echo "Testing new commit" cp $cnf_imgSrc $cnf_imgClone echo "Base System Image cloned..." @@ -134,8 +137,8 @@ do # update lastRun history echo $state > "$thisDir"lastRun.log - # create conclusion and send mails - conclusion "$state" "$lastUser" "$b" "$rev" "$logEntry" "$mntdir""/output" + # create conclusion, update status (and send mails) + conclusion "$state" "$lastUser" "$lastUserMail" "$sha" "$eventid" "$logEntry" "$mntdir""/output" # unmount fusermount -u $mntdir @@ -148,8 +151,8 @@ do fi done - cd $cnf_svndir -done + cd $cnf_gitdir +#done # del guard rm "$thisDir"runGuard diff --git a/buildsystem/CompileSuite/autoTests/mails.sh b/buildsystem/CompileSuite/autoTests/report.sh similarity index 78% rename from buildsystem/CompileSuite/autoTests/mails.sh rename to buildsystem/CompileSuite/autoTests/report.sh index f354bdb528..eb8204317e 100755 --- a/buildsystem/CompileSuite/autoTests/mails.sh +++ b/buildsystem/CompileSuite/autoTests/report.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright 2013 Axel Huebl +# Copyright 2013 Axel Huebl # # This file is part of PIConGPU. # @@ -29,29 +29,34 @@ # >0 compile ok # # $2: lastUser -# $3: branch -# $4: rev -# $5: logEntry -# $6: path to compile output file +# $3: lastUserMail +# $4: sha +# $5: eventid +# $6: logEntry +# $7: path to compile output file function conclusion { state="$1" echo "State: $state" lastUser="$2" #echo "lastUser: $lastUser" - branch="$3" - #echo "branch: $branch" - rev="$4" - #echo "rev: $rev" - logEntry="$5" + lastUserMail="$3" + #echo "email: $lastUserMail" + sha="$4" + #echo "sha: $sha" + eventid="$5" + #echo "eventid: $eventid" + logEntry="$6" #echo "logEntry: $logEntry" - compileOutputFile="$6" + compileOutputFile="$7" #echo "compile (tail): " #tail -n 10 $compileOutputFile subject="" text="" + stateName="" # Positive if [ "$state" -gt "0" ] ; then + stateName="success" # "award" mail? award=$(( state % cnf_congrats )) if [ "$award" -eq "0" ] ; then @@ -68,6 +73,7 @@ function conclusion { # Test Failed - inform users if [ "$state" -lt "0" ] ; then + stateName="failure" # first fail if [ "$state" -eq "-1" ] ; then subject="[Failed] $lastUser @ $branch : $rev" @@ -83,7 +89,7 @@ function conclusion { *Failing* Tests:" fTests=`grep -iR "\[compileSuite\] \[error\]" "$compileOutputFile" | awk -F':' '{print $2}' | awk -F'=' '{print $2}'` - # for each error loop and show first 35 lines ... + # for each error loop and show first N lines ... for fT in $fTests do text="$text @@ -99,6 +105,7 @@ $fT # Suite Errored - internal error if [ "$state" -eq "0" ] ; then + stateName="error" subject="[Errored] $lastUser @ $branch : $rev" text="Compile Suite: internal error" fi @@ -113,8 +120,19 @@ $logEntry" #echo "Mail Text: $text" #echo "Mail attachement: $compileOutputFile" - if [ ! -z "$subject" ] ; then - send_mail "$subject" "$text" "$compileOutputFile" + #if [ ! -z "$subject" ] ; then + # send_mail "$subject" "$text" "$compileOutputFile" + #fi + + # report to scheduler + # + # escape / \ and " (to do: control codes < U+0020 ) + $textJSON=`echo "$text" | sed 's|\\|\\\\|g' | sed 's|\"|\\\"|g' | sed 's|\/|\\\/|g'` + sched=`curl -d'payload={"action":"report","eventid":'$eventid',"result":"'$stateName'","output":"'$textJSON'"}' \ + $cnf_scheduler 2>/dev/null` + if [ $? -ne 0 ]; then + echo "Error contacting scheduler at $cnf_scheduler" + exit 1 fi } From c15acdd23af54da5f5b864c2426aad46401d4345 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Fri, 23 Aug 2013 16:04:16 +0200 Subject: [PATCH 02/54] Fix JSON escapes and export - rm .git dir and .gitignore, too - escape special chars in JSON output message --- .../CompileSuite/autoTests/get_work.sh | 14 ++++----- .../CompileSuite/autoTests/new_commits.sh | 2 -- buildsystem/CompileSuite/autoTests/report.sh | 29 +++++++++++++------ 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/buildsystem/CompileSuite/autoTests/get_work.sh b/buildsystem/CompileSuite/autoTests/get_work.sh index 7e859f1eda..0a32647880 100755 --- a/buildsystem/CompileSuite/autoTests/get_work.sh +++ b/buildsystem/CompileSuite/autoTests/get_work.sh @@ -31,7 +31,7 @@ security_check $thisDir # clean up old stuff # -rm -rf $cnf_gitdir/* +rm -rf $cnf_gitdir/* $cnf_gitdir/.git* mkdir -p $cnf_gitdir cd $cnf_gitdir rm -rf $cnf_exportdir @@ -48,7 +48,7 @@ fi workType=`echo -e "$sched" | grep "etype" | awk -F':' '{print $2}' | awk -F'"' '{print $2}'` # HEAD commit properties -eventid=`echo -e "$sched" | grep "id" | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` +eventid=`echo -e "$sched" | grep "id" | head -n1 | awk -F'":' '{print $2}' | awk -F',' '{print $1}'` owner=`echo -e "$sched" | grep "owner" | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` repo=`echo -e "$sched" | grep "repo" | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` git=`echo -e "$sched" | grep "git" | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}' | sed 's|\\\/|\/|g'` @@ -58,8 +58,8 @@ echo $eventid > "$thisDir"runGuard if [ "$workType" == "commit" ] then - git clone $git . - git checkout $sha + git clone -q $git . + git checkout -q $sha elif [ "$workType" == "pull" ] then # BASE repos commit properties @@ -68,9 +68,9 @@ then git_b=`echo -e "$sched" | grep "git" | tail -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}' | sed 's|\\\/|\/|g'` sha_b=`echo -e "$sched" | grep "sha" | tail -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` - git clone $git_b . - git checkout -b mergeTest $sha_b - git pull $git $sha + git clone -q $git_b . + git checkout -q -b mergeTest $sha_b + git pull -q $git $sha if [ $? -ne 0 ] ; then # merge failed cd - diff --git a/buildsystem/CompileSuite/autoTests/new_commits.sh b/buildsystem/CompileSuite/autoTests/new_commits.sh index 8126648a5c..2d8bcaeca5 100755 --- a/buildsystem/CompileSuite/autoTests/new_commits.sh +++ b/buildsystem/CompileSuite/autoTests/new_commits.sh @@ -36,8 +36,6 @@ touch "$thisDir"runGuard # loop through each branch for new commits # -rm -rf $cnf_gitdir/* -mkdir -p $cnf_gitdir cd $cnf_gitdir # loop branches diff --git a/buildsystem/CompileSuite/autoTests/report.sh b/buildsystem/CompileSuite/autoTests/report.sh index eb8204317e..f9829bd0b1 100755 --- a/buildsystem/CompileSuite/autoTests/report.sh +++ b/buildsystem/CompileSuite/autoTests/report.sh @@ -44,7 +44,7 @@ function conclusion { sha="$4" #echo "sha: $sha" eventid="$5" - #echo "eventid: $eventid" + echo "eventid: $eventid" logEntry="$6" #echo "logEntry: $logEntry" compileOutputFile="$7" @@ -60,13 +60,13 @@ function conclusion { # "award" mail? award=$(( state % cnf_congrats )) if [ "$award" -eq "0" ] ; then - subject="[Award] $lastUser @ $branch : $rev" + subject="[Award] $lastUser @ $sha" text="You won a *team award*! $cnf_congrats in a row! *congrats*! :)" fi # problem "fixed" mail? if [ "$state" -eq "1" ] ; then - subject="[Fixed] $lastUser @ $branch : $rev" + subject="[Fixed] $lastUser @ $sha" text="$lastUser *fixed* PIConGPU! We love you!" fi fi @@ -76,11 +76,11 @@ function conclusion { stateName="failure" # first fail if [ "$state" -eq "-1" ] ; then - subject="[Failed] $lastUser @ $branch : $rev" + subject="[Failed] $lastUser @ $sha" text="_Errors_ occured! Dare you *$lastUser*! Pls fix them ... Allez garcon!" # still failing else - subject="[Still Failing] $lastUser @ $branch : $rev" + subject="[Still Failing] $lastUser @ $sha" text="_Errors_ occured! Compile *still* failing ($lastUser did _not_ fix all errors...)" fi # parse errors @@ -106,7 +106,7 @@ $fT # Suite Errored - internal error if [ "$state" -eq "0" ] ; then stateName="error" - subject="[Errored] $lastUser @ $branch : $rev" + subject="[Errored] $lastUser @ $sha" text="Compile Suite: internal error" fi @@ -127,9 +127,20 @@ $logEntry" # report to scheduler # # escape / \ and " (to do: control codes < U+0020 ) - $textJSON=`echo "$text" | sed 's|\\|\\\\|g' | sed 's|\"|\\\"|g' | sed 's|\/|\\\/|g'` - sched=`curl -d'payload={"action":"report","eventid":'$eventid',"result":"'$stateName'","output":"'$textJSON'"}' \ - $cnf_scheduler 2>/dev/null` + #textJSON=$(echo "$text" | sed 's|\\|\\\\|g' | sed 's|\"|\\\"|g' | sed 's|\/|\\\/|g') + textJSON=${text//\\/\\\\} # \ + textJSON=${textJSON//\//\\\/} # / + textJSON=${textJSON//\'/\\\'} # ' + textJSON=${textJSON//\"/\\\"} # " + textJSON=${textJSON// /\\t} # \t + textJSON=${textJSON// +/\\\n} # \n + textJSON=${textJSON//^M/\\\r} # \r + textJSON=${textJSON//^L/\\\f} # \f + textJSON=${textJSON//^H/\\\b} # \b + postParams='payload={"action":"report","eventid":'$eventid',"result":"'$stateName'","output":"'"$textJSON"'"}' + echo $postParams + curl -d"$postParams" $cnf_scheduler 2>/dev/null if [ $? -ne 0 ]; then echo "Error contacting scheduler at $cnf_scheduler" exit 1 From 58d59a98cd120430e15021cdcefc63a7bb823847 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Fri, 23 Aug 2013 16:32:32 +0200 Subject: [PATCH 03/54] Remove echo postParams --- buildsystem/CompileSuite/autoTests/report.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/buildsystem/CompileSuite/autoTests/report.sh b/buildsystem/CompileSuite/autoTests/report.sh index f9829bd0b1..38830e70f0 100755 --- a/buildsystem/CompileSuite/autoTests/report.sh +++ b/buildsystem/CompileSuite/autoTests/report.sh @@ -139,7 +139,6 @@ $logEntry" textJSON=${textJSON//^L/\\\f} # \f textJSON=${textJSON//^H/\\\b} # \b postParams='payload={"action":"report","eventid":'$eventid',"result":"'$stateName'","output":"'"$textJSON"'"}' - echo $postParams curl -d"$postParams" $cnf_scheduler 2>/dev/null if [ $? -ne 0 ]; then echo "Error contacting scheduler at $cnf_scheduler" From bdeb9f6c18e475f9bc4b89168002e6bb3129bf4a Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Fri, 23 Aug 2013 16:35:41 +0200 Subject: [PATCH 04/54] Grep key more precise with "" --- .../CompileSuite/autoTests/get_work.sh | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/buildsystem/CompileSuite/autoTests/get_work.sh b/buildsystem/CompileSuite/autoTests/get_work.sh index 0a32647880..863b1f40f5 100755 --- a/buildsystem/CompileSuite/autoTests/get_work.sh +++ b/buildsystem/CompileSuite/autoTests/get_work.sh @@ -45,14 +45,14 @@ if [ $? -ne 0 ]; then exit 1 fi -workType=`echo -e "$sched" | grep "etype" | awk -F':' '{print $2}' | awk -F'"' '{print $2}'` +workType=`echo -e "$sched" | grep '"etype"' | awk -F':' '{print $2}' | awk -F'"' '{print $2}'` # HEAD commit properties -eventid=`echo -e "$sched" | grep "id" | head -n1 | awk -F'":' '{print $2}' | awk -F',' '{print $1}'` -owner=`echo -e "$sched" | grep "owner" | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` -repo=`echo -e "$sched" | grep "repo" | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` -git=`echo -e "$sched" | grep "git" | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}' | sed 's|\\\/|\/|g'` -sha=`echo -e "$sched" | grep "sha" | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` +eventid=`echo -e "$sched" | grep '"id"' | head -n1 | awk -F'":' '{print $2}' | awk -F',' '{print $1}'` +owner=`echo -e "$sched" | grep '"owner"' | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` +repo=`echo -e "$sched" | grep '"repo"' | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` +git=`echo -e "$sched" | grep '"git"' | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}' | sed 's|\\\/|\/|g'` +sha=`echo -e "$sched" | grep '"sha"' | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` echo $eventid > "$thisDir"runGuard @@ -63,10 +63,10 @@ then elif [ "$workType" == "pull" ] then # BASE repos commit properties - owner_b=`echo -e "$sched" | grep "owner" | tail -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` - repo_b=`echo -e "$sched" | grep "repo" | tail -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` - git_b=`echo -e "$sched" | grep "git" | tail -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}' | sed 's|\\\/|\/|g'` - sha_b=`echo -e "$sched" | grep "sha" | tail -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` + owner_b=`echo -e "$sched" | grep '"owner"' | tail -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` + repo_b=`echo -e "$sched" | grep '"repo"' | tail -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` + git_b=`echo -e "$sched" | grep '"git"' | tail -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}' | sed 's|\\\/|\/|g'` + sha_b=`echo -e "$sched" | grep '"sha"' | tail -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` git clone -q $git_b . git checkout -q -b mergeTest $sha_b From 390cc194a4180994818735e0096fc72be266a8b9 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Fri, 23 Aug 2013 17:14:40 +0200 Subject: [PATCH 05/54] Pull request merge fix - can not merge by forkRepo sha - use forkRepo branchName instead --- buildsystem/CompileSuite/autoTests/get_work.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/buildsystem/CompileSuite/autoTests/get_work.sh b/buildsystem/CompileSuite/autoTests/get_work.sh index 863b1f40f5..1caa65ab39 100755 --- a/buildsystem/CompileSuite/autoTests/get_work.sh +++ b/buildsystem/CompileSuite/autoTests/get_work.sh @@ -68,9 +68,11 @@ then git_b=`echo -e "$sched" | grep '"git"' | tail -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}' | sed 's|\\\/|\/|g'` sha_b=`echo -e "$sched" | grep '"sha"' | tail -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` + branch=`echo -e "$sched" | grep '"branch"' | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` + git clone -q $git_b . git checkout -q -b mergeTest $sha_b - git pull -q $git $sha + git pull -q $git $branch if [ $? -ne 0 ] ; then # merge failed cd - From d2f7636c420c010fecda7a8dcb657c3f73ec7d79 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Mon, 26 Aug 2013 16:15:25 +0200 Subject: [PATCH 06/54] CMake: include thread lib - add FIND_PACKAGE(Threads REQUIRED) - fix cuda_memtest build - prepare PIConGPU for the same dependencies --- src/cuda_memtest/CMakeLists.txt | 6 ++++-- src/picongpu/CMakeLists.txt | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/cuda_memtest/CMakeLists.txt b/src/cuda_memtest/CMakeLists.txt index 03b39dec98..a03653f7ea 100644 --- a/src/cuda_memtest/CMakeLists.txt +++ b/src/cuda_memtest/CMakeLists.txt @@ -14,6 +14,8 @@ set(CMAKE_PREFIX_PATH "/usr/lib/x86_64-linux-gnu/" "$ENV{MPI_ROOT}" "$ENV{CUDA_R #include cuda plugin for cmake FIND_PACKAGE(CUDA REQUIRED) +#include pthread plugin for cmake +FIND_PACKAGE(Threads REQUIRED) ######################################################################## #set options @@ -63,10 +65,10 @@ cuda_add_executable(cuda_memtest ) -target_link_libraries(cuda_memtest ${LIBS} ${CUDA_CUDART_LIBRARY}) +target_link_libraries(cuda_memtest ${LIBS} ${CUDA_CUDART_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) #### INSTALLATION ##### INSTALL(TARGETS cuda_memtest - RUNTIME DESTINATION bin) \ No newline at end of file + RUNTIME DESTINATION bin) diff --git a/src/picongpu/CMakeLists.txt b/src/picongpu/CMakeLists.txt index e50641f23f..2770501202 100644 --- a/src/picongpu/CMakeLists.txt +++ b/src/picongpu/CMakeLists.txt @@ -49,9 +49,13 @@ ELSE(PIC_RELEASE) set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}" -g "-Xcompiler=-g,-pthread") ENDIF(PIC_RELEASE) - +#include MPI FIND_PACKAGE(MPI REQUIRED) +#include pthreads +FIND_PACKAGE(Threads REQUIRED) +SET(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT}) + #Boost from system FIND_PACKAGE(Boost REQUIRED COMPONENTS program_options regex) INCLUDE_DIRECTORIES(AFTER ${Boost_INCLUDE_DIRS}) From 414e139904856134be4f734462c722e3f7adc406 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Mon, 26 Aug 2013 17:41:16 +0200 Subject: [PATCH 07/54] Decode allJSON and clean conflict result - if a merge conflict occures, set the failure status and exit in a clean way - decode all JSON data, not only URLs (for example, if someone uses / in a branch name) --- buildsystem/CompileSuite/autoTests/get_work.sh | 17 +++++++++++++++-- .../CompileSuite/autoTests/new_commits.sh | 16 +++++++++++++++- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/buildsystem/CompileSuite/autoTests/get_work.sh b/buildsystem/CompileSuite/autoTests/get_work.sh index 1caa65ab39..0bffadfdda 100755 --- a/buildsystem/CompileSuite/autoTests/get_work.sh +++ b/buildsystem/CompileSuite/autoTests/get_work.sh @@ -45,13 +45,26 @@ if [ $? -ne 0 ]; then exit 1 fi +# decode JSON escaped strings +# +sched=${sched//\\\\/\\} # \ +sched=${sched//\\\//\/} # / +sched=${sched//\\\'/\'} # ' +sched=${sched//\\\"/\"} # " +sched=${sched//\\\t/ } # \t +sched=${sched//\\\n/ +} # \n +sched=${sched//\\\r/^M} # \r +sched=${sched//\\\f/^L} # \f +sched=${sched//\\\b/^H} # \b + workType=`echo -e "$sched" | grep '"etype"' | awk -F':' '{print $2}' | awk -F'"' '{print $2}'` # HEAD commit properties eventid=`echo -e "$sched" | grep '"id"' | head -n1 | awk -F'":' '{print $2}' | awk -F',' '{print $1}'` owner=`echo -e "$sched" | grep '"owner"' | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` repo=`echo -e "$sched" | grep '"repo"' | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` -git=`echo -e "$sched" | grep '"git"' | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}' | sed 's|\\\/|\/|g'` +git=`echo -e "$sched" | grep '"git"' | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` sha=`echo -e "$sched" | grep '"sha"' | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` echo $eventid > "$thisDir"runGuard @@ -65,7 +78,7 @@ then # BASE repos commit properties owner_b=`echo -e "$sched" | grep '"owner"' | tail -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` repo_b=`echo -e "$sched" | grep '"repo"' | tail -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` - git_b=`echo -e "$sched" | grep '"git"' | tail -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}' | sed 's|\\\/|\/|g'` + git_b=`echo -e "$sched" | grep '"git"' | tail -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` sha_b=`echo -e "$sched" | grep '"sha"' | tail -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` branch=`echo -e "$sched" | grep '"branch"' | head -n1 | awk -F'":' '{print $2}' | awk -F'"' '{print $2}'` diff --git a/buildsystem/CompileSuite/autoTests/new_commits.sh b/buildsystem/CompileSuite/autoTests/new_commits.sh index 2d8bcaeca5..4f3bf6d089 100755 --- a/buildsystem/CompileSuite/autoTests/new_commits.sh +++ b/buildsystem/CompileSuite/autoTests/new_commits.sh @@ -52,8 +52,22 @@ cd $cnf_gitdir # merge conflict occuted if [ "$finished" -eq "2" ]; then - # ... @todo clean message as failure + # clean message as failure echo "Merge conflict detected. Aborting..." + + state=-1 + # git log infos + logEntry=`git log -1` + lastUser=`git log -1 --format=%an` + lastUserMail=`git log -1 --format=%ae` + if [ -z "$lastUserMail" ] ; then + lastUserMail="example@example.com" + fi + sha=`git log -1 --format=%H` + eventid=`cat "$thisDir"runGuard` + + # create conclusion, update status (and send mails) + conclusion "$state" "$lastUser" "$lastUserMail" "$sha" "$eventid" "$logEntry" "$thisDir""runGuard" fi # new version! :) From 7ceee006a0e122731f823b504095da0a44d7130e Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Tue, 27 Aug 2013 16:29:33 +0200 Subject: [PATCH 08/54] Re-Introduce -Wall and fix all warnings - fix all int vs uint warnings - fix gcc alias warning in ProxyClass.hpp - fix comment-in-comment warnings - add -Wall for icpc and g++ - ignore unknown pragmas for g++ (i.e. nvcc's pragma unroll) - add experimental ICC 12.1 and PGI 13.6 support --- doc/INSTALL.md | 1 + .../include/cuSTL/container/CartBuffer.tpp | 2 +- src/libPMacc/include/lambda/ProxyClass.hpp | 17 ++++++++++++++--- src/picongpu/CMakeLists.txt | 14 +++++++++++++- src/picongpu/include/fields/FieldB.tpp | 2 +- src/picongpu/include/fields/FieldE.tpp | 4 ++-- src/picongpu/include/fields/FieldJ.tpp | 4 ++-- src/picongpu/include/fields/FieldTmp.tpp | 4 ++-- .../initialization/ParserGridDistribution.hpp | 2 +- .../initialization/SimRestartInitialiser.hpp | 6 +++--- src/picongpu/include/particles/Particles.kernel | 2 +- .../include/plugins/PositionsParticles.hpp | 10 +++++++--- .../include/plugins/SliceFieldPrinter.tpp | 4 +--- .../include/plugins/SliceFieldPrinterMulti.tpp | 4 ++-- .../include/plugins/output/HDF5Writer.hpp | 2 -- .../plugins/output/images/DensityToBinary.hpp | 2 +- .../include/simulationControl/MySimulation.hpp | 12 ++++++------ 17 files changed, 58 insertions(+), 34 deletions(-) diff --git a/doc/INSTALL.md b/doc/INSTALL.md index bb10e14d26..0ab3ccc9a5 100644 --- a/doc/INSTALL.md +++ b/doc/INSTALL.md @@ -8,6 +8,7 @@ Requirements - **gcc** 4.3 to 4.6 (depends on current CUDA version) - *Debian/Ubuntu:* `apt-get install gcc-4.4 build-essential` + - *experimental alternatives:* **icc 12.1** and **pgi 13.6** with **cuda 5.5** - [CUDA 5.5](https://developer.nvidia.com/cuda-downloads) or higher diff --git a/src/libPMacc/include/cuSTL/container/CartBuffer.tpp b/src/libPMacc/include/cuSTL/container/CartBuffer.tpp index 6cf160d2b0..10a8399aba 100644 --- a/src/libPMacc/include/cuSTL/container/CartBuffer.tpp +++ b/src/libPMacc/include/cuSTL/container/CartBuffer.tpp @@ -241,7 +241,7 @@ CartBuffer::originCustomAxes(const math if(dim > 2) factor[2] = this->pitch[1]; //\todo: is the conversation from size_t to uint32_t allowed? math::Int customFactor; - for(uint32_t i = 0; i < dim; i++) + for(int i = 0; i < dim; i++) customFactor[i] = (int)factor[axes[i]]; cursor::CartNavigator navi(customFactor); diff --git a/src/libPMacc/include/lambda/ProxyClass.hpp b/src/libPMacc/include/lambda/ProxyClass.hpp index 522f4c174a..e235a7d70d 100644 --- a/src/libPMacc/include/lambda/ProxyClass.hpp +++ b/src/libPMacc/include/lambda/ProxyClass.hpp @@ -29,6 +29,17 @@ namespace lambda { namespace CT { +namespace detail +{ + /** Create a same-sized type we can savely cast to + * Raw data represents a contructor-free data block + */ + template + struct raw_data + { + uint8_t data[x]; + }; +} // namespace detail template class ProxyClass; @@ -37,18 +48,18 @@ template class ProxyClass { private: - char data[sizeofType]; + detail::raw_data data; public: typedef Type type; HDINLINE operator Type&() { - return *(reinterpret_cast(this->data)); + return *(reinterpret_cast(&data)); } HDINLINE operator const Type&() const { - return *(reinterpret_cast(this->data)); + return *(reinterpret_cast(&data)); } }; diff --git a/src/picongpu/CMakeLists.txt b/src/picongpu/CMakeLists.txt index 2770501202..43c3ff5da1 100644 --- a/src/picongpu/CMakeLists.txt +++ b/src/picongpu/CMakeLists.txt @@ -175,7 +175,19 @@ IF(PIC_ENABLE_INSITU_VOLVIS) SET(LIBS ${LIBS} ${ICET_CORE_LIBS} ${ICET_MPI_LIBS}) ENDIF(PIC_ENABLE_INSITU_VOLVIS) -SET(CMAKE_CXX_FLAGS_DEFAULT "-Wall") +######################################################################### +# Warnings +# GNU +IF(CMAKE_COMPILER_IS_GNUCXX) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas") +# ICC +ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") +# PGI +ELSEIF(${CMAKE_CXX_COMPILER_ID} STREQUAL "PGI") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Minform=inform") +ENDIF() ######################################################################### diff --git a/src/picongpu/include/fields/FieldB.tpp b/src/picongpu/include/fields/FieldB.tpp index 60118d6673..161d252888 100644 --- a/src/picongpu/include/fields/FieldB.tpp +++ b/src/picongpu/include/fields/FieldB.tpp @@ -79,7 +79,7 @@ fieldE( NULL ) * * don't switch end and origin because this is a readbuffer and no sendbuffer */ DataSpace guardingCells; - for ( int d = 0; d < simDim; ++d ) + for ( uint32_t d = 0; d < simDim; ++d ) guardingCells[d] = ( relativMask[d] == -1 ? originGuard[d] : diff --git a/src/picongpu/include/fields/FieldE.tpp b/src/picongpu/include/fields/FieldE.tpp index 95b1b59539..766cbdc521 100644 --- a/src/picongpu/include/fields/FieldE.tpp +++ b/src/picongpu/include/fields/FieldE.tpp @@ -67,7 +67,7 @@ fieldB( NULL ) const DataSpace endGuard( UpperMargin( ).vec( ) ); /*receive from all directions*/ - for ( int i = 1; i < 27; ++i ) + for ( uint32_t i = 1; i < 27; ++i ) { DataSpace relativMask = Mask::getRelativeDirections ( i ); /*guarding cells depend on direction @@ -75,7 +75,7 @@ fieldB( NULL ) * don't switch end and origin because this is a readbuffer and no sendbuffer */ DataSpace guardingCells; - for ( int d = 0; d < simDim; ++d ) + for ( uint32_t d = 0; d < simDim; ++d ) guardingCells[d] = ( relativMask[d] == -1 ? originGuard[d] : endGuard[d] ); fieldE->addExchange( GUARD, i, guardingCells, FIELD_E ); } diff --git a/src/picongpu/include/fields/FieldJ.tpp b/src/picongpu/include/fields/FieldJ.tpp index 960d7ee0b6..91620dce4f 100644 --- a/src/picongpu/include/fields/FieldJ.tpp +++ b/src/picongpu/include/fields/FieldJ.tpp @@ -57,13 +57,13 @@ fieldJ( cellDescription.getGridLayout( ) ), fieldE( NULL ) const DataSpace endGuard( UpperMargin( ).vec( ) ); /*go over all directions*/ - for ( int i = 1; i < 27; ++i ) + for ( uint32_t i = 1; i < 27; ++i ) { DataSpace relativMask = Mask::getRelativeDirections ( i ); /*guarding cells depend on direction */ DataSpace guardingCells; - for ( int d = 0; d < simDim; ++d ) + for ( uint32_t d = 0; d < simDim; ++d ) { /*originGuard and endGuard are switch because we send data * e.g. from left I get endGuardingCells and from right I originGuardingCells diff --git a/src/picongpu/include/fields/FieldTmp.tpp b/src/picongpu/include/fields/FieldTmp.tpp index cc5b10d555..30e1ef7ace 100644 --- a/src/picongpu/include/fields/FieldTmp.tpp +++ b/src/picongpu/include/fields/FieldTmp.tpp @@ -72,13 +72,13 @@ namespace picongpu const DataSpace endGuard( UpperMargin( ).vec( ) ); /*go over all directions*/ - for( int i = 1; i < 27; ++i ) + for( uint32_t i = 1; i < 27; ++i ) { DataSpace relativMask = Mask::getRelativeDirections ( i ); /*guarding cells depend on direction */ DataSpace guardingCells; - for( int d = 0; d < simDim; ++d ) + for( uint32_t d = 0; d < simDim; ++d ) { /*originGuard and endGuard are switch because we send data * e.g. from left I get endGuardingCells and from right I originGuardingCells diff --git a/src/picongpu/include/initialization/ParserGridDistribution.hpp b/src/picongpu/include/initialization/ParserGridDistribution.hpp index e47b639ab8..c4c5603dc8 100644 --- a/src/picongpu/include/initialization/ParserGridDistribution.hpp +++ b/src/picongpu/include/initialization/ParserGridDistribution.hpp @@ -67,7 +67,7 @@ class ParserGridDistribution sum += iter->first * ( gpuPos + iter->second - i - 1 ); // check total number of cells - int sumTotal = 0; + uint32_t sumTotal = 0; for( iter = parsedInput.begin(); iter != parsedInput.end(); ++iter ) sumTotal += iter->first * iter->second; diff --git a/src/picongpu/include/initialization/SimRestartInitialiser.hpp b/src/picongpu/include/initialization/SimRestartInitialiser.hpp index b28fa053a5..5da9b3a1a1 100644 --- a/src/picongpu/include/initialization/SimRestartInitialiser.hpp +++ b/src/picongpu/include/initialization/SimRestartInitialiser.hpp @@ -612,9 +612,9 @@ class SimRestartInitialiser : public AbstractInitialiser domain_size, &data_class); - for (int z = 0; z < domain_size[2]; ++z) - for (int y = 0; y < domain_size[1]; ++y) - for (int x = 0; x < domain_size[0]; ++x) + for (uint32_t z = 0; z < domain_size[2]; ++z) + for (uint32_t y = 0; y < domain_size[1]; ++y) + for (uint32_t x = 0; x < domain_size[0]; ++x) { // src is field_data large, dst is field_grid large diff --git a/src/picongpu/include/particles/Particles.kernel b/src/picongpu/include/particles/Particles.kernel index 9a3646f732..308ca5f47d 100644 --- a/src/picongpu/include/particles/Particles.kernel +++ b/src/picongpu/include/particles/Particles.kernel @@ -466,7 +466,7 @@ struct PushParticlePerFrame * set particle at cell supercell_size to 1 * and partticle at cell -1 to supercell_size-1 * % (mod) can't use with negativ numbers, we add one supercell_size to hide this - /* + * localCell.x() = (localCell.x() + TVec::x) % TVec::x; localCell.y() = (localCell.y() + TVec::y) % TVec::y; localCell.z() = (localCell.z() + TVec::z) % TVec::z; diff --git a/src/picongpu/include/plugins/PositionsParticles.hpp b/src/picongpu/include/plugins/PositionsParticles.hpp index a5b86dc0f3..e19e684da5 100644 --- a/src/picongpu/include/plugins/PositionsParticles.hpp +++ b/src/picongpu/include/plugins/PositionsParticles.hpp @@ -46,13 +46,18 @@ namespace po = boost::program_options; template struct SglParticle { - float3_X position; - FloatPos momentum; + FloatPos position; + float3_X momentum; float_X mass; float_X weighting; float_X charge; float_X gamma; + SglParticle() : position(0.0,0.0,0.0), momentum(0.0,0.0, 0.0), mass(0.0), + weighting(0.0), charge(0.0), gamma(0.0) + { + } + DataSpace globalCellOffset; //! todo @@ -244,7 +249,6 @@ class PositionsParticles : public ISimulationIO, public IPluginModule typedef typename MappingDesc::SuperCellSize SuperCellSize; SglParticle positionParticleTmp; - positionParticleTmp.mass = float_X(0.0); gParticle->getDeviceBuffer().setValue(positionParticleTmp); dim3 block(SuperCellSize::getDataSpace()); diff --git a/src/picongpu/include/plugins/SliceFieldPrinter.tpp b/src/picongpu/include/plugins/SliceFieldPrinter.tpp index 7964735cb5..3b2efc51de 100644 --- a/src/picongpu/include/plugins/SliceFieldPrinter.tpp +++ b/src/picongpu/include/plugins/SliceFieldPrinter.tpp @@ -99,8 +99,6 @@ void SliceFieldPrinter::printSlice(const TField& field, int nAxi algorithm::mpi::Gather<3> gather(gpuGatheringZone); if(!gather.participate()) return; - - vec::Size_t<3> size = field.size(); using namespace lambda; vec::UInt<3> twistedVector((nAxis+1)%3, (nAxis+2)%3, nAxis); @@ -111,7 +109,7 @@ void SliceFieldPrinter::printSlice(const TField& field, int nAxi else if(FieldId == FIELD_B) SI = UNIT_BFIELD; - algorithm::kernel::Foreach >()( + algorithm::kernel::Foreach >()( dBuffer->zone(), dBuffer->origin(), cursor::tools::slice(field.originCustomAxes(twistedVector)(0,0,localPlane)), _1 = _2 * SI); diff --git a/src/picongpu/include/plugins/SliceFieldPrinterMulti.tpp b/src/picongpu/include/plugins/SliceFieldPrinterMulti.tpp index 10de217750..b8708a77f0 100644 --- a/src/picongpu/include/plugins/SliceFieldPrinterMulti.tpp +++ b/src/picongpu/include/plugins/SliceFieldPrinterMulti.tpp @@ -73,7 +73,7 @@ template void SliceFieldPrinterMulti::moduleLoad() { this->childs.resize(this->notifyFrequency.size()); - for(int i = 0; i < this->childs.size(); i++) + for(uint32_t i = 0; i < this->childs.size(); i++) { this->childs[i].setMappingDescription(this->cellDescription); this->childs[i].notifyFrequency = this->notifyFrequency[i]; @@ -87,7 +87,7 @@ void SliceFieldPrinterMulti::moduleLoad() template void SliceFieldPrinterMulti::moduleUnload() { - for(int i = 0; i < this->childs.size(); i++) + for(uint32_t i = 0; i < this->childs.size(); i++) this->childs[i].moduleUnload(); } diff --git a/src/picongpu/include/plugins/output/HDF5Writer.hpp b/src/picongpu/include/plugins/output/HDF5Writer.hpp index 382f05896f..7dd4140f77 100644 --- a/src/picongpu/include/plugins/output/HDF5Writer.hpp +++ b/src/picongpu/include/plugins/output/HDF5Writer.hpp @@ -371,8 +371,6 @@ class HDF5Writer : public ISimulationIO, public IPluginModule void openH5File() { - GridController &gc = GridController::getInstance(); - const uint32_t maxOpenFilesPerNode = 4; mThreadParams.dataCollector = new DCollector::DomainCollector( maxOpenFilesPerNode ); diff --git a/src/picongpu/include/plugins/output/images/DensityToBinary.hpp b/src/picongpu/include/plugins/output/images/DensityToBinary.hpp index 00cb4f0c87..b8ad6a7ef0 100755 --- a/src/picongpu/include/plugins/output/images/DensityToBinary.hpp +++ b/src/picongpu/include/plugins/output/images/DensityToBinary.hpp @@ -116,7 +116,7 @@ namespace picongpu { const ValueType value = typeCast(data[y][x]) * unit; - /** + /** \info take care, that gnuplots binary matrix does * not support float64 (IEEE float32 only) * \see http://stackoverflow.com/questions/8751154/looking-at-binary-output-from-fortran-on-gnuplot diff --git a/src/picongpu/include/simulationControl/MySimulation.hpp b/src/picongpu/include/simulationControl/MySimulation.hpp index 6ef4c12146..6b4cb23a0c 100644 --- a/src/picongpu/include/simulationControl/MySimulation.hpp +++ b/src/picongpu/include/simulationControl/MySimulation.hpp @@ -153,7 +153,7 @@ class MySimulation : public SimulationHelper DataSpace gpus; DataSpace isPeriodic; - for (int i = 0; i < (int) simDim; ++i) + for (uint32_t i = 0; i < simDim; ++i) { global_grid_size[i] = gridSize[i]; gpus[i] = devices[i]; @@ -165,7 +165,7 @@ class MySimulation : public SimulationHelper // calculate the number of local grid cells and // the local cell offset to the global box - for (int dim = 0; dim < gridDistribution.size(); ++dim) + for (uint32_t dim = 0; dim < gridDistribution.size(); ++dim) { // parse string ParserGridDistribution parserGD( gridDistribution.at(dim) ); @@ -175,7 +175,7 @@ class MySimulation : public SimulationHelper gridOffset[dim] = parserGD.getOffset( myGPUpos[dim], global_grid_size[dim] ); } // by default: use an equal distributed box for all omitted params - for (int dim = gridDistribution.size(); dim < simDim; ++dim) + for (uint32_t dim = gridDistribution.size(); dim < simDim; ++dim) { gridSizeLocal[dim] = global_grid_size[dim] / gpus[dim]; gridOffset[dim] = gridSizeLocal[dim] * myGPUpos[dim]; @@ -453,9 +453,9 @@ class MySimulation : public SimulationHelper // local size must be at least 3 supercells (1x core + 2x border) // note: size of border = guard_size (in supercells) // \todo we have to add the guard_x/y/z for modified supercells here - assert(gridSizeLocal[0] / MappingDesc::SuperCellSize::x >= 3 * GUARD_SIZE); - assert(gridSizeLocal[1] / MappingDesc::SuperCellSize::y >= 3 * GUARD_SIZE); - assert(gridSizeLocal[2] / MappingDesc::SuperCellSize::z >= 3 * GUARD_SIZE); + assert( (uint32_t) gridSizeLocal[0] / MappingDesc::SuperCellSize::x >= 3 * GUARD_SIZE); + assert( (uint32_t) gridSizeLocal[1] / MappingDesc::SuperCellSize::y >= 3 * GUARD_SIZE); + assert( (uint32_t) gridSizeLocal[2] / MappingDesc::SuperCellSize::z >= 3 * GUARD_SIZE); } From 795e4abfb36366f9f2b919e68c5ad77bfd7a52d7 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Tue, 27 Aug 2013 17:02:37 +0200 Subject: [PATCH 09/54] Fix some -Wextra warnings - for the brave and venturesome ;) --- .../include/eventSystem/tasks/TaskCopyDeviceToDevice.hpp | 2 +- src/libPMacc/include/eventSystem/tasks/TaskCopyDeviceToHost.hpp | 2 +- src/libPMacc/include/eventSystem/tasks/TaskCopyHostToDevice.hpp | 2 +- src/picongpu/CMakeLists.txt | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libPMacc/include/eventSystem/tasks/TaskCopyDeviceToDevice.hpp b/src/libPMacc/include/eventSystem/tasks/TaskCopyDeviceToDevice.hpp index ef8d81bbaa..4a3092df40 100644 --- a/src/libPMacc/include/eventSystem/tasks/TaskCopyDeviceToDevice.hpp +++ b/src/libPMacc/include/eventSystem/tasks/TaskCopyDeviceToDevice.hpp @@ -168,7 +168,7 @@ namespace PMacc virtual void copy(DataSpace &devCurrentSize) { - cudaMemcpy3DParms params = {0}; + cudaMemcpy3DParms params; // assert(this->source->getDataSpace().getElementCount() <= this->destination->getDataSpace().getElementCount()); diff --git a/src/libPMacc/include/eventSystem/tasks/TaskCopyDeviceToHost.hpp b/src/libPMacc/include/eventSystem/tasks/TaskCopyDeviceToHost.hpp index b3219be15a..be43d9c4f4 100644 --- a/src/libPMacc/include/eventSystem/tasks/TaskCopyDeviceToHost.hpp +++ b/src/libPMacc/include/eventSystem/tasks/TaskCopyDeviceToHost.hpp @@ -180,7 +180,7 @@ namespace PMacc hostPtr.xsize = this->host->getDataSpace()[0] * sizeof (TYPE); hostPtr.ysize = this->host->getDataSpace()[1]; - cudaMemcpy3DParms params = {0}; + cudaMemcpy3DParms params; params.srcArray = NULL; params.srcPos = make_cudaPos(this->device->getOffset()[0] * sizeof (TYPE), this->device->getOffset()[1], diff --git a/src/libPMacc/include/eventSystem/tasks/TaskCopyHostToDevice.hpp b/src/libPMacc/include/eventSystem/tasks/TaskCopyHostToDevice.hpp index 59f04d73b1..6abfa00a90 100644 --- a/src/libPMacc/include/eventSystem/tasks/TaskCopyHostToDevice.hpp +++ b/src/libPMacc/include/eventSystem/tasks/TaskCopyHostToDevice.hpp @@ -169,7 +169,7 @@ namespace PMacc hostPtr.xsize = this->host->getDataSpace()[0] * sizeof (TYPE); hostPtr.ysize = this->host->getDataSpace()[1]; - cudaMemcpy3DParms params = {0}; + cudaMemcpy3DParms params; params.dstArray = NULL; params.dstPos = make_cudaPos(this->device->getOffset()[0] * sizeof (TYPE), this->device->getOffset()[1], diff --git a/src/picongpu/CMakeLists.txt b/src/picongpu/CMakeLists.txt index 43c3ff5da1..4325c45129 100644 --- a/src/picongpu/CMakeLists.txt +++ b/src/picongpu/CMakeLists.txt @@ -181,6 +181,8 @@ ENDIF(PIC_ENABLE_INSITU_VOLVIS) IF(CMAKE_COMPILER_IS_GNUCXX) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas") +# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") +# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter") # ICC ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") From 63b00806f9ac52bea47fe307b619170ec505f009 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Wed, 28 Aug 2013 09:47:43 +0200 Subject: [PATCH 10/54] Use Base Class Copy Constructor --- src/libPMacc/include/dimensions/DataSpace.hpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/libPMacc/include/dimensions/DataSpace.hpp b/src/libPMacc/include/dimensions/DataSpace.hpp index 69d46c8c12..63342f7dca 100644 --- a/src/libPMacc/include/dimensions/DataSpace.hpp +++ b/src/libPMacc/include/dimensions/DataSpace.hpp @@ -76,12 +76,8 @@ class DataSpace : public math::Int } } - HDINLINE DataSpace(const DataSpace& value) + HDINLINE DataSpace(const DataSpace& value) : math::Int(value) { - for (uint32_t i = 0; i < DIM; ++i) - { - (*this)[i] = value[i]; - } } /** From 3f1ecce178fcb08a6c929f388e8cc981bc5c4d3e Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Wed, 28 Aug 2013 11:39:02 +0200 Subject: [PATCH 11/54] Enable -Wextra for GCC and fix warnings - fix nearly all -Wunused-parameter warnings - still got cuSTL algorithm ForEach Warnings for Lambda Calls from DeviceMemAssigner.hpp - Wextra activated but unused-parameter deactivated so far --- .../param/visColorScales.param | 6 ++--- .../param/visColorScales.param | 6 ++--- .../param/visColorScales.param | 6 ++--- .../param/visColorScales.param | 6 ++--- .../param/visColorScales.param | 6 ++--- .../param/visColorScales.param | 6 ++--- .../param/visColorScales.param | 6 ++--- .../include/cuSTL/container/CartBuffer.tpp | 2 +- .../include/dataManagement/DataConnector.hpp | 2 +- src/libPMacc/include/debug/VerboseLog.hpp | 12 ++++----- src/libPMacc/include/eventSystem/Manager.tpp | 6 ++--- .../include/eventSystem/tasks/Factory.hpp | 2 +- .../tasks/TaskCopyDeviceToDevice.hpp | 2 +- .../tasks/TaskCopyDeviceToHost.hpp | 2 +- .../tasks/TaskCopyHostToDevice.hpp | 2 +- .../tasks/TaskGetCurrentSizeFromDevice.hpp | 2 +- .../include/eventSystem/tasks/TaskKernel.hpp | 2 +- .../eventSystem/tasks/TaskLogicalAnd.hpp | 2 +- .../include/eventSystem/tasks/TaskReceive.hpp | 2 +- .../eventSystem/tasks/TaskReceiveMPI.hpp | 2 +- .../include/eventSystem/tasks/TaskSend.hpp | 2 +- .../include/eventSystem/tasks/TaskSendMPI.hpp | 2 +- .../tasks/TaskSetCurrentSizeOnDevice.hpp | 2 +- .../eventSystem/tasks/TaskSetValue.hpp | 4 +-- .../eventSystem/transactions/Transaction.tpp | 4 +-- .../transactions/TransactionManager.tpp | 2 +- .../mappings/kernel/AreaMappingMethods.hpp | 8 +++--- .../include/memory/boxes/MultiBox.hpp | 2 +- .../include/memory/boxes/PitchedBox.hpp | 4 +-- .../include/memory/buffers/GridBuffer.hpp | 2 +- .../include/mpi/reduceMethods/AllReduce.hpp | 2 +- .../include/mpi/reduceMethods/Reduce.hpp | 2 +- .../particleFilter/system/TrueFilter.hpp | 2 +- .../particles/tasks/ParticleFactory.hpp | 2 +- .../particles/tasks/TaskParticlesReceive.hpp | 2 +- .../particles/tasks/TaskParticlesSend.hpp | 2 +- .../tasks/TaskReceiveParticlesExchange.hpp | 2 +- .../tasks/TaskSendParticlesExchange.hpp | 2 +- .../simulationControl/SimulationHelper.hpp | 2 +- src/picongpu/ArgsParser.cpp | 2 +- src/picongpu/CMakeLists.txt | 4 +-- src/picongpu/include/fields/FieldB.tpp | 2 +- src/picongpu/include/fields/FieldE.tpp | 2 +- src/picongpu/include/fields/FieldJ.tpp | 4 +-- src/picongpu/include/fields/FieldTmp.tpp | 4 +-- .../DirSplitting/DirSplitting.hpp | 2 +- .../fields/MaxwellSolver/None/NoSolver.hpp | 4 +-- .../fields/MaxwellSolver/Yee/YeeSolver.hpp | 2 +- .../fields/laserProfiles/laserNone.hpp | 4 +-- .../fields/laserProfiles/laserPlaneWave.hpp | 2 +- .../fields/laserProfiles/laserPolynom.hpp | 2 +- .../fields/laserProfiles/laserWavepacket.hpp | 2 +- .../include/fields/tasks/FieldFactory.hpp | 2 +- .../tasks/TaskFieldReceiveAndInsert.hpp | 2 +- .../TaskFieldReceiveAndInsertExchange.hpp | 2 +- .../include/fields/tasks/TaskFieldSend.hpp | 2 +- .../fields/tasks/TaskFieldSendExchange.hpp | 2 +- .../initialization/SimRestartInitialiser.hpp | 4 +-- src/picongpu/include/particles/Particles.tpp | 4 +-- src/picongpu/include/particles/shapes/NGP.hpp | 2 +- .../include/plugins/IntensityModule.hpp | 2 +- .../include/plugins/ParticleSpectrum.tpp | 2 +- .../include/plugins/PluginController.hpp | 2 +- .../simulationControl/MySimulation.hpp | 2 +- .../simulationControl/SimulationStarter.hpp | 2 +- .../param/componentsConfig.param | 20 -------------- .../param/currentConfig.param | 20 -------------- .../param/fieldConfig.param | 20 -------------- .../simulation_defines/param/gasConfig.param | 20 -------------- .../simulation_defines/param/gridConfig.param | 20 -------------- .../param/laserConfig.param | 20 -------------- .../simulation_defines/param/memory.param | 20 -------------- .../param/particleConfig.param | 20 -------------- .../param/physicalConstants.param | 20 -------------- .../simulation_defines/param/precision.param | 20 -------------- .../param/pusherConfig.param | 20 -------------- .../param/radiationConfig.param | 20 -------------- .../simulation_defines/param/starter.param | 20 -------------- .../param/visColorScales.param | 26 +++---------------- .../param/visualization.param | 20 -------------- 80 files changed, 101 insertions(+), 403 deletions(-) diff --git a/examples/Bunch/include/simulation_defines/param/visColorScales.param b/examples/Bunch/include/simulation_defines/param/visColorScales.param index b83064bacc..8307bebc4f 100644 --- a/examples/Bunch/include/simulation_defines/param/visColorScales.param +++ b/examples/Bunch/include/simulation_defines/param/visColorScales.param @@ -32,9 +32,9 @@ namespace picongpu { namespace none { - HDINLINE void addRGB( const float3_X& img, - const float_X value, - const float_X opacity ) + HDINLINE void addRGB( const float3_X&, + const float_X, + const float_X ) { return; } diff --git a/examples/KelvinHelmholtz/include/simulation_defines/param/visColorScales.param b/examples/KelvinHelmholtz/include/simulation_defines/param/visColorScales.param index cff21fa0c3..cee4965ce6 100644 --- a/examples/KelvinHelmholtz/include/simulation_defines/param/visColorScales.param +++ b/examples/KelvinHelmholtz/include/simulation_defines/param/visColorScales.param @@ -32,9 +32,9 @@ namespace picongpu { namespace none { - HDINLINE void addRGB( const float3_X& img, - const float_X value, - const float_X opacity ) + HDINLINE void addRGB( const float3_X&, + const float_X, + const float_X ) { return; } diff --git a/examples/LaserWakefield/include/simulation_defines/param/visColorScales.param b/examples/LaserWakefield/include/simulation_defines/param/visColorScales.param index 3f1c773211..9ff6273f03 100644 --- a/examples/LaserWakefield/include/simulation_defines/param/visColorScales.param +++ b/examples/LaserWakefield/include/simulation_defines/param/visColorScales.param @@ -32,9 +32,9 @@ namespace picongpu { namespace none { - HDINLINE void addRGB( const float3_X& img, - const float_X value, - const float_X opacity ) + HDINLINE void addRGB( const float3_X&, + const float_X, + const float_X ) { return; } diff --git a/examples/SingleParticleCurrent/include/simulation_defines/param/visColorScales.param b/examples/SingleParticleCurrent/include/simulation_defines/param/visColorScales.param index cff21fa0c3..cee4965ce6 100644 --- a/examples/SingleParticleCurrent/include/simulation_defines/param/visColorScales.param +++ b/examples/SingleParticleCurrent/include/simulation_defines/param/visColorScales.param @@ -32,9 +32,9 @@ namespace picongpu { namespace none { - HDINLINE void addRGB( const float3_X& img, - const float_X value, - const float_X opacity ) + HDINLINE void addRGB( const float3_X&, + const float_X, + const float_X ) { return; } diff --git a/examples/SingleParticleRadiationWithLaser/include/simulation_defines/param/visColorScales.param b/examples/SingleParticleRadiationWithLaser/include/simulation_defines/param/visColorScales.param index cff21fa0c3..cee4965ce6 100644 --- a/examples/SingleParticleRadiationWithLaser/include/simulation_defines/param/visColorScales.param +++ b/examples/SingleParticleRadiationWithLaser/include/simulation_defines/param/visColorScales.param @@ -32,9 +32,9 @@ namespace picongpu { namespace none { - HDINLINE void addRGB( const float3_X& img, - const float_X value, - const float_X opacity ) + HDINLINE void addRGB( const float3_X&, + const float_X, + const float_X ) { return; } diff --git a/examples/SingleParticleTest/include/simulation_defines/param/visColorScales.param b/examples/SingleParticleTest/include/simulation_defines/param/visColorScales.param index cff21fa0c3..cee4965ce6 100644 --- a/examples/SingleParticleTest/include/simulation_defines/param/visColorScales.param +++ b/examples/SingleParticleTest/include/simulation_defines/param/visColorScales.param @@ -32,9 +32,9 @@ namespace picongpu { namespace none { - HDINLINE void addRGB( const float3_X& img, - const float_X value, - const float_X opacity ) + HDINLINE void addRGB( const float3_X&, + const float_X, + const float_X ) { return; } diff --git a/examples/WeibelTransverse/include/simulation_defines/param/visColorScales.param b/examples/WeibelTransverse/include/simulation_defines/param/visColorScales.param index cff21fa0c3..cee4965ce6 100644 --- a/examples/WeibelTransverse/include/simulation_defines/param/visColorScales.param +++ b/examples/WeibelTransverse/include/simulation_defines/param/visColorScales.param @@ -32,9 +32,9 @@ namespace picongpu { namespace none { - HDINLINE void addRGB( const float3_X& img, - const float_X value, - const float_X opacity ) + HDINLINE void addRGB( const float3_X&, + const float_X, + const float_X ) { return; } diff --git a/src/libPMacc/include/cuSTL/container/CartBuffer.tpp b/src/libPMacc/include/cuSTL/container/CartBuffer.tpp index 10a8399aba..8d01501806 100644 --- a/src/libPMacc/include/cuSTL/container/CartBuffer.tpp +++ b/src/libPMacc/include/cuSTL/container/CartBuffer.tpp @@ -35,7 +35,7 @@ namespace detail struct PitchHelper<1> { template - HDINLINE math::Size_t<0u> operator()(const TCursor& cursor) {return math::Size_t<0u>();} + HDINLINE math::Size_t<0u> operator()(const TCursor&) {return math::Size_t<0u>();} }; template<> struct PitchHelper<2> diff --git a/src/libPMacc/include/dataManagement/DataConnector.hpp b/src/libPMacc/include/dataManagement/DataConnector.hpp index 0ba401f21a..fd76cc06fd 100644 --- a/src/libPMacc/include/dataManagement/DataConnector.hpp +++ b/src/libPMacc/include/dataManagement/DataConnector.hpp @@ -211,7 +211,7 @@ namespace PMacc * * @param id id for the dataset previously acquired using getData() */ - void releaseData(uint32_t id) + void releaseData(uint32_t) { } diff --git a/src/libPMacc/include/debug/VerboseLog.hpp b/src/libPMacc/include/debug/VerboseLog.hpp index 5404ef1ccb..16953c20b3 100644 --- a/src/libPMacc/include/debug/VerboseLog.hpp +++ b/src/libPMacc/include/debug/VerboseLog.hpp @@ -68,11 +68,11 @@ struct LogLvl typedef membership_ Parent; static const uint64_t lvl = lvl_; - /*this operation is only allowed for LogLvl from the same parent - * create a LogLvl which has to lvl, only on lvl must be set to be true + /* This operation is only allowed for LogLvl with the same Parent type. + * Create a LogLvl that contains two levels. At least one lvl has to be true */ template - LogLvl < (OtherLogLvl::lvl | lvl), membership_> operator+(const OtherLogLvl & other) + LogLvl < (OtherLogLvl::lvl | lvl), membership_> operator+(const OtherLogLvl&) { return LogLvl < (OtherLogLvl::lvl | lvl), membership_ > (); } @@ -97,7 +97,7 @@ class VerboseLog ~VerboseLog() { typedef LogLvl<(logLvl & LogParent::log_level), LogParent> LogClass; - /* check if bit in mask is set + /* check if a bit in the mask is set * If you get an linker error in the next two lines you have not used * DEFINE_LOGLVL makro to define a named logLvl */ @@ -133,12 +133,12 @@ static verboseLog_detail::VerboseLog log(const char* msg) return verboseLog_detail::VerboseLog (msg); } -/* version which allow combine of error levels +/* version that allows to combine error levels * example call: * log(MYLOGLEVELS::CRITICAL+MYLOGLEVELS::MEMORY,"printf %2% stream %1%, number example %3%.") % "messages" % "style" % 5 */ template -static verboseLog_detail::VerboseLog log(const LogLvl lvl, const char* msg) +static verboseLog_detail::VerboseLog log(const LogLvl, const char* msg) { return verboseLog_detail::VerboseLog (msg); } diff --git a/src/libPMacc/include/eventSystem/Manager.tpp b/src/libPMacc/include/eventSystem/Manager.tpp index 1ba8f1af20..a3008c9b23 100644 --- a/src/libPMacc/include/eventSystem/Manager.tpp +++ b/src/libPMacc/include/eventSystem/Manager.tpp @@ -46,8 +46,6 @@ inline Manager::~Manager( ) inline bool Manager::execute( id_t taskToWait ) { - ; - #ifdef DEBUG_EVENTS static int old_max = 0; static int deep = -1 @@ -109,7 +107,7 @@ inline bool Manager::execute( id_t taskToWait ) return false; } -inline void Manager::event( id_t eventId, EventType type, IEventData* data ) +inline void Manager::event( id_t eventId, EventType, IEventData* ) { passiveTasks.erase( eventId ); } @@ -206,7 +204,7 @@ inline Manager::Manager( ) eventPool->addEvents( 300 ); } -inline Manager::Manager( const Manager& cc ) +inline Manager::Manager( const Manager& ) { } diff --git a/src/libPMacc/include/eventSystem/tasks/Factory.hpp b/src/libPMacc/include/eventSystem/tasks/Factory.hpp index 15fcd4ba76..d0648e87b8 100644 --- a/src/libPMacc/include/eventSystem/tasks/Factory.hpp +++ b/src/libPMacc/include/eventSystem/tasks/Factory.hpp @@ -179,7 +179,7 @@ namespace PMacc Factory() { }; - Factory(const Factory& cc) { }; + Factory(const Factory&) { }; }; diff --git a/src/libPMacc/include/eventSystem/tasks/TaskCopyDeviceToDevice.hpp b/src/libPMacc/include/eventSystem/tasks/TaskCopyDeviceToDevice.hpp index 4a3092df40..d5e3724e23 100644 --- a/src/libPMacc/include/eventSystem/tasks/TaskCopyDeviceToDevice.hpp +++ b/src/libPMacc/include/eventSystem/tasks/TaskCopyDeviceToDevice.hpp @@ -58,7 +58,7 @@ namespace PMacc return isFinished(); } - void event(id_t eventId, EventType type, IEventData* data) + void event(id_t, EventType, IEventData*) { } diff --git a/src/libPMacc/include/eventSystem/tasks/TaskCopyDeviceToHost.hpp b/src/libPMacc/include/eventSystem/tasks/TaskCopyDeviceToHost.hpp index be43d9c4f4..d58a501726 100644 --- a/src/libPMacc/include/eventSystem/tasks/TaskCopyDeviceToHost.hpp +++ b/src/libPMacc/include/eventSystem/tasks/TaskCopyDeviceToHost.hpp @@ -62,7 +62,7 @@ namespace PMacc return isFinished(); } - void event(id_t eventId, EventType type, IEventData* data) + void event(id_t, EventType, IEventData*) { } diff --git a/src/libPMacc/include/eventSystem/tasks/TaskCopyHostToDevice.hpp b/src/libPMacc/include/eventSystem/tasks/TaskCopyHostToDevice.hpp index 6abfa00a90..993c1f25d2 100644 --- a/src/libPMacc/include/eventSystem/tasks/TaskCopyHostToDevice.hpp +++ b/src/libPMacc/include/eventSystem/tasks/TaskCopyHostToDevice.hpp @@ -59,7 +59,7 @@ namespace PMacc return isFinished(); } - void event(id_t eventId, EventType type, IEventData* data) + void event(id_t, EventType, IEventData*) { } diff --git a/src/libPMacc/include/eventSystem/tasks/TaskGetCurrentSizeFromDevice.hpp b/src/libPMacc/include/eventSystem/tasks/TaskGetCurrentSizeFromDevice.hpp index 5f30d0b295..fc61ae6a6f 100644 --- a/src/libPMacc/include/eventSystem/tasks/TaskGetCurrentSizeFromDevice.hpp +++ b/src/libPMacc/include/eventSystem/tasks/TaskGetCurrentSizeFromDevice.hpp @@ -61,7 +61,7 @@ class TaskGetCurrentSizeFromDevice : public StreamTask return isFinished(); } - void event(id_t eventId,EventType type, IEventData* data) + void event(id_t, EventType, IEventData*) { } diff --git a/src/libPMacc/include/eventSystem/tasks/TaskKernel.hpp b/src/libPMacc/include/eventSystem/tasks/TaskKernel.hpp index 1b6da2a9a3..afd6d9c5bf 100644 --- a/src/libPMacc/include/eventSystem/tasks/TaskKernel.hpp +++ b/src/libPMacc/include/eventSystem/tasks/TaskKernel.hpp @@ -58,7 +58,7 @@ namespace PMacc return false; } - void event(id_t eventId, EventType type, IEventData* data) + void event(id_t, EventType, IEventData*) { } diff --git a/src/libPMacc/include/eventSystem/tasks/TaskLogicalAnd.hpp b/src/libPMacc/include/eventSystem/tasks/TaskLogicalAnd.hpp index 1c5e507a9f..33d464779a 100644 --- a/src/libPMacc/include/eventSystem/tasks/TaskLogicalAnd.hpp +++ b/src/libPMacc/include/eventSystem/tasks/TaskLogicalAnd.hpp @@ -74,7 +74,7 @@ namespace PMacc return (task1 == 0) && (task2 == 0); } - void event(id_t eventId, EventType type, IEventData* data) + void event(id_t eventId, EventType, IEventData*) { if (task1 == eventId) { diff --git a/src/libPMacc/include/eventSystem/tasks/TaskReceive.hpp b/src/libPMacc/include/eventSystem/tasks/TaskReceive.hpp index 2662195242..5faf5805f8 100644 --- a/src/libPMacc/include/eventSystem/tasks/TaskReceive.hpp +++ b/src/libPMacc/include/eventSystem/tasks/TaskReceive.hpp @@ -96,7 +96,7 @@ namespace PMacc notify(this->myId, RECVFINISHED, NULL); } - void event(id_t eventId, EventType type, IEventData* data) + void event(id_t, EventType type, IEventData* data) { switch (type) { diff --git a/src/libPMacc/include/eventSystem/tasks/TaskReceiveMPI.hpp b/src/libPMacc/include/eventSystem/tasks/TaskReceiveMPI.hpp index 9d155388ba..617813e4b7 100644 --- a/src/libPMacc/include/eventSystem/tasks/TaskReceiveMPI.hpp +++ b/src/libPMacc/include/eventSystem/tasks/TaskReceiveMPI.hpp @@ -94,7 +94,7 @@ class TaskReceiveMPI : public MPITask } - void event(id_t eventId, EventType type, IEventData* data) + void event(id_t, EventType, IEventData*) { diff --git a/src/libPMacc/include/eventSystem/tasks/TaskSend.hpp b/src/libPMacc/include/eventSystem/tasks/TaskSend.hpp index 24c69d22e6..88379cddf9 100644 --- a/src/libPMacc/include/eventSystem/tasks/TaskSend.hpp +++ b/src/libPMacc/include/eventSystem/tasks/TaskSend.hpp @@ -102,7 +102,7 @@ namespace PMacc notify(this->myId, SENDFINISHED, NULL); } - void event(id_t eventId, EventType type, IEventData* data) + void event(id_t, EventType type, IEventData*) { if (type == COPYDEVICE2HOST) { diff --git a/src/libPMacc/include/eventSystem/tasks/TaskSendMPI.hpp b/src/libPMacc/include/eventSystem/tasks/TaskSendMPI.hpp index 153aadb4cc..8c1e943c15 100644 --- a/src/libPMacc/include/eventSystem/tasks/TaskSendMPI.hpp +++ b/src/libPMacc/include/eventSystem/tasks/TaskSendMPI.hpp @@ -84,7 +84,7 @@ class TaskSendMPI : public MPITask notify(this->myId, SENDFINISHED, NULL); } - void event(id_t eventId, EventType type, IEventData* data) + void event(id_t, EventType, IEventData*) { } diff --git a/src/libPMacc/include/eventSystem/tasks/TaskSetCurrentSizeOnDevice.hpp b/src/libPMacc/include/eventSystem/tasks/TaskSetCurrentSizeOnDevice.hpp index 3348404fc5..fdb76dfa07 100644 --- a/src/libPMacc/include/eventSystem/tasks/TaskSetCurrentSizeOnDevice.hpp +++ b/src/libPMacc/include/eventSystem/tasks/TaskSetCurrentSizeOnDevice.hpp @@ -71,7 +71,7 @@ class TaskSetCurrentSizeOnDevice : public StreamTask return isFinished(); } - void event(id_t eventId, EventType type, IEventData* data) + void event(id_t, EventType, IEventData*) { } diff --git a/src/libPMacc/include/eventSystem/tasks/TaskSetValue.hpp b/src/libPMacc/include/eventSystem/tasks/TaskSetValue.hpp index e5a91e1ef7..6c344da715 100644 --- a/src/libPMacc/include/eventSystem/tasks/TaskSetValue.hpp +++ b/src/libPMacc/include/eventSystem/tasks/TaskSetValue.hpp @@ -160,7 +160,7 @@ class TaskSetValue : public StreamTask return isFinished(); } - void event(id_t eventId, EventType type, IEventData* data) + void event(id_t, EventType, IEventData*) { } @@ -231,7 +231,7 @@ class TaskSetValue : public StreamTask return isFinished(); } - void event(id_t eventId, EventType type, IEventData* data) + void event(id_t, EventType, IEventData*) { } diff --git a/src/libPMacc/include/eventSystem/transactions/Transaction.tpp b/src/libPMacc/include/eventSystem/transactions/Transaction.tpp index 09f066f82b..c6b791e75a 100755 --- a/src/libPMacc/include/eventSystem/transactions/Transaction.tpp +++ b/src/libPMacc/include/eventSystem/transactions/Transaction.tpp @@ -60,13 +60,13 @@ inline EventTask Transaction::getTransactionEvent( ) return baseEvent; } -void Transaction::operation( ITask::TaskType operation ) +void Transaction::operation( ITask::TaskType ) { if ( isAtomic == false ) baseEvent.waitForFinished( ); } -EventStream* Transaction::getEventStream( ITask::TaskType operation ) +EventStream* Transaction::getEventStream( ITask::TaskType ) { return this->eventStream; } diff --git a/src/libPMacc/include/eventSystem/transactions/TransactionManager.tpp b/src/libPMacc/include/eventSystem/transactions/TransactionManager.tpp index 41a3eecaa8..a03949584e 100644 --- a/src/libPMacc/include/eventSystem/transactions/TransactionManager.tpp +++ b/src/libPMacc/include/eventSystem/transactions/TransactionManager.tpp @@ -37,7 +37,7 @@ inline TransactionManager::TransactionManager( ) startTransaction( EventTask( ) ); } -inline TransactionManager::TransactionManager( const TransactionManager& cc ) +inline TransactionManager::TransactionManager( const TransactionManager& ) { } diff --git a/src/libPMacc/include/mappings/kernel/AreaMappingMethods.hpp b/src/libPMacc/include/mappings/kernel/AreaMappingMethods.hpp index 43a376469b..9b0b8b8d83 100644 --- a/src/libPMacc/include/mappings/kernel/AreaMappingMethods.hpp +++ b/src/libPMacc/include/mappings/kernel/AreaMappingMethods.hpp @@ -46,15 +46,15 @@ namespace PMacc public: template - HINLINE static DataSpace getGridDim(const Base &base, const DataSpace &gBlocks) + HINLINE static DataSpace getGridDim(const Base&, const DataSpace &gBlocks) { return gBlocks; } template - HDINLINE static DataSpace getBlockIndex(const Base &base, - const DataSpace &gBlocks, - const DataSpace &_blockIdx) + HDINLINE static DataSpace getBlockIndex(const Base&, + const DataSpace&, + const DataSpace& _blockIdx) { return _blockIdx; } diff --git a/src/libPMacc/include/memory/boxes/MultiBox.hpp b/src/libPMacc/include/memory/boxes/MultiBox.hpp index c5451c4cca..b03c5a3199 100644 --- a/src/libPMacc/include/memory/boxes/MultiBox.hpp +++ b/src/libPMacc/include/memory/boxes/MultiBox.hpp @@ -95,7 +95,7 @@ class MultiBox return RefValueType(fixedPointer + idx, attributePitch); } - HDINLINE MultiBox(Type* pointer, const DataSpace &offset, const DataSpace &size, const size_t pitch) : + HDINLINE MultiBox(Type* pointer, const DataSpace &offset, const DataSpace&, const size_t pitch) : attributePitch(pitch), fixedPointer(pointer + offset[0]) { } diff --git a/src/libPMacc/include/memory/boxes/PitchedBox.hpp b/src/libPMacc/include/memory/boxes/PitchedBox.hpp index 83e4a15dc2..deeb37bcdd 100644 --- a/src/libPMacc/include/memory/boxes/PitchedBox.hpp +++ b/src/libPMacc/include/memory/boxes/PitchedBox.hpp @@ -55,7 +55,7 @@ class PitchedBox return fixedPointer[idx]; } - HDINLINE PitchedBox(TYPE* pointer, const DataSpace &offset, const DataSpace &size, const size_t pitch) : + HDINLINE PitchedBox(TYPE* pointer, const DataSpace &offset, const DataSpace&, const size_t) : fixedPointer(pointer + offset[0]) { } @@ -107,7 +107,7 @@ class PitchedBox typedef ValueType& RefValueType; typedef PitchedBox ReducedType; - HDINLINE PitchedBox(TYPE* pointer, const DataSpace &offset, const DataSpace &size, const size_t pitch) : + HDINLINE PitchedBox(TYPE* pointer, const DataSpace &offset, const DataSpace&, const size_t pitch) : pitch(pitch), fixedPointer((TYPE*) ((char*) pointer + offset[1] * pitch) + offset[0]) { diff --git a/src/libPMacc/include/memory/buffers/GridBuffer.hpp b/src/libPMacc/include/memory/buffers/GridBuffer.hpp index 01d57fd0fa..d9b8080265 100644 --- a/src/libPMacc/include/memory/buffers/GridBuffer.hpp +++ b/src/libPMacc/include/memory/buffers/GridBuffer.hpp @@ -70,7 +70,7 @@ class UniquTag /** * Constructor */ - UniquTag(const UniquTag & gc) + UniquTag(const UniquTag&) { } diff --git a/src/libPMacc/include/mpi/reduceMethods/AllReduce.hpp b/src/libPMacc/include/mpi/reduceMethods/AllReduce.hpp index df6d6d0204..f4b39563c1 100644 --- a/src/libPMacc/include/mpi/reduceMethods/AllReduce.hpp +++ b/src/libPMacc/include/mpi/reduceMethods/AllReduce.hpp @@ -42,7 +42,7 @@ struct AllReduce } template - HINLINE void operator()(Functor func, Type* dest, Type* src, const size_t count, MPI_Datatype type, MPI_Op op, MPI_Comm comm) const + HINLINE void operator()(Functor, Type* dest, Type* src, const size_t count, MPI_Datatype type, MPI_Op op, MPI_Comm comm) const { MPI_CHECK(MPI_Allreduce((void*) src, (void*) dest, diff --git a/src/libPMacc/include/mpi/reduceMethods/Reduce.hpp b/src/libPMacc/include/mpi/reduceMethods/Reduce.hpp index fc963cd719..b081ae3dfc 100644 --- a/src/libPMacc/include/mpi/reduceMethods/Reduce.hpp +++ b/src/libPMacc/include/mpi/reduceMethods/Reduce.hpp @@ -42,7 +42,7 @@ struct Reduce } template - HINLINE void operator()(Functor func, Type* dest, Type* src, const size_t count, MPI_Datatype type, MPI_Op op, MPI_Comm comm) const + HINLINE void operator()(Functor, Type* dest, Type* src, const size_t count, MPI_Datatype type, MPI_Op op, MPI_Comm comm) const { MPI_CHECK(MPI_Reduce((void*) src, (void*) dest, diff --git a/src/libPMacc/include/particles/particleFilter/system/TrueFilter.hpp b/src/libPMacc/include/particles/particleFilter/system/TrueFilter.hpp index b5fdbb3afd..54ce7c3ba2 100644 --- a/src/libPMacc/include/particles/particleFilter/system/TrueFilter.hpp +++ b/src/libPMacc/include/particles/particleFilter/system/TrueFilter.hpp @@ -45,7 +45,7 @@ namespace PMacc } template - HDINLINE bool operator()(FRAME & frame, lcellId_t id) + HDINLINE bool operator()(FRAME&, lcellId_t) { return true; } diff --git a/src/libPMacc/include/particles/tasks/ParticleFactory.hpp b/src/libPMacc/include/particles/tasks/ParticleFactory.hpp index efc0c70a30..25919cc618 100644 --- a/src/libPMacc/include/particles/tasks/ParticleFactory.hpp +++ b/src/libPMacc/include/particles/tasks/ParticleFactory.hpp @@ -82,7 +82,7 @@ namespace PMacc ParticleFactory() { }; - ParticleFactory(const ParticleFactory& cc) { }; + ParticleFactory(const ParticleFactory&) { }; }; diff --git a/src/libPMacc/include/particles/tasks/TaskParticlesReceive.hpp b/src/libPMacc/include/particles/tasks/TaskParticlesReceive.hpp index 7c4f4bb32b..3fb803b005 100644 --- a/src/libPMacc/include/particles/tasks/TaskParticlesReceive.hpp +++ b/src/libPMacc/include/particles/tasks/TaskParticlesReceive.hpp @@ -104,7 +104,7 @@ namespace PMacc notify(this->myId, RECVFINISHED, NULL); } - void event(id_t eventId, EventType type, IEventData* data) { } + void event(id_t, EventType, IEventData*) { } std::string toString() { diff --git a/src/libPMacc/include/particles/tasks/TaskParticlesSend.hpp b/src/libPMacc/include/particles/tasks/TaskParticlesSend.hpp index fedb46eb5d..55dbd73b9d 100644 --- a/src/libPMacc/include/particles/tasks/TaskParticlesSend.hpp +++ b/src/libPMacc/include/particles/tasks/TaskParticlesSend.hpp @@ -90,7 +90,7 @@ class TaskParticlesSend : public MPITask notify(this->myId, RECVFINISHED, NULL); } - void event(id_t eventId, EventType type, IEventData* data) + void event(id_t, EventType, IEventData*) { } diff --git a/src/libPMacc/include/particles/tasks/TaskReceiveParticlesExchange.hpp b/src/libPMacc/include/particles/tasks/TaskReceiveParticlesExchange.hpp index f52cb8a486..704d2b54fa 100644 --- a/src/libPMacc/include/particles/tasks/TaskReceiveParticlesExchange.hpp +++ b/src/libPMacc/include/particles/tasks/TaskReceiveParticlesExchange.hpp @@ -122,7 +122,7 @@ namespace PMacc notify(this->myId, RECVFINISHED, NULL); } - void event(id_t eventId, EventType type, IEventData* data) { } + void event(id_t, EventType, IEventData*) { } std::string toString() { diff --git a/src/libPMacc/include/particles/tasks/TaskSendParticlesExchange.hpp b/src/libPMacc/include/particles/tasks/TaskSendParticlesExchange.hpp index 283577c48a..942005657b 100644 --- a/src/libPMacc/include/particles/tasks/TaskSendParticlesExchange.hpp +++ b/src/libPMacc/include/particles/tasks/TaskSendParticlesExchange.hpp @@ -125,7 +125,7 @@ namespace PMacc notify(this->myId, RECVFINISHED, NULL); } - void event(id_t eventId, EventType type, IEventData* data) { } + void event(id_t, EventType, IEventData*) { } std::string toString() { diff --git a/src/libPMacc/include/simulationControl/SimulationHelper.hpp b/src/libPMacc/include/simulationControl/SimulationHelper.hpp index 625997a8de..8a8de16a9d 100644 --- a/src/libPMacc/include/simulationControl/SimulationHelper.hpp +++ b/src/libPMacc/include/simulationControl/SimulationHelper.hpp @@ -121,7 +121,7 @@ class SimulationHelper : public Module return GridController::getInstance(); } - void dumpTimes(TimeIntervall &tSimCalculation,TimeIntervall& tRound,double& roundAvg,uint32_t currentStep) + void dumpTimes(TimeIntervall &tSimCalculation, TimeIntervall&, double& roundAvg, uint32_t currentStep) { /*dump 100% after simulation*/ if (output && progress && (currentStep % showProgressAnyStep) == 0) diff --git a/src/picongpu/ArgsParser.cpp b/src/picongpu/ArgsParser.cpp index 7b79f73c5b..3075ad2508 100644 --- a/src/picongpu/ArgsParser.cpp +++ b/src/picongpu/ArgsParser.cpp @@ -38,7 +38,7 @@ namespace picongpu } - ArgsParser::ArgsParser( ArgsParser& cc ) + ArgsParser::ArgsParser( ArgsParser& ) { } diff --git a/src/picongpu/CMakeLists.txt b/src/picongpu/CMakeLists.txt index 4325c45129..810f29b9d7 100644 --- a/src/picongpu/CMakeLists.txt +++ b/src/picongpu/CMakeLists.txt @@ -181,8 +181,8 @@ ENDIF(PIC_ENABLE_INSITU_VOLVIS) IF(CMAKE_COMPILER_IS_GNUCXX) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas") -# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") -# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter") # ICC ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") diff --git a/src/picongpu/include/fields/FieldB.tpp b/src/picongpu/include/fields/FieldB.tpp index 161d252888..d94a1302e5 100644 --- a/src/picongpu/include/fields/FieldB.tpp +++ b/src/picongpu/include/fields/FieldB.tpp @@ -146,7 +146,7 @@ GridBuffer &FieldB::getGridBuffer( ) return *fieldB; } -void FieldB::reset( uint32_t currentStep ) +void FieldB::reset( uint32_t ) { fieldB->getHostBuffer( ).reset( true ); fieldB->getDeviceBuffer( ).reset( false ); diff --git a/src/picongpu/include/fields/FieldE.tpp b/src/picongpu/include/fields/FieldE.tpp index 766cbdc521..a22c0449f1 100644 --- a/src/picongpu/include/fields/FieldE.tpp +++ b/src/picongpu/include/fields/FieldE.tpp @@ -149,7 +149,7 @@ void FieldE::laserManipulation( uint32_t currentStep ) ( this->getDeviceDataBox( ), laser->getLaserManipulator( currentStep ) ); } -void FieldE::reset( uint32_t currentStep ) +void FieldE::reset( uint32_t ) { fieldE->getHostBuffer( ).reset( true ); fieldE->getDeviceBuffer( ).reset( false ); diff --git a/src/picongpu/include/fields/FieldJ.tpp b/src/picongpu/include/fields/FieldJ.tpp index 91620dce4f..6a4111bb3b 100644 --- a/src/picongpu/include/fields/FieldJ.tpp +++ b/src/picongpu/include/fields/FieldJ.tpp @@ -156,7 +156,7 @@ GridLayout FieldJ::getGridLayout( ) return cellDescription.getGridLayout( ); } -void FieldJ::reset( uint32_t currentStep ) +void FieldJ::reset( uint32_t ) { } @@ -187,7 +187,7 @@ FieldJ::getCommTag( ) } template -void FieldJ::computeCurrent( ParticlesClass &parClass, uint32_t currentStep ) throw (std::invalid_argument ) +void FieldJ::computeCurrent( ParticlesClass &parClass, uint32_t ) throw (std::invalid_argument ) { /** tune paramter to use more threads than cells in a supercell * valid domain: 1 <= workerMultiplier diff --git a/src/picongpu/include/fields/FieldTmp.tpp b/src/picongpu/include/fields/FieldTmp.tpp index 30e1ef7ace..e7d98161d5 100644 --- a/src/picongpu/include/fields/FieldTmp.tpp +++ b/src/picongpu/include/fields/FieldTmp.tpp @@ -107,7 +107,7 @@ namespace picongpu } template - void FieldTmp::computeValue( ParticlesClass& parClass, uint32_t currentStep ) + void FieldTmp::computeValue( ParticlesClass& parClass, uint32_t ) { typedef SuperCellDescription< typename MappingDesc::SuperCellSize, @@ -212,7 +212,7 @@ namespace picongpu return cellDescription.getGridLayout( ); } - void FieldTmp::reset( uint32_t currentStep ) + void FieldTmp::reset( uint32_t ) { fieldTmp->getHostBuffer( ).reset( true ); fieldTmp->getDeviceBuffer( ).reset( false ); diff --git a/src/picongpu/include/fields/MaxwellSolver/DirSplitting/DirSplitting.hpp b/src/picongpu/include/fields/MaxwellSolver/DirSplitting/DirSplitting.hpp index 65b69f3872..a8e99b7893 100644 --- a/src/picongpu/include/fields/MaxwellSolver/DirSplitting/DirSplitting.hpp +++ b/src/picongpu/include/fields/MaxwellSolver/DirSplitting/DirSplitting.hpp @@ -105,7 +105,7 @@ class DirSplitting __setTransactionEvent(fieldB.asyncCommunication(__getTransactionEvent())); } - void update_afterCurrent(uint32_t currentStep) const + void update_afterCurrent(uint32_t) const { } }; diff --git a/src/picongpu/include/fields/MaxwellSolver/None/NoSolver.hpp b/src/picongpu/include/fields/MaxwellSolver/None/NoSolver.hpp index febfb474af..77d1719455 100644 --- a/src/picongpu/include/fields/MaxwellSolver/None/NoSolver.hpp +++ b/src/picongpu/include/fields/MaxwellSolver/None/NoSolver.hpp @@ -61,12 +61,12 @@ namespace picongpu } - void update_beforeCurrent(uint32_t currentStep) + void update_beforeCurrent(uint32_t) { } - void update_afterCurrent(uint32_t currentStep) + void update_afterCurrent(uint32_t) { } diff --git a/src/picongpu/include/fields/MaxwellSolver/Yee/YeeSolver.hpp b/src/picongpu/include/fields/MaxwellSolver/Yee/YeeSolver.hpp index 9acdc989ea..ac1a4fb10c 100644 --- a/src/picongpu/include/fields/MaxwellSolver/Yee/YeeSolver.hpp +++ b/src/picongpu/include/fields/MaxwellSolver/Yee/YeeSolver.hpp @@ -102,7 +102,7 @@ class YeeSolver this->fieldB = &dc.getData (FIELD_B, true); } - void update_beforeCurrent(uint32_t currentStep) + void update_beforeCurrent(uint32_t) { updateBHalf < CORE+BORDER >(); EventTask eRfieldB = fieldB->asyncCommunication(__getTransactionEvent()); diff --git a/src/picongpu/include/fields/laserProfiles/laserNone.hpp b/src/picongpu/include/fields/laserProfiles/laserNone.hpp index 375333545f..e2b9fc4068 100644 --- a/src/picongpu/include/fields/laserProfiles/laserNone.hpp +++ b/src/picongpu/include/fields/laserProfiles/laserNone.hpp @@ -37,7 +37,7 @@ namespace picongpu /** Compute the * */ - HINLINE float3_X laserLongitudinal( uint32_t currentStep, float_X& phase ) + HINLINE float3_X laserLongitudinal( uint32_t, float_X& phase ) { float3_X elong = float3_X(float_X(0.0), float_X(0.0), float_X(0.0)); @@ -54,7 +54,7 @@ namespace picongpu * @param posZ * @return */ - HDINLINE float3_X laserTransversal( float3_X elong, const float_X phase, const float_X posX, const float_X posZ ) + HDINLINE float3_X laserTransversal( float3_X elong, const float_X, const float_X, const float_X ) { return elong; } diff --git a/src/picongpu/include/fields/laserProfiles/laserPlaneWave.hpp b/src/picongpu/include/fields/laserProfiles/laserPlaneWave.hpp index 39ff6ff2da..d664acee71 100644 --- a/src/picongpu/include/fields/laserProfiles/laserPlaneWave.hpp +++ b/src/picongpu/include/fields/laserProfiles/laserPlaneWave.hpp @@ -101,7 +101,7 @@ namespace picongpu * @param posZ * @return */ - HDINLINE float3_X laserTransversal( float3_X elong, const float_X phase, const float_X posX, const float_X posZ ) + HDINLINE float3_X laserTransversal( float3_X elong, const float_X, const float_X, const float_X ) { return elong; } diff --git a/src/picongpu/include/fields/laserProfiles/laserPolynom.hpp b/src/picongpu/include/fields/laserProfiles/laserPolynom.hpp index a4ca393390..9961e41076 100644 --- a/src/picongpu/include/fields/laserProfiles/laserPolynom.hpp +++ b/src/picongpu/include/fields/laserProfiles/laserPolynom.hpp @@ -75,7 +75,7 @@ HINLINE float3_X laserLongitudinal(uint32_t currentStep, float_X& phase) * @param posZ location in y (transversal) * @return E-field value */ -HDINLINE float3_X laserTransversal(float3_X elong, const float_X phase, const float_X posX, const float_X posZ) +HDINLINE float3_X laserTransversal(float3_X elong, const float_X, const float_X posX, const float_X posZ) { const float_64 exponent = (posX / W0x)*(posX / W0x) + (posZ / W0z)*(posZ / W0z); diff --git a/src/picongpu/include/fields/laserProfiles/laserWavepacket.hpp b/src/picongpu/include/fields/laserProfiles/laserWavepacket.hpp index 77342bd586..ad6f0fe2e0 100644 --- a/src/picongpu/include/fields/laserProfiles/laserWavepacket.hpp +++ b/src/picongpu/include/fields/laserProfiles/laserWavepacket.hpp @@ -101,7 +101,7 @@ HINLINE float3_X laserLongitudinal(uint32_t currentStep, float_X& phase) * @param posZ * @return */ -HDINLINE float3_X laserTransversal(float3_X elong, const float_X phase, const float_X posX, const float_X posZ) +HDINLINE float3_X laserTransversal(float3_X elong, const float_X, const float_X posX, const float_X posZ) { typedef typename GetType::type ElongType; diff --git a/src/picongpu/include/fields/tasks/FieldFactory.hpp b/src/picongpu/include/fields/tasks/FieldFactory.hpp index 921192fc9b..5adf67ff54 100644 --- a/src/picongpu/include/fields/tasks/FieldFactory.hpp +++ b/src/picongpu/include/fields/tasks/FieldFactory.hpp @@ -82,7 +82,7 @@ namespace PMacc FieldFactory() { }; - FieldFactory(const FieldFactory& cc) { }; + FieldFactory(const FieldFactory&) { }; }; diff --git a/src/picongpu/include/fields/tasks/TaskFieldReceiveAndInsert.hpp b/src/picongpu/include/fields/tasks/TaskFieldReceiveAndInsert.hpp index e70895e042..16dc6ab30b 100644 --- a/src/picongpu/include/fields/tasks/TaskFieldReceiveAndInsert.hpp +++ b/src/picongpu/include/fields/tasks/TaskFieldReceiveAndInsert.hpp @@ -120,7 +120,7 @@ class TaskFieldReceiveAndInsert : public MPITask notify(this->myId, RECVFINISHED, NULL); } - void event(id_t eventId, EventType type, IEventData* data) + void event(id_t, EventType, IEventData*) { } diff --git a/src/picongpu/include/fields/tasks/TaskFieldReceiveAndInsertExchange.hpp b/src/picongpu/include/fields/tasks/TaskFieldReceiveAndInsertExchange.hpp index 2d329f77b3..9bd10b0f10 100644 --- a/src/picongpu/include/fields/tasks/TaskFieldReceiveAndInsertExchange.hpp +++ b/src/picongpu/include/fields/tasks/TaskFieldReceiveAndInsertExchange.hpp @@ -90,7 +90,7 @@ class TaskFieldReceiveAndInsertExchange : public MPITask notify(this->myId, RECVFINISHED, NULL); } - void event(id_t eventId, EventType type, IEventData* data) + void event(id_t, EventType, IEventData*) { } diff --git a/src/picongpu/include/fields/tasks/TaskFieldSend.hpp b/src/picongpu/include/fields/tasks/TaskFieldSend.hpp index ff7a60e192..4da03ebec6 100644 --- a/src/picongpu/include/fields/tasks/TaskFieldSend.hpp +++ b/src/picongpu/include/fields/tasks/TaskFieldSend.hpp @@ -88,7 +88,7 @@ namespace PMacc notify(this->myId, SENDFINISHED, NULL); } - void event(id_t eventId, EventType type, IEventData* data) { } + void event(id_t, EventType, IEventData*) { } std::string toString() { diff --git a/src/picongpu/include/fields/tasks/TaskFieldSendExchange.hpp b/src/picongpu/include/fields/tasks/TaskFieldSendExchange.hpp index 47aead521e..f7dd470fbc 100644 --- a/src/picongpu/include/fields/tasks/TaskFieldSendExchange.hpp +++ b/src/picongpu/include/fields/tasks/TaskFieldSendExchange.hpp @@ -104,7 +104,7 @@ namespace PMacc notify(this->myId, SENDFINISHED, NULL); } - void event(id_t eventId, EventType type, IEventData* data) + void event(id_t, EventType, IEventData*) { } diff --git a/src/picongpu/include/initialization/SimRestartInitialiser.hpp b/src/picongpu/include/initialization/SimRestartInitialiser.hpp index 5da9b3a1a1..8729fdf6b0 100644 --- a/src/picongpu/include/initialization/SimRestartInitialiser.hpp +++ b/src/picongpu/include/initialization/SimRestartInitialiser.hpp @@ -83,7 +83,7 @@ class RestartParticleLoader uint32_t simulationStep, DomainCollector& dataCollector, Dimensions &dataSize, - CollectionType& colType, + CollectionType&, std::string name, DataSpace globalDomainOffset, DataSpace localDomainSize) @@ -442,7 +442,7 @@ class SimRestartInitialiser : public AbstractInitialiser AbstractInitialiser::teardown(); } - void init(uint32_t id, ISimulationData& data, uint32_t currentStep) + void init(uint32_t id, ISimulationData& data, uint32_t) { // add ids for other types if necessary // fields are initialised by their constructor diff --git a/src/picongpu/include/particles/Particles.tpp b/src/picongpu/include/particles/Particles.tpp index 4ce506a237..7334550efe 100644 --- a/src/picongpu/include/particles/Particles.tpp +++ b/src/picongpu/include/particles/Particles.tpp @@ -125,7 +125,7 @@ void Particles::init( FieldE &fieldE, FieldB &fieldB, FieldJ &fiel } template< class UserTypeList> -void Particles::update( uint32_t currentStep ) +void Particles::update( uint32_t ) { typedef particlePusher::ParticlePusher ParticlePush; @@ -158,7 +158,7 @@ void Particles::update( uint32_t currentStep ) } template< class UserTypeList> -void Particles::reset( uint32_t currentStep ) +void Particles::reset( uint32_t ) { this->particlesBuffer->reset( ); } diff --git a/src/picongpu/include/particles/shapes/NGP.hpp b/src/picongpu/include/particles/shapes/NGP.hpp index 434e0e8f24..92d3552c87 100644 --- a/src/picongpu/include/particles/shapes/NGP.hpp +++ b/src/picongpu/include/particles/shapes/NGP.hpp @@ -71,7 +71,7 @@ namespace particleShape /** form factor of this particle shape. * \param x has to be within [-support/2, support/2) */ - HDINLINE float_X operator()(const float_X x) + HDINLINE float_X operator()(const float_X) { /* * W(x)=1 diff --git a/src/picongpu/include/plugins/IntensityModule.hpp b/src/picongpu/include/plugins/IntensityModule.hpp index 3f83ec926f..5f065a8602 100644 --- a/src/picongpu/include/plugins/IntensityModule.hpp +++ b/src/picongpu/include/plugins/IntensityModule.hpp @@ -322,7 +322,7 @@ class IntensityModule : public ISimulationIO, public IPluginModule * * @param currenstep simulation step */ - void calcIntensity(uint32_t currentStep) + void calcIntensity(uint32_t) { DataConnector &dc = DataConnector::getInstance(); diff --git a/src/picongpu/include/plugins/ParticleSpectrum.tpp b/src/picongpu/include/plugins/ParticleSpectrum.tpp index 5dfae47d6e..5083d9c50f 100644 --- a/src/picongpu/include/plugins/ParticleSpectrum.tpp +++ b/src/picongpu/include/plugins/ParticleSpectrum.tpp @@ -160,7 +160,7 @@ struct GetBin }; template -void ParticleSpectrum::notify(uint32_t currentStep) +void ParticleSpectrum::notify(uint32_t) {/* DataConnector &dc = DataConnector::getInstance(); this->particles = &(dc.getData ((uint32_t) ParticlesType::FrameType::CommunicationTag, true)); diff --git a/src/picongpu/include/plugins/PluginController.hpp b/src/picongpu/include/plugins/PluginController.hpp index b73676c62b..982acd1faa 100644 --- a/src/picongpu/include/plugins/PluginController.hpp +++ b/src/picongpu/include/plugins/PluginController.hpp @@ -211,7 +211,7 @@ namespace picongpu } } - virtual void moduleRegisterHelp(po::options_description& desc) + virtual void moduleRegisterHelp(po::options_description&) { } diff --git a/src/picongpu/include/simulationControl/MySimulation.hpp b/src/picongpu/include/simulationControl/MySimulation.hpp index 6b4cb23a0c..6ccbd76859 100644 --- a/src/picongpu/include/simulationControl/MySimulation.hpp +++ b/src/picongpu/include/simulationControl/MySimulation.hpp @@ -436,7 +436,7 @@ class MySimulation : public SimulationHelper private: template - void checkGridConfiguration(DataSpace globalGridSize, GridLayout layout) + void checkGridConfiguration(DataSpace globalGridSize, GridLayout) { // global size must a devisor of supercell size // note: this is redundant, while using the local condition below diff --git a/src/picongpu/include/simulationControl/SimulationStarter.hpp b/src/picongpu/include/simulationControl/SimulationStarter.hpp index 76f6fd277d..e0d567c618 100644 --- a/src/picongpu/include/simulationControl/SimulationStarter.hpp +++ b/src/picongpu/include/simulationControl/SimulationStarter.hpp @@ -87,7 +87,7 @@ namespace picongpu simulationClass->startSimulation(); } - virtual void moduleRegisterHelp(po::options_description& desc) + virtual void moduleRegisterHelp(po::options_description&) { } diff --git a/src/picongpu/include/simulation_defines/param/componentsConfig.param b/src/picongpu/include/simulation_defines/param/componentsConfig.param index aa77de84e6..19edfb4613 100644 --- a/src/picongpu/include/simulation_defines/param/componentsConfig.param +++ b/src/picongpu/include/simulation_defines/param/componentsConfig.param @@ -18,26 +18,6 @@ * If not, see . */ -/** - * Copyright 2013 Axel Huebl, Heiko Burau, Anton Helm, René Widera, Richard Pausch - * - * This file is part of PIConGPU. - * - * PIConGPU is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PIConGPU is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PIConGPU. - * If not, see . - */ - #pragma once diff --git a/src/picongpu/include/simulation_defines/param/currentConfig.param b/src/picongpu/include/simulation_defines/param/currentConfig.param index ef96e69fdf..c6589b568a 100644 --- a/src/picongpu/include/simulation_defines/param/currentConfig.param +++ b/src/picongpu/include/simulation_defines/param/currentConfig.param @@ -18,26 +18,6 @@ * If not, see . */ -/** - * Copyright 2013 Heiko Burau, René Widera - * - * This file is part of PIConGPU. - * - * PIConGPU is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PIConGPU is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PIConGPU. - * If not, see . - */ - #pragma once diff --git a/src/picongpu/include/simulation_defines/param/fieldConfig.param b/src/picongpu/include/simulation_defines/param/fieldConfig.param index 24ad71d025..cfd715138b 100644 --- a/src/picongpu/include/simulation_defines/param/fieldConfig.param +++ b/src/picongpu/include/simulation_defines/param/fieldConfig.param @@ -18,26 +18,6 @@ * If not, see . */ -/** - * Copyright 2013 Axel Huebl, Heiko Burau, René Widera - * - * This file is part of PIConGPU. - * - * PIConGPU is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PIConGPU is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PIConGPU. - * If not, see . - */ - #pragma once diff --git a/src/picongpu/include/simulation_defines/param/gasConfig.param b/src/picongpu/include/simulation_defines/param/gasConfig.param index 3deb8c0c92..dc1f61f303 100644 --- a/src/picongpu/include/simulation_defines/param/gasConfig.param +++ b/src/picongpu/include/simulation_defines/param/gasConfig.param @@ -18,26 +18,6 @@ * If not, see . */ -/** - * Copyright 2013 Axel Huebl, Heiko Burau, René Widera - * - * This file is part of PIConGPU. - * - * PIConGPU is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PIConGPU is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PIConGPU. - * If not, see . - */ - #pragma once diff --git a/src/picongpu/include/simulation_defines/param/gridConfig.param b/src/picongpu/include/simulation_defines/param/gridConfig.param index be6fa23044..3da7e107c4 100644 --- a/src/picongpu/include/simulation_defines/param/gridConfig.param +++ b/src/picongpu/include/simulation_defines/param/gridConfig.param @@ -18,26 +18,6 @@ * If not, see . */ -/** - * Copyright 2013 Axel Huebl, René Widera - * - * This file is part of PIConGPU. - * - * PIConGPU is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PIConGPU is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PIConGPU. - * If not, see . - */ - #pragma once diff --git a/src/picongpu/include/simulation_defines/param/laserConfig.param b/src/picongpu/include/simulation_defines/param/laserConfig.param index 548449b547..964d318d1d 100644 --- a/src/picongpu/include/simulation_defines/param/laserConfig.param +++ b/src/picongpu/include/simulation_defines/param/laserConfig.param @@ -18,26 +18,6 @@ * If not, see . */ -/** - * Copyright 2013 Axel Huebl, Anton Helm, René Widera, Richard Pausch - * - * This file is part of PIConGPU. - * - * PIConGPU is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PIConGPU is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PIConGPU. - * If not, see . - */ - #pragma once diff --git a/src/picongpu/include/simulation_defines/param/memory.param b/src/picongpu/include/simulation_defines/param/memory.param index 3df9b04dc1..4e17f16526 100644 --- a/src/picongpu/include/simulation_defines/param/memory.param +++ b/src/picongpu/include/simulation_defines/param/memory.param @@ -18,26 +18,6 @@ * If not, see . */ -/** - * Copyright 2013 Axel Huebl, René Widera - * - * This file is part of PIConGPU. - * - * PIConGPU is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PIConGPU is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PIConGPU. - * If not, see . - */ - #pragma once diff --git a/src/picongpu/include/simulation_defines/param/particleConfig.param b/src/picongpu/include/simulation_defines/param/particleConfig.param index 0c63e758f3..8e96d5cfc9 100644 --- a/src/picongpu/include/simulation_defines/param/particleConfig.param +++ b/src/picongpu/include/simulation_defines/param/particleConfig.param @@ -18,26 +18,6 @@ * If not, see . */ -/** - * Copyright 2013 Axel Huebl, René Widera - * - * This file is part of PIConGPU. - * - * PIConGPU is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PIConGPU is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PIConGPU. - * If not, see . - */ - #pragma once diff --git a/src/picongpu/include/simulation_defines/param/physicalConstants.param b/src/picongpu/include/simulation_defines/param/physicalConstants.param index 9d9dcd5d16..8473fe9f76 100644 --- a/src/picongpu/include/simulation_defines/param/physicalConstants.param +++ b/src/picongpu/include/simulation_defines/param/physicalConstants.param @@ -18,26 +18,6 @@ * If not, see . */ -/** - * Copyright 2013 Axel Huebl, Heiko Burau, René Widera - * - * This file is part of PIConGPU. - * - * PIConGPU is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PIConGPU is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PIConGPU. - * If not, see . - */ - #pragma once diff --git a/src/picongpu/include/simulation_defines/param/precision.param b/src/picongpu/include/simulation_defines/param/precision.param index bf45eb33a3..9f4e1f8cf5 100644 --- a/src/picongpu/include/simulation_defines/param/precision.param +++ b/src/picongpu/include/simulation_defines/param/precision.param @@ -18,26 +18,6 @@ * If not, see . */ -/** - * Copyright 2013 René Widera - * - * This file is part of PIConGPU. - * - * PIConGPU is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PIConGPU is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PIConGPU. - * If not, see . - */ - #pragma once diff --git a/src/picongpu/include/simulation_defines/param/pusherConfig.param b/src/picongpu/include/simulation_defines/param/pusherConfig.param index fea9d2c3a0..4395d256d5 100644 --- a/src/picongpu/include/simulation_defines/param/pusherConfig.param +++ b/src/picongpu/include/simulation_defines/param/pusherConfig.param @@ -18,26 +18,6 @@ * If not, see . */ -/** - * Copyright 2013 Axel Huebl, René Widera - * - * This file is part of PIConGPU. - * - * PIConGPU is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PIConGPU is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PIConGPU. - * If not, see . - */ - #pragma once diff --git a/src/picongpu/include/simulation_defines/param/radiationConfig.param b/src/picongpu/include/simulation_defines/param/radiationConfig.param index 0d81b1b0d3..1d7183a142 100644 --- a/src/picongpu/include/simulation_defines/param/radiationConfig.param +++ b/src/picongpu/include/simulation_defines/param/radiationConfig.param @@ -18,26 +18,6 @@ * If not, see . */ -/** - * Copyright 2013 René Widera, Richard Pausch - * - * This file is part of PIConGPU. - * - * PIConGPU is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PIConGPU is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PIConGPU. - * If not, see . - */ - #pragma once diff --git a/src/picongpu/include/simulation_defines/param/starter.param b/src/picongpu/include/simulation_defines/param/starter.param index 01794b7d16..66131905af 100644 --- a/src/picongpu/include/simulation_defines/param/starter.param +++ b/src/picongpu/include/simulation_defines/param/starter.param @@ -18,26 +18,6 @@ * If not, see . */ -/** - * Copyright 2013 René Widera - * - * This file is part of PIConGPU. - * - * PIConGPU is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PIConGPU is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PIConGPU. - * If not, see . - */ - #pragma once diff --git a/src/picongpu/include/simulation_defines/param/visColorScales.param b/src/picongpu/include/simulation_defines/param/visColorScales.param index c570caa2e3..9b8fc396f5 100644 --- a/src/picongpu/include/simulation_defines/param/visColorScales.param +++ b/src/picongpu/include/simulation_defines/param/visColorScales.param @@ -18,26 +18,6 @@ * If not, see . */ -/** - * Copyright 2013 Axel Huebl, Heiko Burau, René Widera - * - * This file is part of PIConGPU. - * - * PIConGPU is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PIConGPU is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PIConGPU. - * If not, see . - */ - #ifndef COLORSCALES_HPP @@ -52,9 +32,9 @@ namespace picongpu { namespace none { - HDINLINE void addRGB( const float3_X& img, - const float_X value, - const float_X opacity ) + HDINLINE void addRGB( const float3_X&, + const float_X, + const float_X ) { return; } diff --git a/src/picongpu/include/simulation_defines/param/visualization.param b/src/picongpu/include/simulation_defines/param/visualization.param index 0ec0947d7a..7606eee107 100644 --- a/src/picongpu/include/simulation_defines/param/visualization.param +++ b/src/picongpu/include/simulation_defines/param/visualization.param @@ -18,26 +18,6 @@ * If not, see . */ -/** - * Copyright 2013 Axel Huebl, Heiko Burau, René Widera, Richard Pausch - * - * This file is part of PIConGPU. - * - * PIConGPU is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PIConGPU is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PIConGPU. - * If not, see . - */ - #pragma once From 8b565e16f1b5800e775c49c17a5ac4784cd2e97a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20H=C3=BCbl?= Date: Wed, 28 Aug 2013 16:19:00 +0200 Subject: [PATCH 12/54] SM 2.0+ for Weibel Example - needs at least sm_20 to pass compile test (icc 12.1, cuda 5.5) --- examples/WeibelTransverse/cmakeFlags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/WeibelTransverse/cmakeFlags b/examples/WeibelTransverse/cmakeFlags index 199d3d5c1a..4f0228ffbb 100755 --- a/examples/WeibelTransverse/cmakeFlags +++ b/examples/WeibelTransverse/cmakeFlags @@ -29,7 +29,7 @@ # - start with zero index # - increase by 1, no gaps -flags[0]="-DCUDA_ARCH=sm_13" +flags[0]="-DCUDA_ARCH=sm_20" ################################################################################ From 3cfe4199c1e8fbe8e3c9a1f29ef94e829927ad41 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Wed, 28 Aug 2013 15:14:25 +0200 Subject: [PATCH 13/54] Add new SLURM template for Taurus --- src/picongpu/submit/taurus/k20x_profile.tpl | 83 +++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 src/picongpu/submit/taurus/k20x_profile.tpl diff --git a/src/picongpu/submit/taurus/k20x_profile.tpl b/src/picongpu/submit/taurus/k20x_profile.tpl new file mode 100644 index 0000000000..5155751c38 --- /dev/null +++ b/src/picongpu/submit/taurus/k20x_profile.tpl @@ -0,0 +1,83 @@ +#!/bin/bash +# Copyright 2013 Axel Huebl +# +# This file is part of PIConGPU. +# +# PIConGPU is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# PIConGPU is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with PIConGPU. +# If not, see . +# + +## calculations will be performed by tbg ## + +TBG_queue="gpu" +TBG_mailSettings="ALL" +TBG_mailAdress="someone@example.com" + +# 2 gpus per node +TBG_gpusPerNode=`if [ $TBG_tasks -gt 2 ] ; then echo 2; else echo $TBG_tasks; fi` + +# number of cores to block per GPU - we got 8 cpus per gpu +# and we will be accounted 8 CPUs per GPU anyway +TBG_coresPerGPU=8 + +# We only start 1 task per GPU +TBG_tasksPerNode="$(( TBG_gpusPerNode * 1 ))" + +# use ceil to caculate nodes +TBG_nodes="$(( ( TBG_tasks + TBG_gpusPerNode -1 ) / TBG_gpusPerNode))" + +## end calculations ## + +# PIConGPU batch script for taurus' SLURM batch system + +#SBATCH --partition=!TBG_queue +#SBATCH --time=!TBG_wallTime +# Sets batch job's name +#SBATCH --job-name=!TBG_jobName +#SBATCH --nodes=!TBG_nodes +#SBATCH --ntasks-per-node=!TBG_tasksPerNode +#SBATCH --cpus-per-task=!TBG_coresPerGPU +#SBATCH --gres=gpu:!TBG_gpusPerNode +# send me a mail on (b)egin, (e)nd, (a)bortion +#SBATCH --mail-type=!TBG_mailSettings +#SBATCH --mail-user=!TBG_mailAdress +#SBATCH --workdir=!TBG_dstPath + +#SBATCH -o stdout +#SBATCH -e stderr + +echo 'Running program...' + +cd !TBG_dstPath + +export MODULES_NO_OUTPUT=1 +source ~/picongpu.profile +unset MODULES_NO_OUTPUT + +#set user rights to u=rwx;g=r-x;o=--- +umask 0027 + +mkdir simOutput 2> /dev/null +cd simOutput + +# Run CUDA memtest to check GPU's health +srun !TBG_dstPath/picongpu/bin/cuda_memtest.sh + +# Run PIConGPU +if [ $? -eq 0 ] ; then + srun !TBG_dstPath/picongpu/bin/picongpu !TBG_programParams +fi + +# Kill +srun killall -9 picongpu From 07284b305b4e90990d1ced01bb63d7a81ebe06c9 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Wed, 28 Aug 2013 15:21:56 +0200 Subject: [PATCH 14/54] Be more precise about tasks - a task per node means a MPI task --- src/picongpu/submit/taurus/k20x_profile.tpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/picongpu/submit/taurus/k20x_profile.tpl b/src/picongpu/submit/taurus/k20x_profile.tpl index 5155751c38..e40f763753 100644 --- a/src/picongpu/submit/taurus/k20x_profile.tpl +++ b/src/picongpu/submit/taurus/k20x_profile.tpl @@ -31,8 +31,8 @@ TBG_gpusPerNode=`if [ $TBG_tasks -gt 2 ] ; then echo 2; else echo $TBG_tasks; fi # and we will be accounted 8 CPUs per GPU anyway TBG_coresPerGPU=8 -# We only start 1 task per GPU -TBG_tasksPerNode="$(( TBG_gpusPerNode * 1 ))" +# We only start 1 MPI task per GPU +TBG_mpiTasksPerNode="$(( TBG_gpusPerNode * 1 ))" # use ceil to caculate nodes TBG_nodes="$(( ( TBG_tasks + TBG_gpusPerNode -1 ) / TBG_gpusPerNode))" @@ -46,7 +46,7 @@ TBG_nodes="$(( ( TBG_tasks + TBG_gpusPerNode -1 ) / TBG_gpusPerNode))" # Sets batch job's name #SBATCH --job-name=!TBG_jobName #SBATCH --nodes=!TBG_nodes -#SBATCH --ntasks-per-node=!TBG_tasksPerNode +#SBATCH --ntasks-per-node=!TBG_mpiTasksPerNode #SBATCH --cpus-per-task=!TBG_coresPerGPU #SBATCH --gres=gpu:!TBG_gpusPerNode # send me a mail on (b)egin, (e)nd, (a)bortion From 0d55c09a45055599b6339441d7dc0ce0640efa47 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Thu, 29 Aug 2013 17:31:54 +0200 Subject: [PATCH 15/54] Add Taurus READMEs - SLURM Tutorial - picongpu.profile example - Module System: patch for Boost work around --- src/picongpu/submit/taurus/SLURM_Tutorial.md | 16 +++++++++ .../submit/taurus/Taurus_WorkAround_Boost.md | 18 ++++++++++ .../submit/taurus/picongpu.profile.example | 34 +++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 src/picongpu/submit/taurus/SLURM_Tutorial.md create mode 100644 src/picongpu/submit/taurus/Taurus_WorkAround_Boost.md create mode 100755 src/picongpu/submit/taurus/picongpu.profile.example diff --git a/src/picongpu/submit/taurus/SLURM_Tutorial.md b/src/picongpu/submit/taurus/SLURM_Tutorial.md new file mode 100644 index 0000000000..54d20e9ad2 --- /dev/null +++ b/src/picongpu/submit/taurus/SLURM_Tutorial.md @@ -0,0 +1,16 @@ +SLURM examples: +- `tbg -s sbatch -c submit/0008gpus.cfg -t submit/taurus/k20x_profile.tpl $SCRATCH/runs/test123` +- details for my jobs: + - `scontrol -d show job 12345` + - ``` squeue -u `whoami` -l``` +- details for queues: + - `squeue -p queueName -l` (list full queue) + - `squeue -p queueName --start` (show start times for pending jobs) + - `squeue -p queueName -l -t R` (only show running jobs in queue) + - `sview` (alternative on taurus: `module load llview` and `llview`) + - `scontrol show partition queueName` + +- Communicate with job: + - `scancel 12345` abort job + - `scancel -s Number 12345` send signal or signal name to job + - `scontrol update timelimit=4:00:00 jobid=12345` diff --git a/src/picongpu/submit/taurus/Taurus_WorkAround_Boost.md b/src/picongpu/submit/taurus/Taurus_WorkAround_Boost.md new file mode 100644 index 0000000000..430daf6d64 --- /dev/null +++ b/src/picongpu/submit/taurus/Taurus_WorkAround_Boost.md @@ -0,0 +1,18 @@ +Right now, you have to apply the following patch to run on `taurus` due to a boost install bug: + +```diff + +diff --git a/src/picongpu/CMakeLists.txt b/src/picongpu/CMakeLists.txt +index 2770501..dfe7c65 100644 +--- a/src/picongpu/CMakeLists.txt ++++ b/src/picongpu/CMakeLists.txt +@@ -57,6 +57,7 @@ FIND_PACKAGE(Threads REQUIRED) + SET(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT}) + + #Boost from system ++SET(Boost_USE_MULTITHREADED OFF) + FIND_PACKAGE(Boost REQUIRED COMPONENTS program_options regex) + INCLUDE_DIRECTORIES(AFTER ${Boost_INCLUDE_DIRS}) + LINK_DIRECTORIES(${Boost_LIBRARY_DIR}) + +``` diff --git a/src/picongpu/submit/taurus/picongpu.profile.example b/src/picongpu/submit/taurus/picongpu.profile.example new file mode 100755 index 0000000000..857c874cf3 --- /dev/null +++ b/src/picongpu/submit/taurus/picongpu.profile.example @@ -0,0 +1,34 @@ +module purge + +# General modules ############################################################# +# +module load oscar-modules llview +module load cmake/2.8.2 +module load git cuda/5.5.11 bullxmpi + + +# Compilers ################################################################### +### GCC +module load gcc/4.7.1 boost +export BOOST_ROOT=$BOOST_INC/.. +### ICC +#module load intel/12.1 +#export CC=`which icc` +#export CXX=`which icpc` +#export BOOST_ROOT=$HOME/lib/boost_1_54_intel_12_1 +#export BOOST_INC=$BOOST_ROOT/include +#export BOOST_LIB=$BOOST_ROOT/lib +#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$BOOST_LIB + +# Environment ################################################################# +# +export PNGWRITER_ROOT=$HOME/lib/pngwriter +export HDF5_ROOT=$HOME/lib/hdf5 +export SPLASH_ROOT=$HOME/lib/splash + +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/lib/hdf5/lib +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/lib/pngwriter/lib/ +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/lib/splash/lib/ + +export PICSRC=$HOME/src/picongpu +export PATH=$PATH:$PICSRC/src/tools/bin From 51446c449618ae459b06df135dd6959e8bcab3b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20H=C3=BCbl?= Date: Thu, 5 Sep 2013 12:17:41 +0200 Subject: [PATCH 16/54] Update INSTALL.md add Debian/Ubuntu deb's for libSplash --- doc/INSTALL.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/INSTALL.md b/doc/INSTALL.md index 0ab3ccc9a5..b303b491e3 100644 --- a/doc/INSTALL.md +++ b/doc/INSTALL.md @@ -56,7 +56,8 @@ We recomment to install at least **pngwriter**. [PNGWRITER\_ROOT](#additional-required-environment-variables-for-optional-libraries) to `$HOME/lib/pngwriter` -- **libSplash** (requires *hdf5*) +- **libSplash** (requires *hdf5*, *boost program-options*) + - *Debian/Ubuntu dependencies:* `sudo apt-get install libhdf5-openmpi-dev libboost-program-options-dev` - example: - `mkdir -p ~/src ~/build ~/lib` - `git clone https://github.com/ComputationalRadiationPhysics/libSplash.git ~/src/splash/` From bfe6555940ba6d371f844c780f928f0c4c34bd9b Mon Sep 17 00:00:00 2001 From: Heikman Date: Thu, 5 Sep 2013 15:01:24 +0200 Subject: [PATCH 17/54] fix lambda lib - make_Functor.hpp: store references instead of values in argTuple - Tuple.hpp: add a contructor which accepts non-const references --- src/libPMacc/include/lambda/make_Functor.hpp | 19 ++++++++++-------- src/libPMacc/include/math/Tuple.hpp | 21 ++++++++++++++++++-- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/libPMacc/include/lambda/make_Functor.hpp b/src/libPMacc/include/lambda/make_Functor.hpp index 9efec11cf0..2fe9f77574 100644 --- a/src/libPMacc/include/lambda/make_Functor.hpp +++ b/src/libPMacc/include/lambda/make_Functor.hpp @@ -70,7 +70,7 @@ namespace result_of typedef math::Tuple > ArgTuple; \ typedef typename lambda::CT::result_of::Eval::type type; \ }; - + BOOST_PP_REPEAT_FROM_TO(1, LAMBDA_MAX_PARAMS, FUNCTOR, _) #undef FUNCTOR @@ -88,32 +88,35 @@ struct ExprFunctor typedef typename math::Tuple< typename CT::TerminalTL::type> TerminalTuple; typedef CT::Expression CTExpr; - + TerminalTuple terminalTuple; - + HDINLINE ExprFunctor() {}; - + HDINLINE ExprFunctor(const Expr& expr) { CT::FillTerminalList()(expr, this->terminalTuple); } - + + #define REF_TYPE_LIST(Z, N, _) Arg ## N & + #define OPERATOR_CALL(Z,N,_) \ template \ HDINLINE \ typename ::PMacc::result_of::Functor, BOOST_PP_ENUM_PARAMS(N, Arg)>::type \ operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, Arg, &arg)) const \ { \ - typedef math::Tuple > ArgTuple; \ + typedef math::Tuple > ArgTuple; \ ArgTuple args(BOOST_PP_ENUM_PARAMS(N, arg)); \ return CT::Eval()(this->terminalTuple, args); \ } - + BOOST_PP_REPEAT_FROM_TO(1, LAMBDA_MAX_PARAMS, OPERATOR_CALL, _) - + #undef OPERATOR_CALL + #undef REF_TYPE_LIST }; namespace result_of diff --git a/src/libPMacc/include/math/Tuple.hpp b/src/libPMacc/include/math/Tuple.hpp index b48ccb15ea..3e5625db55 100644 --- a/src/libPMacc/include/math/Tuple.hpp +++ b/src/libPMacc/include/math/Tuple.hpp @@ -54,6 +54,16 @@ namespace math { \ BOOST_STATIC_ASSERT(dim == N); \ } + +#define CONSTRUCTOR_LVALUE(Z, N, _) \ + template \ + HDINLINE \ + Tuple(BOOST_PP_ENUM_BINARY_PARAMS(N, Arg, &arg)) \ + : value(arg0), \ + base(BOOST_PP_ENUM_SHIFTED_PARAMS(N, arg)) \ + { \ + BOOST_STATIC_ASSERT(dim == N); \ + } namespace mpl = boost::mpl; @@ -75,18 +85,24 @@ class Tuple typedef Tuple::type> base; typedef typename mpl::front::type Value; + typedef typename boost::remove_reference::type pureValue; Value value; public: HDINLINE Tuple() {} - template - HDINLINE Tuple(const Arg0& arg0) : value(arg0) + HDINLINE Tuple(const pureValue& arg0) : value(arg0) + { + BOOST_STATIC_ASSERT(dim == 1); + } + + HDINLINE Tuple(pureValue& arg0) : value(arg0) { BOOST_STATIC_ASSERT(dim == 1); } BOOST_PP_REPEAT_FROM_TO(2, BOOST_PP_INC(TUPLE_MAX_DIM), CONSTRUCTOR, _) + BOOST_PP_REPEAT_FROM_TO(2, BOOST_PP_INC(TUPLE_MAX_DIM), CONSTRUCTOR_LVALUE, _) template HDINLINE @@ -139,6 +155,7 @@ class Tuple }; #undef CONSTRUCTOR +#undef CONSTRUCTOR_LVALUE #define MAKE_TUPLE(Z, N, _) \ template \ From 54a0bfbfbbc4c32eeac3cdbfc3a92757a07758a6 Mon Sep 17 00:00:00 2001 From: Heikman Date: Thu, 5 Sep 2013 15:46:36 +0200 Subject: [PATCH 18/54] make PIConGPU incompatible to sm_13 - change every occurence of sm_13 to sm_20 --- examples/LaserWakefield/cmakeFlags | 4 ++-- examples/SingleParticleTest/cmakeFlags | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/LaserWakefield/cmakeFlags b/examples/LaserWakefield/cmakeFlags index 918a69b3ac..a3c34bd64f 100755 --- a/examples/LaserWakefield/cmakeFlags +++ b/examples/LaserWakefield/cmakeFlags @@ -32,8 +32,8 @@ flags[0]="-DCUDA_ARCH=sm_20" flags[1]="-DCUDA_ARCH=sm_20 -DPARAM_OVERWRITES:LIST=-DPARAM_FIELDSOLVER=fieldSolverLehe;-DPARAM_PARTICLEPUSHER=particlePusherVay" flags[2]="-DCUDA_ARCH=sm_20 -DPARAM_OVERWRITES:LIST=-DPARAM_FIELDSOLVER=fieldSolverDirSplitting" -flags[3]="-DCUDA_ARCH=sm_13 -DPARAM_OVERWRITES:LIST=-DPARAM_CURRENTSOLVER=currentSolverEsirkepov;-DPARAM_PARTICLESHAPE=shapeCIC" -flags[4]="-DCUDA_ARCH=sm_13 -DPARAM_OVERWRITES:LIST=-DPARAM_CURRENTSOLVER=currentSolverVillaBune;-DPARAM_PARTICLESHAPE=shapeCIC" +flags[3]="-DCUDA_ARCH=sm_20 -DPARAM_OVERWRITES:LIST=-DPARAM_CURRENTSOLVER=currentSolverEsirkepov;-DPARAM_PARTICLESHAPE=shapeCIC" +flags[4]="-DCUDA_ARCH=sm_20 -DPARAM_OVERWRITES:LIST=-DPARAM_CURRENTSOLVER=currentSolverVillaBune;-DPARAM_PARTICLESHAPE=shapeCIC" flags[5]="-DCUDA_ARCH=sm_20 -DPARAM_OVERWRITES:LIST=-DPARAM_PRECISION=precision64Bit" flags[6]="-DCUDA_ARCH=sm_20 -DPARAM_OVERWRITES:LIST=-DPARAM_FIELDSOLVER=fieldSolverDirSplitting;-DPARAM_PRECISION=precision64Bit" flags[7]="-DCUDA_ARCH=sm_35 -DPARAM_OVERWRITES:LIST=-DPARAM_GASPROFILE=gasNone;-DENABLE_CURRENT=0" diff --git a/examples/SingleParticleTest/cmakeFlags b/examples/SingleParticleTest/cmakeFlags index 199d3d5c1a..4f0228ffbb 100755 --- a/examples/SingleParticleTest/cmakeFlags +++ b/examples/SingleParticleTest/cmakeFlags @@ -29,7 +29,7 @@ # - start with zero index # - increase by 1, no gaps -flags[0]="-DCUDA_ARCH=sm_13" +flags[0]="-DCUDA_ARCH=sm_20" ################################################################################ From d0549095a127d92893445b6bb3a21bf9db4c1c04 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Tue, 10 Sep 2013 17:15:18 +0200 Subject: [PATCH 19/54] algorithm::host::Foreach add 1/2D, SphericMapper - (implemented) algorithm::host::Foreach can work on 1D and 2D containers now - (cleanup) Since sm_20 we can use also z-blocks > 1 in the CUDA grid, this patch simplifies the syntax for SphericMappers --- .../include/cuSTL/algorithm/host/Foreach.hpp | 100 +++++++++++++++--- .../algorithm/kernel/detail/SphericMapper.hpp | 24 ++--- 2 files changed, 95 insertions(+), 29 deletions(-) diff --git a/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp b/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp index c7f6f32ab2..5fe211b36f 100644 --- a/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp +++ b/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp @@ -47,25 +47,91 @@ namespace host #define SHIFT_CURSOR_ZONE(Z, N, _) C ## N c ## N ## _shifted = c ## N ((math::Int) _zone.offset); #define SHIFTACCESS_SHIFTEDCURSOR(Z, N, _) c ## N ## _shifted [cellIndex] -#define FOREACH_OPERATOR(Z, N, _) \ +namespace detail +{ + /** Return cellIndex as math::Int */ + template + struct GetIndex; + + template<> + struct GetIndex<3u> + { + const math::Int<3u> operator()(const int x, const int y, const int z) const + { + return math::Int<3u>(x, y, z); + } + }; + template<> + struct GetIndex<2u> + { + const math::Int<2u> operator()(const int x, const int y, const int) const + { + return math::Int<2u>(x, y); + } + }; + template<> + struct GetIndex<1u> + { + const math::Int<1u> operator()(const int x, const int, const int) const + { + return math::Int<1u>(x); + } + }; + + /** Return max of the zone as math::Int */ + template< uint32_t dim > + struct GetMax; + + template<> + struct GetMax<3u> + { + template + const math::Int<3u> operator()(const Zone _zone) const + { + return math::Int<3u>(_zone.size.x(), _zone.size.y(), _zone.size.z()); + } + }; + template<> + struct GetMax<2u> + { + template + const math::Int<2u> operator()(const Zone _zone) const + { + return math::Int<2u>(_zone.size.x(), _zone.size.y(), 1); + } + }; + template<> + struct GetMax<1u> + { + template + const math::Int<1u> operator()(const Zone _zone) const + { + return math::Int<1u>(_zone.size.x(), 1, 1); + } + }; +} // namespace detail + +#define FOREACH_OPERATOR(Z, N, _) \ template \ void operator()(const Zone& _zone, BOOST_PP_ENUM_BINARY_PARAMS(N, C, c), const Functor& functor) \ - { \ - BOOST_PP_REPEAT(N, SHIFT_CURSOR_ZONE, _) \ - \ - typename lambda::result_of::make_Functor::type fun \ - = lambda::make_Functor(functor); \ - for(int z = 0; z < (int)_zone.size.z(); z++) \ - { \ - for(int y = 0; y < (int)_zone.size.y(); y++) \ - { \ - for(int x = 0; x < (int)_zone.size.x(); x++) \ - { \ - math::Int<3u> cellIndex = math::Int<3u>(x, y, z); \ - fun(BOOST_PP_ENUM(N, SHIFTACCESS_SHIFTEDCURSOR, _)); \ - } \ - } \ - } \ + { \ + BOOST_PP_REPEAT(N, SHIFT_CURSOR_ZONE, _) \ + \ + typename lambda::result_of::make_Functor::type fun \ + = lambda::make_Functor(functor); \ + detail::GetIndex getIndex; \ + detail::GetMax getMax; \ + for(int z = 0; z < getMax(_zone).z(); z++) \ + { \ + for(int y = 0; y < getMax(_zone).y(); y++) \ + { \ + for(int x = 0; x < getMax(_zone).x(); x++) \ + { \ + math::Int cellIndex = getIndex(x, y, z); \ + fun(BOOST_PP_ENUM(N, SHIFTACCESS_SHIFTEDCURSOR, _)); \ + } \ + } \ + } \ } struct Foreach diff --git a/src/libPMacc/include/cuSTL/algorithm/kernel/detail/SphericMapper.hpp b/src/libPMacc/include/cuSTL/algorithm/kernel/detail/SphericMapper.hpp index a5e6edd54c..2c132a8b69 100644 --- a/src/libPMacc/include/cuSTL/algorithm/kernel/detail/SphericMapper.hpp +++ b/src/libPMacc/include/cuSTL/algorithm/kernel/detail/SphericMapper.hpp @@ -82,8 +82,8 @@ class SphericMapper<2, BlockDim> math::Int<2> operator()(const math::Int<2>& _blockIdx, const math::Int<2>& _threadIdx) const { - math::Int<3> v(BlockDim().vec()); //\todo: schauen, ob hier ein Register verbraucht wird - return _blockIdx * v.shrink<2>() + _threadIdx; + return math::Int<2>( _blockIdx.x() * BlockDim::x::value + _threadIdx.x(), + _blockIdx.y() * BlockDim::y::value + _threadIdx.y() ); } HDINLINE @@ -104,27 +104,27 @@ class SphericMapper<3, BlockDim> SphericMapper(const math::Size_t<3>& size) : widthInBlocks(size.x() / BlockDim::x::value) {} - + dim3 cudaGridDim(const math::Size_t<3>& size) const { - return dim3((size.x() / BlockDim::x::value) * (size.z() / BlockDim::z::value), - size.y() / BlockDim::y::value, 1); + return dim3(size.x() / BlockDim::x::value, + size.y() / BlockDim::y::value, + size.z() / BlockDim::z::value); } HDINLINE - math::Int<3> operator()(const math::Int<2>& _blockIdx, - const math::Int<3>& _threadIdx) const + math::Int<3> operator()(const math::Int<3>& _blockIdx, + const math::Int<3>& _threadIdx) const { - return math::Int<3>( - (_blockIdx.x() % this->widthInBlocks), - _blockIdx.y(), - (_blockIdx.x() / this->widthInBlocks)) * (math::Int<3>)BlockDim().vec() + _threadIdx; + return math::Int<3>( _blockIdx.x() * BlockDim::x::value + _threadIdx.x(), + _blockIdx.y() * BlockDim::y::value + _threadIdx.y(), + _blockIdx.z() * BlockDim::z::value + _threadIdx.z() ); } HDINLINE math::Int<3> operator()(const dim3& _blockIdx, const dim3& _threadIdx = dim3(0,0,0)) const { - return operator()(math::Int<2>(_blockIdx.x, _blockIdx.y), + return operator()(math::Int<3>(_blockIdx.x, _blockIdx.y, _blockIdx.z), math::Int<3>(_threadIdx.x, _threadIdx.y, _threadIdx.z)); } }; From d40f8f16b0bbd6fcf1736673a6a9c31b0a88598c Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Tue, 10 Sep 2013 17:32:50 +0200 Subject: [PATCH 20/54] Use more Vectors and Fix GetMax return type --- .../include/cuSTL/algorithm/host/Foreach.hpp | 8 ++++---- .../algorithm/kernel/detail/SphericMapper.hpp | 18 ++++++++---------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp b/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp index 5fe211b36f..d4f7d71cfb 100644 --- a/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp +++ b/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp @@ -95,18 +95,18 @@ namespace detail struct GetMax<2u> { template - const math::Int<2u> operator()(const Zone _zone) const + const math::Int<3u> operator()(const Zone _zone) const { - return math::Int<2u>(_zone.size.x(), _zone.size.y(), 1); + return math::Int<3u>(_zone.size.x(), _zone.size.y(), 1); } }; template<> struct GetMax<1u> { template - const math::Int<1u> operator()(const Zone _zone) const + const math::Int<3u> operator()(const Zone _zone) const { - return math::Int<1u>(_zone.size.x(), 1, 1); + return math::Int<3u>(_zone.size.x(), 1, 1); } }; } // namespace detail diff --git a/src/libPMacc/include/cuSTL/algorithm/kernel/detail/SphericMapper.hpp b/src/libPMacc/include/cuSTL/algorithm/kernel/detail/SphericMapper.hpp index 2c132a8b69..3b6a4bd6f8 100644 --- a/src/libPMacc/include/cuSTL/algorithm/kernel/detail/SphericMapper.hpp +++ b/src/libPMacc/include/cuSTL/algorithm/kernel/detail/SphericMapper.hpp @@ -33,7 +33,7 @@ namespace kernel { namespace detail { - + template class SphericMapper; @@ -48,14 +48,14 @@ class SphericMapper<1, BlockDim> { return dim3(size.x() / BlockDim::x::value, 1, 1); } - + HDINLINE math::Int<1> operator()(const math::Int<1>& _blockIdx, const math::Int<1>& _threadIdx) const { return _blockIdx.x() * BlockDim::x::value + _threadIdx.x(); } - + HDINLINE math::Int<1> operator()(const dim3& _blockIdx, const dim3& _threadIdx = dim3(0,0,0)) const { @@ -69,9 +69,9 @@ class SphericMapper<2, BlockDim> { public: static const int dim = 2; - + SphericMapper(math::Size_t<2>) {} - + dim3 cudaGridDim(const math::Size_t<2>& size) const { return dim3(size.x() / BlockDim::x::value, @@ -85,7 +85,7 @@ class SphericMapper<2, BlockDim> return math::Int<2>( _blockIdx.x() * BlockDim::x::value + _threadIdx.x(), _blockIdx.y() * BlockDim::y::value + _threadIdx.y() ); } - + HDINLINE math::Int<2> operator()(const dim3& _blockIdx, const dim3& _threadIdx = dim3(0,0,0)) const { @@ -116,11 +116,9 @@ class SphericMapper<3, BlockDim> math::Int<3> operator()(const math::Int<3>& _blockIdx, const math::Int<3>& _threadIdx) const { - return math::Int<3>( _blockIdx.x() * BlockDim::x::value + _threadIdx.x(), - _blockIdx.y() * BlockDim::y::value + _threadIdx.y(), - _blockIdx.z() * BlockDim::z::value + _threadIdx.z() ); + return math::Int<3>( _blockIdx * (math::Int<3>)BlockDim().vec() + _threadIdx ); } - + HDINLINE math::Int<3> operator()(const dim3& _blockIdx, const dim3& _threadIdx = dim3(0,0,0)) const { From 7fbf05dd2260f9cf64c2f7da483d8ea45a1f404d Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Wed, 11 Sep 2013 12:28:10 +0200 Subject: [PATCH 21/54] Use Shrink() and new name GetRange --- .../include/cuSTL/algorithm/host/Foreach.hpp | 51 ++++--------------- 1 file changed, 11 insertions(+), 40 deletions(-) diff --git a/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp b/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp index d4f7d71cfb..eaa726ccdb 100644 --- a/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp +++ b/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp @@ -49,41 +49,12 @@ namespace host namespace detail { - /** Return cellIndex as math::Int */ - template - struct GetIndex; - - template<> - struct GetIndex<3u> - { - const math::Int<3u> operator()(const int x, const int y, const int z) const - { - return math::Int<3u>(x, y, z); - } - }; - template<> - struct GetIndex<2u> - { - const math::Int<2u> operator()(const int x, const int y, const int) const - { - return math::Int<2u>(x, y); - } - }; - template<> - struct GetIndex<1u> - { - const math::Int<1u> operator()(const int x, const int, const int) const - { - return math::Int<1u>(x); - } - }; - - /** Return max of the zone as math::Int */ + /** Return pseudo 3D-range of the zone as math::Int */ template< uint32_t dim > - struct GetMax; + struct GetRange; template<> - struct GetMax<3u> + struct GetRange<3u> { template const math::Int<3u> operator()(const Zone _zone) const @@ -92,7 +63,7 @@ namespace detail } }; template<> - struct GetMax<2u> + struct GetRange<2u> { template const math::Int<3u> operator()(const Zone _zone) const @@ -101,7 +72,7 @@ namespace detail } }; template<> - struct GetMax<1u> + struct GetRange<1u> { template const math::Int<3u> operator()(const Zone _zone) const @@ -119,15 +90,15 @@ namespace detail \ typename lambda::result_of::make_Functor::type fun \ = lambda::make_Functor(functor); \ - detail::GetIndex getIndex; \ - detail::GetMax getMax; \ - for(int z = 0; z < getMax(_zone).z(); z++) \ + detail::GetRange getRange; \ + for(int z = 0; z < getRange(_zone).z(); z++) \ { \ - for(int y = 0; y < getMax(_zone).y(); y++) \ + for(int y = 0; y < getRange(_zone).y(); y++) \ { \ - for(int x = 0; x < getMax(_zone).x(); x++) \ + for(int x = 0; x < getRange(_zone).x(); x++) \ { \ - math::Int cellIndex = getIndex(x, y, z); \ + math::Int cellIndex = \ + math::Int<3u>(x, y, z).shrink(); \ fun(BOOST_PP_ENUM(N, SHIFTACCESS_SHIFTEDCURSOR, _)); \ } \ } \ From f3072aee58c3c82825e3b0858ee27cf697d2d67d Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Wed, 11 Sep 2013 13:09:49 +0200 Subject: [PATCH 22/54] Remove unnecessay type_cast to same type --- src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp b/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp index eaa726ccdb..cdf695fb49 100644 --- a/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp +++ b/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp @@ -44,7 +44,7 @@ namespace host #define FOREACH_HOST_MAX_PARAMS 4 #endif -#define SHIFT_CURSOR_ZONE(Z, N, _) C ## N c ## N ## _shifted = c ## N ((math::Int) _zone.offset); +#define SHIFT_CURSOR_ZONE(Z, N, _) C ## N c ## N ## _shifted = c ## N (_zone.offset); #define SHIFTACCESS_SHIFTEDCURSOR(Z, N, _) c ## N ## _shifted [cellIndex] namespace detail From c043b3c26bb8754a22d790a9209009e513959bf5 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Wed, 11 Sep 2013 13:39:19 +0200 Subject: [PATCH 23/54] Add missing openmpi --- doc/INSTALL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/INSTALL.md b/doc/INSTALL.md index ce2da46c7d..733914868b 100644 --- a/doc/INSTALL.md +++ b/doc/INSTALL.md @@ -69,7 +69,7 @@ We recomment to install at least **pngwriter**. to `$HOME/lib/splash` - **hdf5** >= 1.8.6, standard shared version (no c++, enable parallel), e.g. `hdf5/1.8.5-threadsafe` - - *Debian/Ubuntu:* `sudo apt-get install libhdf5-dev` + - *Debian/Ubuntu:* `sudo apt-get install libhdf5-openmpi-dev` - example: - `mkdir -p ~/src ~/build ~/lib` - `cd ~/src` From f1d5b8a303f94014e38c5e8534f8ca8433c94401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20H=C3=BCbl?= Date: Thu, 12 Sep 2013 10:18:01 +0200 Subject: [PATCH 24/54] Update INSTALL.md sm_20 required --- doc/INSTALL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/INSTALL.md b/doc/INSTALL.md index 733914868b..9204deeb07 100644 --- a/doc/INSTALL.md +++ b/doc/INSTALL.md @@ -13,7 +13,7 @@ Requirements - [CUDA 5.5](https://developer.nvidia.com/cuda-downloads) or higher - at least one **CUDA** capable **GPU** - - **sm\_13** for basic PIC cycle, >= **sm\_20** for all features (higher order shapes, radiation diagnostics, ...) + - *Compute capability* **sm\_20** or higher - [full list](https://developer.nvidia.com/cuda-gpus) of CUDA GPUs and their *compute capability* - ([More](http://www.olcf.ornl.gov/titan/) is always better. Especially, if we are talking about GPUs.) From 9ad13bf5e3edf608731a6ab742f21719ab61db98 Mon Sep 17 00:00:00 2001 From: Heikman Date: Wed, 11 Sep 2013 19:17:38 +0200 Subject: [PATCH 25/54] implement perfect forwarding within lambda functors - every non-const reference argument of a lambda functor is converted to a refWrapper. Therefore the arguemnt tuple can be forwarded inside the lambda functor as a const reference. All RefWrapper values are converted back to non-const references before they are used. --- .../cuSTL/cursor/accessor/CursorAccessor.hpp | 2 +- .../cuSTL/cursor/accessor/MarkerAccessor.hpp | 4 +- .../cuSTL/cursor/accessor/PointerAccessor.hpp | 2 +- .../cursor/accessor/TwistAxesAccessor.hpp | 4 +- src/libPMacc/include/lambda/CT/Eval.hpp | 19 ++++++++ src/libPMacc/include/lambda/make_Functor.hpp | 43 +++++++++++++++---- src/libPMacc/include/math/Tuple.hpp | 41 ++++++------------ 7 files changed, 72 insertions(+), 43 deletions(-) diff --git a/src/libPMacc/include/cuSTL/cursor/accessor/CursorAccessor.hpp b/src/libPMacc/include/cuSTL/cursor/accessor/CursorAccessor.hpp index 7349b251b1..1846cffcbd 100644 --- a/src/libPMacc/include/cuSTL/cursor/accessor/CursorAccessor.hpp +++ b/src/libPMacc/include/cuSTL/cursor/accessor/CursorAccessor.hpp @@ -34,7 +34,7 @@ struct CursorAccessor { typedef typename TCursor::type type; - HDINLINE type& operator()(TCursor& cursor) + HDINLINE type operator()(TCursor& cursor) { return *cursor; } diff --git a/src/libPMacc/include/cuSTL/cursor/accessor/MarkerAccessor.hpp b/src/libPMacc/include/cuSTL/cursor/accessor/MarkerAccessor.hpp index 663394e109..297ea69b4a 100644 --- a/src/libPMacc/include/cuSTL/cursor/accessor/MarkerAccessor.hpp +++ b/src/libPMacc/include/cuSTL/cursor/accessor/MarkerAccessor.hpp @@ -30,10 +30,10 @@ namespace cursor template struct MarkerAccessor { - typedef Marker& type; + typedef Marker type; HDINLINE - Marker& operator()(Marker& marker) const + Marker operator()(const Marker& marker) const { return marker; } diff --git a/src/libPMacc/include/cuSTL/cursor/accessor/PointerAccessor.hpp b/src/libPMacc/include/cuSTL/cursor/accessor/PointerAccessor.hpp index 173146ddfb..0b223b2922 100644 --- a/src/libPMacc/include/cuSTL/cursor/accessor/PointerAccessor.hpp +++ b/src/libPMacc/include/cuSTL/cursor/accessor/PointerAccessor.hpp @@ -34,7 +34,7 @@ struct PointerAccessor template HDINLINE - Type& operator()(Data& data) const + type operator()(Data& data) const { return *((Type*)data); } diff --git a/src/libPMacc/include/cuSTL/cursor/accessor/TwistAxesAccessor.hpp b/src/libPMacc/include/cuSTL/cursor/accessor/TwistAxesAccessor.hpp index 6737e9acb4..15c5e31143 100644 --- a/src/libPMacc/include/cuSTL/cursor/accessor/TwistAxesAccessor.hpp +++ b/src/libPMacc/include/cuSTL/cursor/accessor/TwistAxesAccessor.hpp @@ -33,9 +33,9 @@ template struct TwistAxesAccessor { typedef typename math::tools::result_of::TwistVectorAxes< - Axes, typename TCursor::pureType>::type type; + Axes, typename TCursor::pureType>::type& type; - HDINLINE type& operator()(TCursor& cursor) + HDINLINE type operator()(TCursor& cursor) { return math::tools::twistVectorAxes(*cursor); } diff --git a/src/libPMacc/include/lambda/CT/Eval.hpp b/src/libPMacc/include/lambda/CT/Eval.hpp index d8289d5284..af357b5412 100644 --- a/src/libPMacc/include/lambda/CT/Eval.hpp +++ b/src/libPMacc/include/lambda/CT/Eval.hpp @@ -34,6 +34,7 @@ #include #include #include +#include "RefWrapper.hpp" namespace mpl = boost::mpl; @@ -56,6 +57,12 @@ struct Eval >, ArgsT typedef Child0 type; }; +template +struct Eval > >, ArgsTuple> +{ + typedef Child0& type; +}; + template struct Eval > >, ArgsTuple> { @@ -177,6 +184,18 @@ struct Eval +struct Eval > >, + terminalTypeIdx> > +{ + template + HDINLINE Child0& + operator()(const TerminalTuple& terminalTuple, ArgsTuple) const + { + return terminalTuple.at(mpl::int_()).get(); + } +}; + template struct Eval >, terminalTypeIdx> > diff --git a/src/libPMacc/include/lambda/make_Functor.hpp b/src/libPMacc/include/lambda/make_Functor.hpp index 2fe9f77574..ecbd218930 100644 --- a/src/libPMacc/include/lambda/make_Functor.hpp +++ b/src/libPMacc/include/lambda/make_Functor.hpp @@ -30,9 +30,12 @@ #include "CT/Eval.hpp" #include "CT/FillTerminalList.hpp" #include +#include "RefWrapper.hpp" + #include #include #include +#include #include #include @@ -81,6 +84,26 @@ namespace PMacc { namespace lambda { + +namespace detail +{ + +struct Ref2RefWrapper +{ + template + struct apply + { + typedef Type type; + }; + + template + struct apply + { + typedef RefWrapper type; + }; +}; + +} // namespace detail template struct ExprFunctor @@ -102,15 +125,17 @@ struct ExprFunctor #define REF_TYPE_LIST(Z, N, _) Arg ## N & - #define OPERATOR_CALL(Z,N,_) \ - template \ - HDINLINE \ - typename ::PMacc::result_of::Functor, BOOST_PP_ENUM_PARAMS(N, Arg)>::type \ - operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, Arg, &arg)) const \ - { \ - typedef math::Tuple > ArgTuple; \ - ArgTuple args(BOOST_PP_ENUM_PARAMS(N, arg)); \ - return CT::Eval()(this->terminalTuple, args); \ + #define OPERATOR_CALL(Z,N,_) \ + template \ + HDINLINE \ + typename ::PMacc::result_of::Functor, BOOST_PP_ENUM_PARAMS(N, Arg)>::type \ + operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, Arg, arg)) const \ + { \ + typedef mpl::vector ArgTypes; \ + typedef typename mpl::transform::type NoRefArgTypes; \ + typedef math::Tuple ArgTuple; \ + ArgTuple args(BOOST_PP_ENUM_PARAMS(N, arg)); \ + return CT::Eval()(this->terminalTuple, args); \ } BOOST_PP_REPEAT_FROM_TO(1, LAMBDA_MAX_PARAMS, OPERATOR_CALL, _) diff --git a/src/libPMacc/include/math/Tuple.hpp b/src/libPMacc/include/math/Tuple.hpp index 3e5625db55..19b4cd8ba8 100644 --- a/src/libPMacc/include/math/Tuple.hpp +++ b/src/libPMacc/include/math/Tuple.hpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -45,26 +46,16 @@ namespace math #define TUPLE_MAX_DIM 8 #endif -#define CONSTRUCTOR(Z, N, _) \ - template \ - HDINLINE \ - Tuple(BOOST_PP_ENUM_BINARY_PARAMS(N, const Arg, &arg)) \ - : value(arg0), \ - base(BOOST_PP_ENUM_SHIFTED_PARAMS(N, arg)) \ - { \ - BOOST_STATIC_ASSERT(dim == N); \ - } - -#define CONSTRUCTOR_LVALUE(Z, N, _) \ - template \ - HDINLINE \ - Tuple(BOOST_PP_ENUM_BINARY_PARAMS(N, Arg, &arg)) \ - : value(arg0), \ - base(BOOST_PP_ENUM_SHIFTED_PARAMS(N, arg)) \ - { \ - BOOST_STATIC_ASSERT(dim == N); \ - } +#define GET_TYPE(Z, N, _) typename mpl::at_c::type arg ## N +#define CONSTRUCTOR(Z, N, _) \ + HDINLINE \ + Tuple(BOOST_PP_ENUM(N, GET_TYPE, _)) \ + : value(arg0), \ + base(BOOST_PP_ENUM_SHIFTED_PARAMS(N, arg)) \ + { \ + BOOST_STATIC_ASSERT(dim == N); \ + } namespace mpl = boost::mpl; @@ -91,18 +82,12 @@ class Tuple public: HDINLINE Tuple() {} - HDINLINE Tuple(const pureValue& arg0) : value(arg0) - { - BOOST_STATIC_ASSERT(dim == 1); - } - - HDINLINE Tuple(pureValue& arg0) : value(arg0) + HDINLINE Tuple(Value arg0) : value(arg0) { BOOST_STATIC_ASSERT(dim == 1); } BOOST_PP_REPEAT_FROM_TO(2, BOOST_PP_INC(TUPLE_MAX_DIM), CONSTRUCTOR, _) - BOOST_PP_REPEAT_FROM_TO(2, BOOST_PP_INC(TUPLE_MAX_DIM), CONSTRUCTOR_LVALUE, _) template HDINLINE @@ -155,13 +140,13 @@ class Tuple }; #undef CONSTRUCTOR -#undef CONSTRUCTOR_LVALUE +#undef GET_TYPE #define MAKE_TUPLE(Z, N, _) \ template \ HDINLINE \ Tuple > \ - make_Tuple(BOOST_PP_ENUM_BINARY_PARAMS(N, const Value, &value)) \ + make_Tuple(BOOST_PP_ENUM_BINARY_PARAMS(N, Value, value)) \ { \ return Tuple > \ (BOOST_PP_ENUM_PARAMS(N, value)); \ From d269aa1bba549779ea2c1e5830251b81eaa9b7c6 Mon Sep 17 00:00:00 2001 From: Heikman Date: Thu, 12 Sep 2013 14:58:44 +0200 Subject: [PATCH 26/54] implement perfect forwarding within lambda functors. Add forward.hpp Whenever a templated functor is called the arguments are supposed to be forwarded: functor(arg0, arg1, ...); -> functor(PMacc::forward(arg0), PMacc::forward(arg1), ...); "forward" converts every object form which a non-const reference can be build to a RefWrapper object. - every non-const reference argument of a lambda functor is converted to a refWrapper. Therefore the arguemnt tuple can be forwarded inside the lambda functor as a const reference. All RefWrapper values are converted back to non-const references before they are used. --- .../cuSTL/algorithm/cudaBlock/Foreach.hpp | 3 +- .../include/cuSTL/algorithm/host/Foreach.hpp | 5 +- .../cuSTL/algorithm/kernel/Foreach.hpp | 3 +- .../cuSTL/algorithm/kernel/ForeachBlock.hpp | 3 +- .../cuSTL/container/copier/Memcopy.hpp | 2 +- src/libPMacc/include/cuSTL/cursor/Cursor.hpp | 2 +- .../cuSTL/cursor/accessor/FunctorAccessor.hpp | 3 +- .../cuSTL/cursor/accessor/MarkerAccessor.hpp | 4 +- src/libPMacc/include/forward.hpp | 46 ++++++++++++ src/libPMacc/include/lambda/CT/Eval.hpp | 73 +++++++++++++++---- src/libPMacc/include/lambda/make_Functor.hpp | 31 ++------ 11 files changed, 124 insertions(+), 51 deletions(-) create mode 100644 src/libPMacc/include/forward.hpp diff --git a/src/libPMacc/include/cuSTL/algorithm/cudaBlock/Foreach.hpp b/src/libPMacc/include/cuSTL/algorithm/cudaBlock/Foreach.hpp index f101868d28..7485771669 100644 --- a/src/libPMacc/include/cuSTL/algorithm/cudaBlock/Foreach.hpp +++ b/src/libPMacc/include/cuSTL/algorithm/cudaBlock/Foreach.hpp @@ -24,6 +24,7 @@ #include #include #include +#include namespace PMacc { @@ -36,7 +37,7 @@ namespace cudaBlock #define FOREACH_KERNEL_MAX_PARAMS 4 #endif -#define SHIFTACCESS_CURSOR(Z, N, _) c ## N [pos] +#define SHIFTACCESS_CURSOR(Z, N, _) forward(c ## N [pos]) #define FOREACH_OPERATOR(Z, N, _) \ template \ diff --git a/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp b/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp index cdf695fb49..e345c464ea 100644 --- a/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp +++ b/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp @@ -25,6 +25,7 @@ #include "math/vector/Size_t.hpp" #include "math/vector/Int.hpp" #include "lambda/make_Functor.hpp" +#include #include #include @@ -44,8 +45,8 @@ namespace host #define FOREACH_HOST_MAX_PARAMS 4 #endif -#define SHIFT_CURSOR_ZONE(Z, N, _) C ## N c ## N ## _shifted = c ## N (_zone.offset); -#define SHIFTACCESS_SHIFTEDCURSOR(Z, N, _) c ## N ## _shifted [cellIndex] +#define SHIFT_CURSOR_ZONE(Z, N, _) C ## N c ## N ## _shifted = c ## N ((math::Int) _zone.offset); +#define SHIFTACCESS_SHIFTEDCURSOR(Z, N, _) forward(c ## N ## _shifted [cellIndex]) namespace detail { diff --git a/src/libPMacc/include/cuSTL/algorithm/kernel/Foreach.hpp b/src/libPMacc/include/cuSTL/algorithm/kernel/Foreach.hpp index fdb3da9d81..8b2c389cac 100644 --- a/src/libPMacc/include/cuSTL/algorithm/kernel/Foreach.hpp +++ b/src/libPMacc/include/cuSTL/algorithm/kernel/Foreach.hpp @@ -27,6 +27,7 @@ #include "math/vector/Int.hpp" #include "lambda/make_Functor.hpp" #include "detail/SphericMapper.hpp" +#include #include #include @@ -52,7 +53,7 @@ namespace kernel namespace detail { -#define SHIFTACCESS_CURSOR(Z, N, _) c ## N [cellIndex] +#define SHIFTACCESS_CURSOR(Z, N, _) forward(c ## N [cellIndex]) #define KERNEL_FOREACH(Z, N, _) \ template \ diff --git a/src/libPMacc/include/cuSTL/algorithm/kernel/ForeachBlock.hpp b/src/libPMacc/include/cuSTL/algorithm/kernel/ForeachBlock.hpp index 95d6e90ffc..12ad92193f 100644 --- a/src/libPMacc/include/cuSTL/algorithm/kernel/ForeachBlock.hpp +++ b/src/libPMacc/include/cuSTL/algorithm/kernel/ForeachBlock.hpp @@ -27,6 +27,7 @@ #include "math/vector/Int.hpp" #include "lambda/make_Functor.hpp" #include "detail/SphericMapper.hpp" +#include "forward.hpp" #include #include @@ -52,7 +53,7 @@ namespace kernel namespace detail { -#define SHIFTACCESS_CURSOR(Z, N, _) c ## N [cellIndex] +#define SHIFTACCESS_CURSOR(Z, N, _) PMacc::forward(c ## N [cellIndex]) #define KERNEL_FOREACH(Z, N, _) \ template \ diff --git a/src/libPMacc/include/cuSTL/container/copier/Memcopy.hpp b/src/libPMacc/include/cuSTL/container/copier/Memcopy.hpp index eb8f4ff5d0..6ec42eff24 100644 --- a/src/libPMacc/include/cuSTL/container/copier/Memcopy.hpp +++ b/src/libPMacc/include/cuSTL/container/copier/Memcopy.hpp @@ -97,7 +97,7 @@ struct Memcopy<3> pitchedPtrSource.pitch = pitchSource.x(); pitchedPtrSource.ptr = source; pitchedPtrSource.xsize = size.x(); pitchedPtrSource.ysize = size.y(); - cudaMemcpy3DParms params = {0}; + cudaMemcpy3DParms params; params.srcArray = NULL; params.srcPos = make_cudaPos(0,0,0); params.srcPtr = pitchedPtrSource; diff --git a/src/libPMacc/include/cuSTL/cursor/Cursor.hpp b/src/libPMacc/include/cuSTL/cursor/Cursor.hpp index 5350af507d..a078a3d56b 100644 --- a/src/libPMacc/include/cuSTL/cursor/Cursor.hpp +++ b/src/libPMacc/include/cuSTL/cursor/Cursor.hpp @@ -63,7 +63,7 @@ class Cursor : private _Accessor, _Navigator } HDINLINE - typename boost::add_const::type operator*() const + type operator*() const { return Accessor::operator()(this->marker); } diff --git a/src/libPMacc/include/cuSTL/cursor/accessor/FunctorAccessor.hpp b/src/libPMacc/include/cuSTL/cursor/accessor/FunctorAccessor.hpp index bf783815fa..ff95534743 100644 --- a/src/libPMacc/include/cuSTL/cursor/accessor/FunctorAccessor.hpp +++ b/src/libPMacc/include/cuSTL/cursor/accessor/FunctorAccessor.hpp @@ -23,6 +23,7 @@ #define CURSOR_FUNCTORACCESSOR_HPP #include +#include #include "types.h" namespace PMacc @@ -42,7 +43,7 @@ struct FunctorAccessor template HDINLINE type operator()(TCursor& cursor) { - return this->functor(*cursor); + return this->functor(forward(*cursor)); } }; diff --git a/src/libPMacc/include/cuSTL/cursor/accessor/MarkerAccessor.hpp b/src/libPMacc/include/cuSTL/cursor/accessor/MarkerAccessor.hpp index 297ea69b4a..b304b09139 100644 --- a/src/libPMacc/include/cuSTL/cursor/accessor/MarkerAccessor.hpp +++ b/src/libPMacc/include/cuSTL/cursor/accessor/MarkerAccessor.hpp @@ -30,10 +30,10 @@ namespace cursor template struct MarkerAccessor { - typedef Marker type; + typedef const Marker type; HDINLINE - Marker operator()(const Marker& marker) const + type operator()(const Marker& marker) const { return marker; } diff --git a/src/libPMacc/include/forward.hpp b/src/libPMacc/include/forward.hpp new file mode 100644 index 0000000000..7d2c35e37e --- /dev/null +++ b/src/libPMacc/include/forward.hpp @@ -0,0 +1,46 @@ +/** + * Copyright 2013 Heiko Burau, René Widera + * + * This file is part of libPMacc. + * + * libPMacc is free software: you can redistribute it and/or modify + * it under the terms of of either the GNU General Public License or + * the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * libPMacc is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License and the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License + * and the GNU Lesser General Public License along with libPMacc. + * If not, see . + */ + +#pragma once + +#include "types.h" +#include "RefWrapper.hpp" + +namespace PMacc +{ + +template +HDINLINE +const Type& +forward(const Type& arg) +{ + return arg; +} + +template +HDINLINE +RefWrapper +forward(Type& arg) +{ + return arg; +} + +} // namespace PMacc diff --git a/src/libPMacc/include/lambda/CT/Eval.hpp b/src/libPMacc/include/lambda/CT/Eval.hpp index af357b5412..e5e1b53737 100644 --- a/src/libPMacc/include/lambda/CT/Eval.hpp +++ b/src/libPMacc/include/lambda/CT/Eval.hpp @@ -48,6 +48,35 @@ namespace CT namespace result_of { +namespace detail +{ + +template +struct RefWrapper2Ref +{ + typedef Type type; +}; + +template +struct RefWrapper2Ref > +{ + typedef Type& type; +}; + +template +struct RefWrapper2Ref > +{ + typedef Type& type; +}; + +template +struct RefWrapper2Ref& > +{ + typedef Type& type; +}; + +} + template struct Eval; @@ -63,10 +92,22 @@ struct Eval +struct Eval > >, ArgsTuple> +{ + typedef Child0& type; +}; + +template +struct Eval& > >, ArgsTuple> +{ + typedef Child0& type; +}; + template struct Eval > >, ArgsTuple> { - typedef typename boost::add_reference< + typedef typename detail::RefWrapper2Ref< typename math::result_of::at_c::type>::type type; }; @@ -79,8 +120,9 @@ struct Eval > > template struct Eval >, ArgsTuple> { - typedef typename boost::add_reference::type>::type type; + typedef typename boost::add_reference< + typename detail::RefWrapper2Ref< + typename result_of::Eval::type>::type>::type type; }; template @@ -136,8 +178,9 @@ template struct Eval >, ArgsTuple> { typedef typename boost::add_reference< - typename boost::remove_reference::type>::type::type>::type type; + typename boost::remove_reference< + typename detail::RefWrapper2Ref< + typename result_of::Eval::type>::type>::type::type>::type type; }; } // result_of @@ -154,7 +197,7 @@ struct Eval HDINLINE typename CT::result_of::Eval::type - operator()(TerminalTuple, ArgsTuple& argsTuple) const + operator()(TerminalTuple, const ArgsTuple& argsTuple) const { return argsTuple.at(mpl::int_()); } @@ -204,8 +247,8 @@ struct Eval CTExpr; template - HDINLINE typename result_of::Eval::type& - operator()(const TerminalTuple& terminalTuple, ArgsTuple& argsTuple) const + HDINLINE typename result_of::Eval::type + operator()(const TerminalTuple& terminalTuple, const ArgsTuple& argsTuple) const { CT::Eval()(terminalTuple, argsTuple) = CT::Eval()(terminalTuple, argsTuple); @@ -223,7 +266,7 @@ struct Eval HDINLINE typename result_of::Eval::type - operator()(const TerminalTuple& terminalTuple, ArgsTuple& argsTuple) const + operator()(const TerminalTuple& terminalTuple, const ArgsTuple& argsTuple) const { return CT::Eval()(terminalTuple, argsTuple) + CT::Eval()(terminalTuple, argsTuple); @@ -239,7 +282,7 @@ struct Eval HDINLINE typename result_of::Eval::type - operator()(const TerminalTuple& terminalTuple, ArgsTuple& argsTuple) const + operator()(const TerminalTuple& terminalTuple, const ArgsTuple& argsTuple) const { return CT::Eval()(terminalTuple, argsTuple) - CT::Eval()(terminalTuple, argsTuple); @@ -255,7 +298,7 @@ struct Eval HDINLINE typename result_of::Eval::type - operator()(const TerminalTuple& terminalTuple, ArgsTuple& argsTuple) const + operator()(const TerminalTuple& terminalTuple, const ArgsTuple& argsTuple) const { return CT::Eval()(terminalTuple, argsTuple) * CT::Eval()(terminalTuple, argsTuple); @@ -271,7 +314,7 @@ struct Eval HDINLINE typename result_of::Eval::type - operator()(const TerminalTuple& terminalTuple, ArgsTuple& argsTuple) const + operator()(const TerminalTuple& terminalTuple, const ArgsTuple& argsTuple) const { return CT::Eval()(terminalTuple, argsTuple) / CT::Eval()(terminalTuple, argsTuple); @@ -288,7 +331,7 @@ struct Eval HDINLINE void - operator()(const TerminalTuple& terminalTuple, ArgsTuple& argsTuple) const + operator()(const TerminalTuple& terminalTuple, const ArgsTuple& argsTuple) const { CT::Eval()(terminalTuple, argsTuple); CT::Eval()(terminalTuple, argsTuple); @@ -308,7 +351,7 @@ struct Eval \ HDINLINE typename result_of::Eval::type \ - operator()(const TerminalTuple& terminalTuple, ArgsTuple& argsTuple) const \ + operator()(const TerminalTuple& terminalTuple, const ArgsTuple& argsTuple) const \ { \ return CT::Eval()(terminalTuple, argsTuple)( \ BOOST_PP_ENUM(BOOST_PP_DEC(N), EVAL_CHILD, _)); \ @@ -328,7 +371,7 @@ struct Eval HDINLINE typename result_of::Eval::type - operator()(const TerminalTuple& terminalTuple, ArgsTuple& argsTuple) const + operator()(const TerminalTuple& terminalTuple, const ArgsTuple& argsTuple) const { return CT::Eval()(terminalTuple, argsTuple)[ CT::Eval()(terminalTuple, argsTuple)]; diff --git a/src/libPMacc/include/lambda/make_Functor.hpp b/src/libPMacc/include/lambda/make_Functor.hpp index ecbd218930..e10880e2be 100644 --- a/src/libPMacc/include/lambda/make_Functor.hpp +++ b/src/libPMacc/include/lambda/make_Functor.hpp @@ -84,26 +84,6 @@ namespace PMacc { namespace lambda { - -namespace detail -{ - -struct Ref2RefWrapper -{ - template - struct apply - { - typedef Type type; - }; - - template - struct apply - { - typedef RefWrapper type; - }; -}; - -} // namespace detail template struct ExprFunctor @@ -123,17 +103,16 @@ struct ExprFunctor CT::FillTerminalList()(expr, this->terminalTuple); } - #define REF_TYPE_LIST(Z, N, _) Arg ## N & + #define CREF_TYPE_LIST(Z, N, _) const Arg ## N & #define OPERATOR_CALL(Z,N,_) \ template \ HDINLINE \ typename ::PMacc::result_of::Functor, BOOST_PP_ENUM_PARAMS(N, Arg)>::type \ - operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, Arg, arg)) const \ + operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, const Arg, &arg)) const \ { \ - typedef mpl::vector ArgTypes; \ - typedef typename mpl::transform::type NoRefArgTypes; \ - typedef math::Tuple ArgTuple; \ + typedef mpl::vector ArgTypes; \ + typedef math::Tuple ArgTuple; \ ArgTuple args(BOOST_PP_ENUM_PARAMS(N, arg)); \ return CT::Eval()(this->terminalTuple, args); \ } @@ -141,7 +120,7 @@ struct ExprFunctor BOOST_PP_REPEAT_FROM_TO(1, LAMBDA_MAX_PARAMS, OPERATOR_CALL, _) #undef OPERATOR_CALL - #undef REF_TYPE_LIST + #undef CREF_TYPE_LIST }; namespace result_of From 6ba2aeaa6fa28bd671cd217a258ac4c097e8e8ea Mon Sep 17 00:00:00 2001 From: Heikman Date: Thu, 12 Sep 2013 15:26:34 +0200 Subject: [PATCH 27/54] removed unneccesary PMacc:: --- src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp | 2 +- src/libPMacc/include/cuSTL/algorithm/kernel/ForeachBlock.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp b/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp index e345c464ea..28bf537489 100644 --- a/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp +++ b/src/libPMacc/include/cuSTL/algorithm/host/Foreach.hpp @@ -45,7 +45,7 @@ namespace host #define FOREACH_HOST_MAX_PARAMS 4 #endif -#define SHIFT_CURSOR_ZONE(Z, N, _) C ## N c ## N ## _shifted = c ## N ((math::Int) _zone.offset); +#define SHIFT_CURSOR_ZONE(Z, N, _) C ## N c ## N ## _shifted = c ## N (_zone.offset); #define SHIFTACCESS_SHIFTEDCURSOR(Z, N, _) forward(c ## N ## _shifted [cellIndex]) namespace detail diff --git a/src/libPMacc/include/cuSTL/algorithm/kernel/ForeachBlock.hpp b/src/libPMacc/include/cuSTL/algorithm/kernel/ForeachBlock.hpp index 12ad92193f..1cd9203a2b 100644 --- a/src/libPMacc/include/cuSTL/algorithm/kernel/ForeachBlock.hpp +++ b/src/libPMacc/include/cuSTL/algorithm/kernel/ForeachBlock.hpp @@ -53,7 +53,7 @@ namespace kernel namespace detail { -#define SHIFTACCESS_CURSOR(Z, N, _) PMacc::forward(c ## N [cellIndex]) +#define SHIFTACCESS_CURSOR(Z, N, _) forward(c ## N [cellIndex]) #define KERNEL_FOREACH(Z, N, _) \ template \ From fad90600443b335cef933d44619fef1077a1233b Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Wed, 11 Sep 2013 16:41:07 +0200 Subject: [PATCH 28/54] remove old "binary" matrix command --- src/tools/share/gnuplot/density.interactive.gnuplot | 2 +- src/tools/share/gnuplot/density.png.gnuplot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/share/gnuplot/density.interactive.gnuplot b/src/tools/share/gnuplot/density.interactive.gnuplot index 44a03aac12..6142cbda04 100644 --- a/src/tools/share/gnuplot/density.interactive.gnuplot +++ b/src/tools/share/gnuplot/density.interactive.gnuplot @@ -52,4 +52,4 @@ set yrange [GPVAL_DATA_Y_MIN:GPVAL_DATA_Y_MAX] set cbrange [0:colormax] -replot \ No newline at end of file +replot diff --git a/src/tools/share/gnuplot/density.png.gnuplot b/src/tools/share/gnuplot/density.png.gnuplot index cc2709f3b5..09d769c6db 100644 --- a/src/tools/share/gnuplot/density.png.gnuplot +++ b/src/tools/share/gnuplot/density.png.gnuplot @@ -58,4 +58,4 @@ set yrange [GPVAL_DATA_Y_MIN:GPVAL_DATA_Y_MAX] set cbrange [0:colormax] -plot infile binary matrix using 1:2:3 with image title "" \ No newline at end of file +replot From b388d761d5b02f368353b198ae5f5371398e364e Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Fri, 13 Sep 2013 09:32:56 +0200 Subject: [PATCH 29/54] Fix #43 Implicit -q when -j with compile script --- buildsystem/CompileSuite/options.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/buildsystem/CompileSuite/options.sh b/buildsystem/CompileSuite/options.sh index 83dc6b11b8..24e1422f72 100755 --- a/buildsystem/CompileSuite/options.sh +++ b/buildsystem/CompileSuite/options.sh @@ -40,6 +40,7 @@ while true ; do ;; -j) num_parallel="$2" + quiet_run=1 shift ;; -c|--cmake) From c2d7e0c0f6ba986ecf9c3f2511b92204c455f9bc Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Mon, 16 Sep 2013 09:43:02 +0200 Subject: [PATCH 30/54] Cell2Particle: Access particles by frame - avoid re-writing and map particle attributes (l and rvalues) transparently - Change interfaces that use Cell2Particle already --- .../include/particles/access/Cell2Particle.tpp | 11 +---------- src/picongpu/include/plugins/ParticleDensity.tpp | 14 +++++++------- src/picongpu/include/plugins/ParticleSpectrum.tpp | 8 ++++---- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src/picongpu/include/particles/access/Cell2Particle.tpp b/src/picongpu/include/particles/access/Cell2Particle.tpp index 187432270f..5b9b90148f 100644 --- a/src/picongpu/include/particles/access/Cell2Particle.tpp +++ b/src/picongpu/include/particles/access/Cell2Particle.tpp @@ -28,11 +28,6 @@ namespace mpl = boost::mpl; namespace particleAccess { - -struct Pos {}; -struct Mom {}; -struct LocalCellIdx {}; -struct Weight {}; #define TEMPLATE_ARGS(Z, N, _) typename Arg ## N #define NORMAL_ARGS(Z, N, _) Arg ## N arg ## N @@ -71,11 +66,7 @@ BOOST_PP_ENUM_TRAILING(N, NORMAL_ARGS, _)) \ if (linearThreadIdx < particlesInSuperCell) \ { \ functor( \ - PMacc::math::make_MapTuple \ - (ref(frame->getPosition()[linearThreadIdx]), \ - ref(frame->getMomentum()[linearThreadIdx]), \ - ref(frame->getCellIdx()[linearThreadIdx]), \ - ref(frame->getWeighting()[linearThreadIdx])) \ + frame, linearThreadIdx \ BOOST_PP_ENUM_TRAILING(N, ARGS, _) \ ); \ } \ diff --git a/src/picongpu/include/plugins/ParticleDensity.tpp b/src/picongpu/include/plugins/ParticleDensity.tpp index 11375e395b..18d045e696 100644 --- a/src/picongpu/include/plugins/ParticleDensity.tpp +++ b/src/picongpu/include/plugins/ParticleDensity.tpp @@ -50,27 +50,27 @@ template struct ParticleDensityKernel { typedef void result_type; - + int planeDir; int localPlane; ParticleDensityKernel() {} ParticleDensityKernel(int planeDir, int localPlane) : planeDir(planeDir), localPlane(localPlane) {} - - template - DINLINE void operator()(Particle particle, Field field, const ::PMacc::math::Int<3>& blockCellIdx) + + template + DINLINE void operator()(FramePtr particle, uint16_t particleID, Field field, const ::PMacc::math::Int<3>& blockCellIdx) { - lcellId_t linearCellIdx = particle[particleAccess::LocalCellIdx()]; + lcellId_t linearCellIdx = particle->getCellIdx()[particleID]; ::PMacc::math::Int<3> cellIdx(linearCellIdx % BlockDim::x::value, (linearCellIdx / BlockDim::x::value) % BlockDim::x::value, linearCellIdx / (BlockDim::x::value * BlockDim::y::value)); if(cellIdx[planeDir] != localPlane) return; - + ::PMacc::math::Int<3> globalCellIdx = blockCellIdx - (PMacc::math::Int<3>)BlockDim().vec() + cellIdx; /// \warn reduce a normalized float_X with particleAccess::Weight() / NUM_EL_PER_PARTICLE /// to avoid overflows for heavy weightings /// - atomicAdd(&(*field(globalCellIdx.shrink<2>((planeDir+1)%3))), (int)particle[particleAccess::Weight()]); + atomicAdd(&(*field(globalCellIdx.shrink<2>((planeDir+1)%3))), (int)particle->getWeighting()[particleID]); } }; diff --git a/src/picongpu/include/plugins/ParticleSpectrum.tpp b/src/picongpu/include/plugins/ParticleSpectrum.tpp index 5083d9c50f..06f259d84f 100644 --- a/src/picongpu/include/plugins/ParticleSpectrum.tpp +++ b/src/picongpu/include/plugins/ParticleSpectrum.tpp @@ -52,11 +52,11 @@ struct Particle2Histrogram DINLINE Particle2Histrogram(float_X minEnergy, float_X maxEnergy) : minEnergy(minEnergy), maxEnergy(maxEnergy) {} - template - DINLINE void operator()(Particle particle, Histogram histogram) const + template + DINLINE void operator()(FramePtr particle, uint16_t particleID, Histogram histogram) const { - float3_X mom = particle[particleAccess::Mom()].get(); - float_X weighting = particle[particleAccess::Weight()]; + float3_X mom = particle->getMomentum()[particleID]; + float_X weighting = particle->getWeighting()[particleID]; const float_X c2 = SPEED_OF_LIGHT * SPEED_OF_LIGHT; const float_X mass = M_EL; const float_X mass_reci = float_X(1.0) / mass; From 1c3636da297b2acfa93cb24c1d7116cfaf70d103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Widera?= Date: Mon, 16 Sep 2013 16:40:32 +0200 Subject: [PATCH 31/54] fix warning in __cudaKernel - fix warning if we use expression like 1==2?:10wq - move preprocessor definition to ppFunctions.hpp --- .../eventSystem/events/kernelEvents.hpp | 133 +++++++++--------- src/libPMacc/include/ppFunctions.hpp | 21 ++- .../include/simulation_classTypes.hpp | 12 +- 3 files changed, 91 insertions(+), 75 deletions(-) diff --git a/src/libPMacc/include/eventSystem/events/kernelEvents.hpp b/src/libPMacc/include/eventSystem/events/kernelEvents.hpp index 82362ebcd0..b4b97f9268 100644 --- a/src/libPMacc/include/eventSystem/events/kernelEvents.hpp +++ b/src/libPMacc/include/eventSystem/events/kernelEvents.hpp @@ -19,69 +19,70 @@ * If not, see . */ -#ifndef KERNELEVENTS_H -#define KERNELEVENTS_H - -#include "types.h" -#include "dimensions/DataSpace.hpp" -#include "eventSystem/EventSystem.hpp" - -namespace PMacc -{ - -/*if this flag is defined all kernel calls would be checked and synchronize - * this flag must set by the compiler or inside of the Makefile - */ -#if (PMACC_SYNC_KERNEL == 1) - #define CUDA_CHECK_KERNEL_MSG(...) CUDA_CHECK_MSG(__VA_ARGS__) -#else - /*no synchronize and check of kernel calls*/ - #define CUDA_CHECK_KERNEL_MSG(...) ; -#endif - -/** - * Returns number of args... arguments. - * - * Can only count values of ... which can be casted to int type. - * - * @param ... arguments - */ -#define PMACC_NUMARGS(...) (sizeof((int[]){0, ##__VA_ARGS__})/sizeof(int)-1) - -/** - * Appends kernel arguments to generated code and activates kernel task. - * - * @param ... parameters to pass to kernel - */ -#define PMACC_CUDAPARAMS(...) (__VA_ARGS__); \ - CUDA_CHECK_KERNEL_MSG(cudaThreadSynchronize(),"Crash after kernel call"); \ - taskKernel->activateChecks(); \ - CUDA_CHECK_KERNEL_MSG(cudaThreadSynchronize(),"Crash after kernel activation"); \ - } /*this is used if call is EventTask.waitforfinished();*/ - -/** - * Configures block and grid sizes and shared memory for the kernel. - * - * @param grid sizes of grid on gpu - * @param block sizes of block on gpu - * @param ... amount of shared memory for the kernel (optional) - */ -#define PMACC_CUDAKERNELCONFIG(grid,block,...) <<<(grid),(block), \ - PMACC_NUMARGS(__VA_ARGS__)==1?__VA_ARGS__:0, \ - taskKernel->getCudaStream()>>> PMACC_CUDAPARAMS - -/** - * Calls a CUDA kernel and creates an EventTask which represents the kernel. - * - * @param kernelname name of the CUDA kernel (can also used with templates etc. myKernel<1>) - */ -#define __cudaKernel(kernelname) { \ - CUDA_CHECK_KERNEL_MSG(cudaThreadSynchronize(),"Crash before kernel call"); \ - TaskKernel *taskKernel = Factory::getInstance().createTaskKernel(#kernelname); \ - kernelname PMACC_CUDAKERNELCONFIG - -} - - -#endif //KERNELEVENTS_H - +#ifndef KERNELEVENTS_H +#define KERNELEVENTS_H + +#include "types.h" +#include "ppFunctions.hpp" +#include +#include "dimensions/DataSpace.hpp" +#include "eventSystem/EventSystem.hpp" + +namespace PMacc +{ + +/*if this flag is defined all kernel calls would be checked and synchronize + * this flag must set by the compiler or inside of the Makefile + */ +#if (PMACC_SYNC_KERNEL == 1) + #define CUDA_CHECK_KERNEL_MSG(...) CUDA_CHECK_MSG(__VA_ARGS__) +#else + /*no synchronize and check of kernel calls*/ + #define CUDA_CHECK_KERNEL_MSG(...) ; +#endif + +/** Call activate kernel from taskKernel. + * If PMACC_SYNC_KERNEL is 1 cudaThreadSynchronize() is called before + * and after activation. + */ +#define PMACC_ACTIVATE_KERNEL \ + CUDA_CHECK_KERNEL_MSG(cudaThreadSynchronize(),"Crash after kernel call"); \ + taskKernel->activateChecks(); \ + CUDA_CHECK_KERNEL_MSG(cudaThreadSynchronize(),"Crash after kernel activation"); \ + +/** + * Appends kernel arguments to generated code and activates kernel task. + * + * @param ... parameters to pass to kernel + */ +#define PMACC_CUDAPARAMS(...) (__VA_ARGS__); \ + PMACC_ACTIVATE_KERNEL \ + } /*this is used if call is EventTask.waitforfinished();*/ + +/** + * Configures block and grid sizes and shared memory for the kernel. + * + * @param grid sizes of grid on gpu + * @param block sizes of block on gpu + * @param ... amount of shared memory for the kernel (optional) + */ +#define PMACC_CUDAKERNELCONFIG(grid,block,...) <<<(grid),(block), \ + /*we need +0 if VA_ARGS is empty, because we must put in a value*/ \ + __VA_ARGS__+0, \ + taskKernel->getCudaStream()>>> PMACC_CUDAPARAMS + +/** + * Calls a CUDA kernel and creates an EventTask which represents the kernel. + * + * @param kernelname name of the CUDA kernel (can also used with templates etc. myKernel<1>) + */ +#define __cudaKernel(kernelname) { \ + CUDA_CHECK_KERNEL_MSG(cudaThreadSynchronize(),"Crash before kernel call"); \ + TaskKernel *taskKernel = Factory::getInstance().createTaskKernel(#kernelname); \ + kernelname PMACC_CUDAKERNELCONFIG + +} + + +#endif //KERNELEVENTS_H + diff --git a/src/libPMacc/include/ppFunctions.hpp b/src/libPMacc/include/ppFunctions.hpp index 30afbb8d93..a46bed0aa7 100644 --- a/src/libPMacc/include/ppFunctions.hpp +++ b/src/libPMacc/include/ppFunctions.hpp @@ -20,8 +20,7 @@ */ -#ifndef PPFUNCTIONS_HPP -#define PPFUNCTIONS_HPP +#pragma once #define PMACC_MIN(x,y) (((x)<=(y))?x:y) @@ -34,5 +33,21 @@ #define PMACC_MAX_DO(what,x,y) (((x)>(y))?x what:y what) #define PMACC_MIN_DO(what,x,y) (((x)<(y))?x what:y what) -#endif /* PPFUNCTIONS_HPP */ +/** + * Returns number of args... arguments. + * + * Can only count values of ... which can be casted to int type. + * + * @param ... arguments + */ +#define PMACC_COUNT_ARGS(...) (sizeof((int[]){0, ##__VA_ARGS__})/sizeof(int)-1) +/** + * Check if ... has arguments or not + * + * Can only used if values of ... can be casted to int type + * + * @param ... arguments + * @return false if no arguments are given, else true + */ +#define PMACC_HAS_ARGS(...) ((sizeof((int[]){0, ##__VA_ARGS__}))==sizeof(int)?false:true) diff --git a/src/picongpu/include/simulation_classTypes.hpp b/src/picongpu/include/simulation_classTypes.hpp index 3e2bfcd29e..3cf3f1dfbf 100644 --- a/src/picongpu/include/simulation_classTypes.hpp +++ b/src/picongpu/include/simulation_classTypes.hpp @@ -49,9 +49,8 @@ namespace picongpu * * @param ... parameters to pass to kernel */ -#define PIC_PMACC_CUDAPARAMS(...) (__VA_ARGS__,mapper); \ - taskKernel->activateChecks(); \ - /* CUDA_CHECK(cudaThreadSynchronize());*/ \ +#define PIC_PMACC_CUDAPARAMS(...) (__VA_ARGS__,mapper); \ + PMACC_ACTIVATE_KERNEL \ } /*this is used if call is EventTask.waitforfinished();*/ /** @@ -62,8 +61,8 @@ namespace picongpu * @param block sizes of block on gpu * @param ... amount of shared memory for the kernel (optional) */ -#define PIC_PMACC_CUDAKERNELCONFIG(block,...) <<getCudaStream()>>> PIC_PMACC_CUDAPARAMS /** @@ -75,7 +74,8 @@ namespace picongpu * @param kernelname name of the CUDA kernel (can also used with templates etc. myKernnel<1>) * @param area area type for which the kernel is called */ -#define __picKernelArea(kernelname,description,area) { \ +#define __picKernelArea(kernelname,description,area) { \ + CUDA_CHECK_KERNEL_MSG(cudaThreadSynchronize(),"picKernelArea crash before kernel call"); \ AreaMapping mapper(description); \ TaskKernel *taskKernel = Factory::getInstance().createTaskKernel(#kernelname); \ kernelname PIC_PMACC_CUDAKERNELCONFIG From 8e4609e06ef258cb08a646e665131e65b26cd3b5 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Mon, 16 Sep 2013 15:20:41 +0200 Subject: [PATCH 32/54] Cleanup CmakeLists and require 2.8.5+ - rename deprecated variables: - MPI_INCLUDE_PATH -> MPI_C_INCLUDE_PATH - MPI_LIBRARIES -> MPI_C_LIBRARIES - HDF5_INCLUDE_DIR -> HDF5_INCLUDE_DIRS - System Libraries: - use SYSTEM property - LINK_DIRECTORIES is NOT necessary, since FIND_PACKAGE always returns absolute paths http://cmake.org/cmake/help/v2.8.11/cmake.html#command:link_directories - fix comment for CUDA_MATH - rename and invert variable DISBALE_COMPILER_FLAGS_IN_SUBPROJECTS to SAME_NVCC_FLAGS_IN_SUBPROJECTS - hdf5/libSplash - remove PIC_ENABLE_HDF5 Option and use HDF5_FOUND - check for splash.h and libsplash.a (update your libSplash installations!) - png output - remove PIC_ENABLE_PNG and see if we can find libPNGwriter - add freetype finder --- CMakeLists.txt | 2 +- src/cuda_memtest/CMakeLists.txt | 4 +- .../examples/gameOfLife2D/CMakeLists.txt | 2 +- src/mpiInfo/CMakeLists.txt | 4 +- src/picongpu/CMakeLists.txt | 97 ++++++++++--------- src/splash2txt/CMakeLists.txt | 2 +- 6 files changed, 56 insertions(+), 55 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a5d30b120..3b708272f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ # If not, see . # -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8.5) OPTION(VAMPIR_ENABLE "create picongpu with vampir support" OFF) diff --git a/src/cuda_memtest/CMakeLists.txt b/src/cuda_memtest/CMakeLists.txt index a03653f7ea..9709b935e8 100644 --- a/src/cuda_memtest/CMakeLists.txt +++ b/src/cuda_memtest/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8.5) # Projekt name @@ -22,7 +22,7 @@ FIND_PACKAGE(Threads REQUIRED) ##CUDA## -IF(NOT DISBALE_COMPILER_FLAGS_IN_SUBPROJECTS) +IF(SAME_NVCC_FLAGS_IN_SUBPROJECTS) SET(CUDA_ARCH sm_13 CACHE STRING "set GPU architecture" ) SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ${nvcc_flags} -arch=${CUDA_ARCH}) diff --git a/src/libPMacc/examples/gameOfLife2D/CMakeLists.txt b/src/libPMacc/examples/gameOfLife2D/CMakeLists.txt index 6ab1feb408..74350658af 100644 --- a/src/libPMacc/examples/gameOfLife2D/CMakeLists.txt +++ b/src/libPMacc/examples/gameOfLife2D/CMakeLists.txt @@ -19,7 +19,7 @@ # If not, see . # -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 2.8.5) OPTION(VAMPIR_ENABLE "create gameOfLife with vampir support" OFF) diff --git a/src/mpiInfo/CMakeLists.txt b/src/mpiInfo/CMakeLists.txt index d8d7589e57..77bd0b63bb 100644 --- a/src/mpiInfo/CMakeLists.txt +++ b/src/mpiInfo/CMakeLists.txt @@ -18,7 +18,7 @@ # If not, see . # -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8.5) # Projekt name @@ -55,4 +55,4 @@ target_link_libraries(mpiInfo ${LIBS} ${MPI_LIBRARIES}) # not necessary ${MPI_E #### INSTALLATION ##### INSTALL(TARGETS mpiInfo - RUNTIME DESTINATION bin) \ No newline at end of file + RUNTIME DESTINATION bin) diff --git a/src/picongpu/CMakeLists.txt b/src/picongpu/CMakeLists.txt index 810f29b9d7..5a25943c64 100644 --- a/src/picongpu/CMakeLists.txt +++ b/src/picongpu/CMakeLists.txt @@ -18,7 +18,7 @@ # If not, see . # -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8.5) OPTION(VAMPIR_ENABLE "create picongpu with vampir support" OFF) @@ -51,6 +51,8 @@ ENDIF(PIC_RELEASE) #include MPI FIND_PACKAGE(MPI REQUIRED) +INCLUDE_DIRECTORIES(SYSTEM ${MPI_C_INCLUDE_PATH}) +SET(LIBS ${LIBS} ${MPI_C_LIBRARIES}) #include pthreads FIND_PACKAGE(Threads REQUIRED) @@ -58,8 +60,7 @@ SET(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT}) #Boost from system FIND_PACKAGE(Boost REQUIRED COMPONENTS program_options regex) -INCLUDE_DIRECTORIES(AFTER ${Boost_INCLUDE_DIRS}) -LINK_DIRECTORIES(${Boost_LIBRARY_DIR}) +INCLUDE_DIRECTORIES(SYSTEM ${Boost_INCLUDE_DIRS}) SET(LIBS ${LIBS} ${Boost_LIBRARIES}) IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) @@ -77,7 +78,7 @@ IF( IS_CUDA_ARCH_SM13) SET(CUDA_FTZ "") ENDIF( IS_CUDA_ARCH_SM13) -SET(CUDA_MATH --use_fast_math CACHE STRING "set GPU architecture" ) +SET(CUDA_MATH --use_fast_math CACHE STRING "enable fast-math" ) OPTION(CUDA_SHOW_REGISTER "show kernel register and create PTX" OFF) OPTION(CUDA_KEEP_FILES "Keep all intermediate files that are generated during internal compilation steps. (folder: nvcc_tmp)" OFF) OPTION(CUDA_SHOW_CODELINES "show kernel lines in cuda-gdb and cuda-memcheck (need architecture >=sm_20)" OFF) @@ -123,8 +124,7 @@ ENDIF(PARAM_OVERWRITES) ####################################################### # load cuda_memtest project ####################################################### -SET(DISBALE_COMPILER_FLAGS_IN_SUBPROJECTS ON) - +SET(SAME_NVCC_FLAGS_IN_SUBPROJECTS OFF) find_path(CUDA_MEMTEST_DIR NAMES CMakeLists.txt PATHS "${CMAKE_CURRENT_SOURCE_DIR}/../cuda_memtest" @@ -151,27 +151,13 @@ add_subdirectory(${MPI_INFO_DIR} "${CMAKE_CURRENT_BINARY_DIR}/build_mpiInfo") SET(PIC_VERBOSE "1" CACHE STRING "set verbose level for picongpu (default is only physic output)") ADD_DEFINITIONS(-DPIC_VERBOSE_LVL=${PIC_VERBOSE}) -OPTION(PIC_ENABLE_HDF5 "create picongpu with hdf5 support" ON) -IF(PIC_ENABLE_HDF5) - ADD_DEFINITIONS(-DENABLE_HDF5=1) - FIND_PACKAGE(HDF5 REQUIRED) - INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIR}) - LINK_DIRECTORIES(${HDF5_LIBRARY_DIRS}) - SET(LIBS ${LIBS} hdf5) -ENDIF(PIC_ENABLE_HDF5) - -OPTION(PIC_ENABLE_PNG "create picongpu png output support (need pngwriter)" ON) -IF(PIC_ENABLE_PNG) - ADD_DEFINITIONS(-DPIC_ENABLE_PNG=1) -ENDIF(PIC_ENABLE_PNG) - OPTION(PIC_ENABLE_INSITU_VOLVIS "enable In Situ Volume Visualization" OFF) IF(PIC_ENABLE_INSITU_VOLVIS) ADD_DEFINITIONS(-DENABLE_INSITU_VOLVIS=1) SET(CUDA_ARCH sm_35 CACHE STRING "set GPU architecture") SET(IceT_DIR "$ENV{ICET_ROOT}/lib/") FIND_PACKAGE(IceT REQUIRED) - INCLUDE_DIRECTORIES(${ICET_INCLUDE_DIRS}) + INCLUDE_DIRECTORIES(SYSTEM ${ICET_INCLUDE_DIRS}) SET(LIBS ${LIBS} ${ICET_CORE_LIBS} ${ICET_MPI_LIBS}) ENDIF(PIC_ENABLE_INSITU_VOLVIS) @@ -202,46 +188,64 @@ find_path(PMACC_ROOT_DIR PATHS "${CMAKE_CURRENT_SOURCE_DIR}/../libPMacc" DOC "libPMacc root location." ) - INCLUDE_DIRECTORIES(${PMACC_ROOT_DIR}/include) #LIBSPLASH -IF(PIC_ENABLE_HDF5) - # find splash source code - find_path(PIC_SPLASH_ROOT_DIR - NAMES include/sdc_defines.hpp lib/libsplash.so - PATHS ENV SPLASH_ROOT - DOC "libsplash ROOT location. (only used if HDF5 is enabled)" + +FIND_PACKAGE(HDF5) +IF(HDF5_FOUND) + # find splash source code + find_path(PIC_SPLASH_ROOT_DIR + NAMES include/splash.h lib/libsplash.a + PATHS ENV SPLASH_ROOT + DOC "libsplash ROOT location. (only used if HDF5 is enabled)" ) + IF(PIC_SPLASH_ROOT_DIR) + MESSAGE(STATUS "Found Splash: "${PIC_SPLASH_ROOT_DIR}) + INCLUDE_DIRECTORIES(SYSTEM ${HDF5_INCLUDE_DIRS}) + ADD_DEFINITIONS(-DENABLE_HDF5=1) + #add include information - INCLUDE_DIRECTORIES(${PIC_SPLASH_ROOT_DIR}/include) + INCLUDE_DIRECTORIES(SYSTEM ${PIC_SPLASH_ROOT_DIR}/include) #add library information # dynamic / shared #LINK_DIRECTORIES("${PIC_SPLASH_ROOT_DIR}/lib") - #SET(LIBS ${LIBS} splash) + #SET(LIBS ${LIBS} splash ${HDF5_LIBRARIES}) + #target_link_libraries(splash hdf5) # static ADD_LIBRARY(splash_static STATIC IMPORTED) SET_TARGET_PROPERTIES(splash_static PROPERTIES IMPORTED_LOCATION ${PIC_SPLASH_ROOT_DIR}/lib/libsplash.a) - SET(LIBS ${LIBS} splash_static) -ENDIF(PIC_ENABLE_HDF5) + SET(LIBS ${LIBS} splash_static ${HDF5_LIBRARIES}) + ELSEIF(PIC_SPLASH_ROOT_DIR) + MESSAGE(STATUS "Could NOT find Splash") + ENDIF(PIC_SPLASH_ROOT_DIR) +ENDIF(HDF5_FOUND) #PNGWRITER -IF(PIC_ENABLE_PNG) - find_path(PIC_PNGWRITER_ROOT_DIR + +find_path(PIC_PNGWRITER_ROOT_DIR NAMES include/pngwriter.h PATHS ENV PNGWRITER_ROOT - DOC "pngwriter root location. (only used if PIC_ENABLE_PNG is enabled)" - ) -ENDIF(PIC_ENABLE_PNG) -IF(PIC_ENABLE_PNG) - INCLUDE_DIRECTORIES(${PIC_PNGWRITER_ROOT_DIR}/include /usr/include/freetype2/) + DOC "pngwriter root location.") +IF(PIC_PNGWRITER_ROOT_DIR) + MESSAGE(STATUS "Found PNGWriter: "${PIC_PNGWRITER_ROOT_DIR}) + ADD_DEFINITIONS(-DPIC_ENABLE_PNG=1) + INCLUDE_DIRECTORIES(SYSTEM ${PIC_PNGWRITER_ROOT_DIR}/include) LINK_DIRECTORIES(${PIC_PNGWRITER_ROOT_DIR}/lib) - SET(LIBS ${LIBS} png pngwriter freetype) -ENDIF(PIC_ENABLE_PNG) - -# check if PIC_EXTENSION_PATH is relativ or absolut + SET(LIBS ${LIBS} png pngwriter) + # freetype support enabled? + INCLUDE(FindFreetype) + IF(FREETYPE_FOUND) + INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIRS}) + SET(LIBS ${LIBS} ${FREETYPE_LIBRARIES}) + ENDIF(FREETYPE_FOUND) +ELSEIF(PIC_PNGWRITER_ROOT_DIR) + MESSAGE(STATUS "Could NOT find PNGWriter") +ENDIF(PIC_PNGWRITER_ROOT_DIR) + +# check if PIC_EXTENSION_PATH is relative or absolute find_path(PIC_EXTENSION_PATH NAMES include/simulation_defines/param/componentsConfig.param @@ -255,14 +259,11 @@ find_path(PIC_EXTENSION_PATH SET(PIC_COPY_ON_INSTALL "include/simulation_defines" "submit" CACHE LIST "folder which copied on install to install path" ) ################################################################################ -INCLUDE_DIRECTORIES(include ${MPI_INCLUDE_PATH} ${mpi_include_path}) +INCLUDE_DIRECTORIES(include) INCLUDE_DIRECTORIES(BEFORE ${PIC_EXTENSION_PATH}/include) ################################################################################ -set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ${INCLUDE_DIRECTORIES}) - - IF(VAMPIR_ENABLE) set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler=-finstrument-functions,-finstrument-functions-exclude-file-list=\\\"${CMAKE_CXX_INST_FILE_FILTER}\\\" -Xcompiler=-finstrument-functions-exclude-function-list=\\\"${CMAKE_CXX_INST_FUNC_FILTER}\\\" -Xcompiler=-DVTRACE -Xcompiler=-I/sw/xk6/vampirtrace/5.14.3-iofsl/cle4.1_gnu4.7.2//include/vampirtrace/ -v ) ENDIF(VAMPIR_ENABLE) @@ -280,7 +281,7 @@ IF(VAMPIR_ENABLE) SET(LIBS vt-hyb ${LIBS} ) ENDIF(VAMPIR_ENABLE) -target_link_libraries(picongpu ${LIBS} ${CUDA_CUDART_LIBRARY} z m ${MPI_LIBRARIES}) # not necessary ${MPI_EXTRA_LIBRARY} +target_link_libraries(picongpu ${LIBS} ${CUDA_CUDART_LIBRARY} z m) INSTALL(TARGETS picongpu diff --git a/src/splash2txt/CMakeLists.txt b/src/splash2txt/CMakeLists.txt index 725225dd6e..316117d8de 100644 --- a/src/splash2txt/CMakeLists.txt +++ b/src/splash2txt/CMakeLists.txt @@ -19,7 +19,7 @@ # If not, see . # -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8.5) project (splash2txt) set(CMAKE_PREFIX_PATH "/usr/lib/x86_64-linux-gnu/" "$ENV{BOOST_ROOT}" "$ENV{HDF5_ROOT}") From ff52199f4f8c34f62fb7b2053bd1bb4eb84f8dd7 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Mon, 16 Sep 2013 17:25:21 +0200 Subject: [PATCH 33/54] Doc: cmake 2.8.5+ --- doc/INSTALL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/INSTALL.md b/doc/INSTALL.md index 9204deeb07..a65a2762c6 100644 --- a/doc/INSTALL.md +++ b/doc/INSTALL.md @@ -17,7 +17,7 @@ Requirements - [full list](https://developer.nvidia.com/cuda-gpus) of CUDA GPUs and their *compute capability* - ([More](http://www.olcf.ornl.gov/titan/) is always better. Especially, if we are talking about GPUs.) -- **cmake** 2.8 or higher +- **cmake** 2.8.5 or higher - *Debian/Ubuntu:* `sudo apt-get install cmake file cmake-curses-gui` - **OpenMPI** 1.4 or higher From a247793a7e884174aac011d0c8fe893d3e35a364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Widera?= Date: Thu, 12 Sep 2013 15:22:37 +0200 Subject: [PATCH 34/54] rewrite algorithm::ForEach, solve dependencies - full rewrite of ForEach now call of operator(...) up to 4 arguments is allowed - HDF5Writer: add functor for TmpFields and other fields - energyDensity.kernel: change getUnit and getName to static --- src/libPMacc/include/algorithms/ForEach.hpp | 270 +++++++++++--- .../include/algorithms/accessors/First.hpp | 51 +++ .../include/algorithms/accessors/Identity.hpp | 50 +++ .../include/algorithms/accessors/Second.hpp | 51 +++ src/libPMacc/include/types.h | 289 ++++++++------- src/picongpu/include/fields/FieldTmp.hpp | 5 + .../initialization/InitialiserController.hpp | 6 +- .../particleToGrid/energyDensity.kernel | 21 +- .../include/plugins/output/HDF5Writer.hpp | 340 ++++++++---------- .../unitless/hdf5Output.unitless | 25 +- 10 files changed, 721 insertions(+), 387 deletions(-) create mode 100644 src/libPMacc/include/algorithms/accessors/First.hpp create mode 100644 src/libPMacc/include/algorithms/accessors/Identity.hpp create mode 100644 src/libPMacc/include/algorithms/accessors/Second.hpp diff --git a/src/libPMacc/include/algorithms/ForEach.hpp b/src/libPMacc/include/algorithms/ForEach.hpp index efb6a5ee38..6cbe5171ef 100644 --- a/src/libPMacc/include/algorithms/ForEach.hpp +++ b/src/libPMacc/include/algorithms/ForEach.hpp @@ -1,5 +1,5 @@ /** - * Copyright 2013 Axel Huebl, Heiko Burau, René Widera + * Copyright 2013 Axel Huebl, René Widera * * This file is part of libPMacc. * @@ -17,66 +17,244 @@ * You should have received a copy of the GNU General Public License * and the GNU Lesser General Public License along with libPMacc. * If not, see . - */ - + */ + #pragma once +#include "algorithms/accessors/Identity.hpp" + #include #include #include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +/* Help to read this file: + * - the definition of the operator() is outside of each class in a separate macro function + * - the definition of the struct ForEach in namespace datail is a macro function * + * - the macro definitions are inside of ####### TEXT ####### + */ + +#ifndef PMACC_MAX_FUNCTOR_OPERATOR_PARAMS +#define PMACC_MAX_FUNCTOR_OPERATOR_PARAMS 4 +#endif + +#ifndef PMACC_MAX_FUNCTOR_TEMPLATES +#define PMACC_MAX_FUNCTOR_TEMPLATES 4 +#endif namespace PMacc { namespace algorithms { -namespace forEach + +//########################### definitions for preprocessor ##################### +/** create operator() for EmptyFunctor + * + * template + * HDINLINE void operator()(const T0, ..., const TN ) const {}; + * + * All operator are empty and do nothing. + * The operator parameters are plain type-only (without a name) to support + * compiler flags like -Wextras (with -Wunused-params) + */ +#define PMACC_FOREACH_OPERATOR_CONST_NO_USAGE(Z, N, FUNCTIONS) \ + /* BOOST_PP_ENUM_PARAMS(N, typename T) is unrolled to \ + "typename T0, ... , typename TN" */ \ + template \ + /* BOOST_PP_ENUM_PARAMS(N, cont T) is unrolled to \ + "const T0, ... , cont TN" */ \ + HDINLINE void operator()( BOOST_PP_ENUM_PARAMS(N, const T)) const \ + { \ + }/*end of operator()*/ +//########################### end preprocessor definitions ##################### + +/** Empty functor class with operator() with N parameters + */ +struct EmptyFunctor { - namespace detail + + HDINLINE void operator()() const { - template< typename itA, typename itEnd, typename Accessor> - struct ForEach - { - typedef typename boost::mpl::next::type next; - - HDINLINE static void evaluate() - { - // execute the Accessor - Accessor::template evaluate< typename boost::mpl::deref::type >(); - - // go until itEnd - detail::ForEach::evaluate(); - } - }; - - template< typename itEnd, typename Accessor> - struct ForEach - { - HDINLINE static void evaluate() - { - } - }; - } // namespace detail - - /** Compile-Time for each for Boost::MPL Type Lists - * - * \tparam MPLTypeList A TypeList which can be accessed by begin, end, next - * \tparam Accessor A type that implements evaluate() as a - * static void member for HDINLINE + } + + /* N=PMACC_MAX_FUNCTOR_OPERATOR_PARAMS-1 + * create operator()(const T0 ,...,const TN) */ - template< typename MPLTypeList, typename Accessor > - struct ForEach + BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(PMACC_MAX_FUNCTOR_OPERATOR_PARAMS), + PMACC_FOREACH_OPERATOR_CONST_NO_USAGE, _) +}; + +/* delete all preprocessor defines to avoid conflicts in other files */ +#undef PMACC_FOREACH_OPERATOR_CONST_NO_USAGE + +namespace forEach +{ +namespace detail +{ + +template +struct ForEach; + +//########################### definition for preprocessor ###################### +/** create operator() for ForEach + * + * template + * HDINLINE void operator()(const T0 t0, ..., const TN tN) const {}; + */ +#define PMACC_FOREACH_OPERATOR_CONST(Z, N, _) \ + /* BOOST_PP_ENUM_PARAMS(N, typename T) is unrolled to \ + "typename T0, ... , typename TN" */ \ + template \ + /* BOOST_PP_ENUM_BINARY_PARAMS(N, T, const t) is unrolled to \ + "const T0 &t0, ... , const TN &tN" */ \ + HDINLINE void operator()( BOOST_PP_ENUM_BINARY_PARAMS(N, const T, &t)) const \ + { \ + /* BOOST_PP_ENUM_PARAMS(N, t) is unrolled to "t0, ..., tn" */ \ + FunctorType()(BOOST_PP_ENUM_PARAMS(N, t)); \ + NextCall()(BOOST_PP_ENUM_PARAMS(N, t)); \ + } /*end of operator()*/ + +/** write a comma (,)*/ +#define COMMA , +/** write word in text*/ +#define TEXT(Z, N, text) text +/** write comma then word in text and append N to text*/ +#define TEXTAPPEND(Z, N, text) COMMA text ## N + + +/** Create struct + * ForEach class Functor>{} + * + * \tparam Accessor A class with one template argument where ::type is defined. + * Accessor::type is called -> return type is given to Functor + * as T0. + * \tparam itBegin iterator to an element in a mpl sequence + * \tparam itEnd iterator to the end of a mpl sequence + * \tparam Functor A functor with a HDINLINE void operator()(...) method + * T0 can be any type and is substituted by types from MPLSeq. + * The maximum number of template parameters of the functor Functor is + * limited by PMACC_MAX_FUNCTOR_TEMPLATES. + * The maximum number of parameters for the operator() is limited by + * PMACC_MAX_FUNCTOR_OPERATOR_PARAMS + */ +#define PMACC_FOREACH_STRUCT(Z,N,_) \ +template< \ + template class Accessor, \ + typename AccessorType, \ + typename itBegin, \ + typename itEnd, \ + /* BOOST_PP_ENUM(N, TEXT,typename) is unrolled to \ + "typename , ... , typename " */ \ + template class Functor_, \ + /* BOOST_PP_ENUM_PARAMS(N, typename A) is unrolled to \ + "typename A0, ... , typename AN" */ \ + BOOST_PP_ENUM_PARAMS(N, typename A)> \ + /* BOOST_PP_ENUM_PARAMS(N, A) is unrolled to \ + "A0, ... , AN" */ \ +struct ForEach< Accessor, itBegin, itEnd, Functor_ > \ +{ \ + typedef typename boost::mpl::next::type nextIt; \ + typedef typename boost::mpl::deref::type usedType; \ + typedef typename boost::is_same::type isEnd; \ + /* BOOST_PP_ENUM_PARAMS(N, A) is unrolled to "A0, ... , AN" */ \ + typedef Functor_ FunctorUnchanged; \ + /* BOOST_PP_REPEAT_FROM_TO(1,N,TEXTAPPEND, A) is unrolled to \ + ",A1, ... , AN" \ + Nothing is done if N equal 0 \ + */ \ + typedef Functor_::type \ + BOOST_PP_REPEAT_FROM_TO(1,N,TEXTAPPEND, A) > FunctorType; \ + typedef detail::ForEach< Accessor, nextIt, itEnd, FunctorUnchanged > TmpNextCall; \ + /* if nextIt is equal to itEnd we use EmptyFunctor \ + and end recursive call of EachFunctor */ \ + typedef typename boost::mpl::if_< isEnd, \ + EmptyFunctor, \ + TmpNextCall>::type NextCall; \ + \ + HDINLINE void operator()() const \ + { \ + FunctorType()(); \ + NextCall()(); \ + } \ + /* N=PMACC_MAX_FUNCTOR_OPERATOR_PARAMS-1 \ + * create operator()(const T0 t0,...,const TN tN) \ + */ \ + BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(PMACC_MAX_FUNCTOR_OPERATOR_PARAMS), \ + PMACC_FOREACH_OPERATOR_CONST, _) \ +}; /*end of struct ForEach*/ + +//########################### end preprocessor definitions ##################### + +/* N = PMACC_MAX_FUNCTOR_TEMPLATES-1 + * create struct definitions ForEach + * \see PMACC_FOREACH_STRUCT + */ +BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(PMACC_MAX_FUNCTOR_TEMPLATES), PMACC_FOREACH_STRUCT, _) + + +/* delete all preprocessor defines to avoid conflicts in other files */ +#undef PMACC_FOREACH_STRUCT +#undef COMMA +#undef TEXT +#undef TEXTAPPEND + +} // namespace detail + +/** Compile-Time for each for Boost::MPL Type Lists + * + * \tparam MPLSeq A mpl sequence that can be accessed by mpl::begin, mpl::end, mpl::next + * \tparam Functor A functor with a HDINLINE void operator()(...) method + * T0 can be any type and is substituted by types from MPLSeq. + * The maximum number of template parameters of the functor Functor is + * limited by PMACC_MAX_FUNCTOR_TEMPLATES. + * The maximum number of parameters for the operator() is limited by + * PMACC_MAX_FUNCTOR_OPERATOR_PARAMS + * \tparam Accessor A class with one template argument where ::type is defined. + * Accessor::type is called -> return type is given to Functor + * as T0. + * + */ +template > +struct ForEach +{ + typedef typename boost::mpl::begin::type begin; + typedef typename boost::mpl::end< MPLSeq>::type end; + + typedef typename boost::is_same::type isEnd; + typedef detail::ForEach TmpNextCall; + /* if MPLSeq is empty we use EmptyFunctor */ + typedef typename boost::mpl::if_::type NextCall; + typedef EmptyFunctor FunctorType; + + HDINLINE void operator()() const { - HDINLINE void operator()( ) const - { - typedef typename boost::mpl::begin::type begin; - typedef typename boost::mpl::end< MPLTypeList>::type end; - - return detail::ForEach::evaluate(); - } - }; - + FunctorType()(); + NextCall()(); + } + + /* N=PMACC_MAX_FUNCTOR_OPERATOR_PARAMS-1 + * create operator()(const T0 t0,...,const TN tN) + */ + BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(PMACC_MAX_FUNCTOR_OPERATOR_PARAMS), + PMACC_FOREACH_OPERATOR_CONST, _) +}; + +/* delete all preprocessor defines to avoid conflicts in other files */ +#undef PMACC_FOREACH_OPERATOR_CONST + } // namespace forEach } // namespace algorithms -} // namespace PMacc \ No newline at end of file +} // namespace PMacc diff --git a/src/libPMacc/include/algorithms/accessors/First.hpp b/src/libPMacc/include/algorithms/accessors/First.hpp new file mode 100644 index 0000000000..6b6acc21bf --- /dev/null +++ b/src/libPMacc/include/algorithms/accessors/First.hpp @@ -0,0 +1,51 @@ +/** + * Copyright 2013 René Widera + * + * This file is part of libPMacc. + * + * libPMacc is free software: you can redistribute it and/or modify + * it under the terms of of either the GNU General Public License or + * the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * libPMacc is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License and the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License + * and the GNU Lesser General Public License along with libPMacc. + * If not, see . + */ + + +#pragma once + +#include "types.h" + +namespace PMacc +{ +namespace algorithms +{ + +namespace accessors +{ + +/** Get first type of the given type + * + * \tparam T type from which we return the first held type + * + * T must have defined ::first + */ +template +struct First +{ + typedef typename T::first type; +}; + +}//namespace accessors + +}//namespace algorithms + +}//namepsace PMacc diff --git a/src/libPMacc/include/algorithms/accessors/Identity.hpp b/src/libPMacc/include/algorithms/accessors/Identity.hpp new file mode 100644 index 0000000000..ef7eac8b49 --- /dev/null +++ b/src/libPMacc/include/algorithms/accessors/Identity.hpp @@ -0,0 +1,50 @@ +/** + * Copyright 2013 René Widera + * + * This file is part of libPMacc. + * + * libPMacc is free software: you can redistribute it and/or modify + * it under the terms of of either the GNU General Public License or + * the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * libPMacc is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License and the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License + * and the GNU Lesser General Public License along with libPMacc. + * If not, see . + */ + + +#pragma once + +#include "types.h" + +namespace PMacc +{ +namespace algorithms +{ + +namespace accessors +{ + +/** Get the type of a given type without changes + * + * \tparam T in type + * + */ +template +struct Identity +{ + typedef T type; +}; + +}//namespace accessors + +}//namespace algorithms + +}//namepsace PMacc diff --git a/src/libPMacc/include/algorithms/accessors/Second.hpp b/src/libPMacc/include/algorithms/accessors/Second.hpp new file mode 100644 index 0000000000..d3e16c489b --- /dev/null +++ b/src/libPMacc/include/algorithms/accessors/Second.hpp @@ -0,0 +1,51 @@ +/** + * Copyright 2013 René Widera + * + * This file is part of libPMacc. + * + * libPMacc is free software: you can redistribute it and/or modify + * it under the terms of of either the GNU General Public License or + * the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * libPMacc is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License and the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License + * and the GNU Lesser General Public License along with libPMacc. + * If not, see . + */ + + +#pragma once + +#include "types.h" + +namespace PMacc +{ +namespace algorithms +{ + +namespace accessors +{ + +/** Get second type of the given type + * + * \tparam T type from which we return the second held type + * + * T must have defined ::second + */ +template +struct Second +{ + typedef typename T::second type; +}; + +}//namespace accessors + +}//namespace algorithms + +}//namepsace PMacc diff --git a/src/libPMacc/include/types.h b/src/libPMacc/include/types.h index 8ea3659909..dd341f7897 100644 --- a/src/libPMacc/include/types.h +++ b/src/libPMacc/include/types.h @@ -17,139 +17,156 @@ * You should have received a copy of the GNU General Public License * and the GNU Lesser General Public License along with libPMacc. * If not, see . - */ - -#pragma once - -#include -#include -#include -#include -#include - -#include "boost/typeof/std/utility.hpp" -#include "debug/PMaccVerbose.hpp" - -#define BOOST_MPL_LIMIT_VECTOR_SIZE 20 - -#define PMACC_AUTO_TPL(var,...) BOOST_AUTO_TPL(var,(__VA_ARGS__)) -#define PMACC_AUTO(var,...) BOOST_AUTO(var,(__VA_ARGS__)) - -namespace PMacc -{ - -//short name for access verbose types of libPMacc -typedef PMaccVerbose ggLog; - -typedef uint64_t id_t; -typedef unsigned long long int uint64_cu; -typedef long long int int64_cu; - -#define BOOST_MPL_LIMIT_VECTOR_SIZE 20 - -#define HDINLINE __device__ __host__ __forceinline__ -#define DINLINE __device__ __forceinline__ -#define HINLINE __host__ inline - -/** - * Bitmask which describes the direction of communication. - * - * Bitmasks may be combined logically, e.g. LEFT+TOP = TOPLEFT. - * It is not possible to combine complementary masks (e.g. FRONT and BACK), - * as a bitmask always defines one direction of communication (send or receive). - */ -enum ExchangeType -{ - RIGHT = 1u, LEFT = 2u, BOTTOM = 3u, TOP = 6u, BACK = 9u, FRONT = 18u // 3er-System -}; - -#define MAX_EXCHANGE_TYPE FRONT + TOP + LEFT - -/** - * Defines number of dimensions (1-3) - */ -/*enum Dim -{ - DIM1 = 1u, DIM2 = 2u, DIM3 = 3u -};*/ - -#define DIM1 1u -#define DIM2 2u -#define DIM3 3u - -/** - * Internal event/task type used for notifications in the event system. - */ -enum EventType -{ - FINISHED, COPYHOST2DEVICE, COPYDEVICE2HOST, COPYDEVICE2DEVICE, SENDFINISHED, RECVFINISHED, LOGICALAND, SETVALUE, GETVALUE, KERNEL -}; - - -/** - * Captures CUDA errors and prints messages to stdout, including line number and file. - * - * @param cmd command with cudaError_t return value to check - */ -#define CUDA_CHECK(cmd) {cudaError_t error = cmd; if(error!=cudaSuccess){std::cerr<<"<"<<__FILE__<<">:"<<__LINE__<:"<<__LINE__<:%i ",__FILE__,__LINE__);}} -/** - * Converts an ExchangeType into a bitmask - * - * e.g. converts BOTTOM to "0000 0100" - * - * @param edge_type value from enum ExchangeType to convert - */ -#define EDGE_TO_MASK(edge_type) (1u<<(edge_type)) - -/** - * Returns if edge_type is set in a bitmask - * - * e.g. mask="0000 1110", edge_type=BOTTOM, makro returns 2 (true) - * - * @param mask bitmask which represents an edge direction - * @param edge_type Edge_Type to query - * @return false (0) if ExchangeType bit is not set, true otherwise (!=0) - */ -#define IS_EDGE_SET(mask,edge_type) ((EDGE_TO_MASK((edge_type)))&(mask)) - -#define TO_BITS(x) (~((-1) << (x))) - - -/* calculate and set the optimal alignment for data - * you must align all array and structs which can used on device - * @param byte byte of data which must aligned - */ -#define __optimal_align__(byte) \ - __align__( \ - ((byte)==1?1: \ - ((byte)<=2?2: \ - ((byte)<=4?4: \ - ((byte)<=8?8: \ - ((byte)<=16?16: \ - ((byte)<=32?32: \ - ((byte)<=64?64:128 \ - )))))))) - -#define PMACC_ALIGN(var,...) __optimal_align__(sizeof(__VA_ARGS__)) __VA_ARGS__ var -#define PMACC_ALIGN8(var,...) __align__(8) __VA_ARGS__ var - -/*! area which is calculated - * - * CORE is the inner area of a grid - * BORDER is the border of a grid (my own border, not the neighbor part) - */ -enum AreaType -{ - CORE = 1u, BORDER = 2u, GUARD = 4u -}; - -#define __delete(var) if((var)) { delete (var); var=NULL; } - -} - - - + */ + +#pragma once + +#include +#include +#include +#include +#include + +#include "boost/typeof/std/utility.hpp" +#include "debug/PMaccVerbose.hpp" + +#define BOOST_MPL_LIMIT_VECTOR_SIZE 20 + +#define PMACC_AUTO_TPL(var,...) BOOST_AUTO_TPL(var,(__VA_ARGS__)) +#define PMACC_AUTO(var,...) BOOST_AUTO(var,(__VA_ARGS__)) + +namespace PMacc +{ + +//short name for access verbose types of libPMacc +typedef PMaccVerbose ggLog; + +typedef uint64_t id_t; +typedef unsigned long long int uint64_cu; +typedef long long int int64_cu; + +#define BOOST_MPL_LIMIT_VECTOR_SIZE 20 + +#define HDINLINE __device__ __host__ __forceinline__ +#define DINLINE __device__ __forceinline__ +#define HINLINE __host__ inline + +/* + * Disable nvcc warning: + * calling a __host__ function from __host__ __device__ function. + * + * Usage: + * PMACC_NO_NVCC_HDWARNING + * HDINLINE function_declaration() + * + * It is not possible to disable the warning for a __host__ function + * if there are calls of virtual functions inside. For this case use a wrapper + * function. + * WARNING: only use this method if there is no other way to create runable code. + * Most cases can solved by #ifdef __CUDA_ARCH__ or #ifdef __CUDACC__. + */ +#if defined(__CUDACC__) +#define PMACC_NO_NVCC_HDWARNING #pragma hd_warning_disable +#else +#define PMACC_NO_NVCC_HDWARNING +#endif + +/** + * Bitmask which describes the direction of communication. + * + * Bitmasks may be combined logically, e.g. LEFT+TOP = TOPLEFT. + * It is not possible to combine complementary masks (e.g. FRONT and BACK), + * as a bitmask always defines one direction of communication (send or receive). + */ +enum ExchangeType +{ + RIGHT = 1u, LEFT = 2u, BOTTOM = 3u, TOP = 6u, BACK = 9u, FRONT = 18u // 3er-System +}; + +#define MAX_EXCHANGE_TYPE FRONT + TOP + LEFT + +/** + * Defines number of dimensions (1-3) + */ +/*enum Dim +{ + DIM1 = 1u, DIM2 = 2u, DIM3 = 3u +};*/ + +#define DIM1 1u +#define DIM2 2u +#define DIM3 3u + +/** + * Internal event/task type used for notifications in the event system. + */ +enum EventType +{ + FINISHED, COPYHOST2DEVICE, COPYDEVICE2HOST, COPYDEVICE2DEVICE, SENDFINISHED, RECVFINISHED, LOGICALAND, SETVALUE, GETVALUE, KERNEL +}; + + +/** + * Captures CUDA errors and prints messages to stdout, including line number and file. + * + * @param cmd command with cudaError_t return value to check + */ +#define CUDA_CHECK(cmd) {cudaError_t error = cmd; if(error!=cudaSuccess){std::cerr<<"<"<<__FILE__<<">:"<<__LINE__<:"<<__LINE__<:%i ",__FILE__,__LINE__);}} +/** + * Converts an ExchangeType into a bitmask + * + * e.g. converts BOTTOM to "0000 0100" + * + * @param edge_type value from enum ExchangeType to convert + */ +#define EDGE_TO_MASK(edge_type) (1u<<(edge_type)) + +/** + * Returns if edge_type is set in a bitmask + * + * e.g. mask="0000 1110", edge_type=BOTTOM, makro returns 2 (true) + * + * @param mask bitmask which represents an edge direction + * @param edge_type Edge_Type to query + * @return false (0) if ExchangeType bit is not set, true otherwise (!=0) + */ +#define IS_EDGE_SET(mask,edge_type) ((EDGE_TO_MASK((edge_type)))&(mask)) + +#define TO_BITS(x) (~((-1) << (x))) + + +/* calculate and set the optimal alignment for data + * you must align all array and structs which can used on device + * @param byte byte of data which must aligned + */ +#define __optimal_align__(byte) \ + __align__( \ + ((byte)==1?1: \ + ((byte)<=2?2: \ + ((byte)<=4?4: \ + ((byte)<=8?8: \ + ((byte)<=16?16: \ + ((byte)<=32?32: \ + ((byte)<=64?64:128 \ + )))))))) + +#define PMACC_ALIGN(var,...) __optimal_align__(sizeof(__VA_ARGS__)) __VA_ARGS__ var +#define PMACC_ALIGN8(var,...) __align__(8) __VA_ARGS__ var + +/*! area which is calculated + * + * CORE is the inner area of a grid + * BORDER is the border of a grid (my own border, not the neighbor part) + */ +enum AreaType +{ + CORE = 1u, BORDER = 2u, GUARD = 4u +}; + +#define __delete(var) if((var)) { delete (var); var=NULL; } + +} //namepsace PMacc diff --git a/src/picongpu/include/fields/FieldTmp.hpp b/src/picongpu/include/fields/FieldTmp.hpp index f0a2a083a7..2d228e40c9 100644 --- a/src/picongpu/include/fields/FieldTmp.hpp +++ b/src/picongpu/include/fields/FieldTmp.hpp @@ -57,6 +57,11 @@ namespace picongpu typedef MappingDesc::SuperCellSize SuperCellSize; typedef DataBox > DataBoxType; + + MappingDesc getCelDescription() + { + return this->cellDescription; + } FieldTmp( MappingDesc cellDescription ); diff --git a/src/picongpu/include/initialization/InitialiserController.hpp b/src/picongpu/include/initialization/InitialiserController.hpp index c03c5c572f..62a9aff239 100644 --- a/src/picongpu/include/initialization/InitialiserController.hpp +++ b/src/picongpu/include/initialization/InitialiserController.hpp @@ -107,9 +107,9 @@ class InitialiserController : public IInitModule #if (ENABLE_HDF5==1) // check for HDF5 restart capability - typedef typename boost::mpl::find::type itFindFieldE; - typedef typename boost::mpl::find::type itFindFieldB; - typedef typename boost::mpl::end< hdf5OutputFields>::type itEnd; + typedef typename boost::mpl::find::type itFindFieldE; + typedef typename boost::mpl::find::type itFindFieldB; + typedef typename boost::mpl::end< Hdf5OutputFields>::type itEnd; const bool restartImpossible = (boost::is_same::value) || (boost::is_same::value); if( restartImpossible ) diff --git a/src/picongpu/include/particles/particleToGrid/energyDensity.kernel b/src/picongpu/include/particles/particleToGrid/energyDensity.kernel index 2c7775e992..bbdb919f2b 100644 --- a/src/picongpu/include/particles/particleToGrid/energyDensity.kernel +++ b/src/picongpu/include/particles/particleToGrid/energyDensity.kernel @@ -69,31 +69,34 @@ namespace picongpu if( calcType == ComputeEnergyDensityOptions::calcDensity ) return UNIT_CHARGE / UNIT_VOLUME; - + else if( calcType == ComputeEnergyDensityOptions::calcEnergy ) return UNIT_ENERGY; - + else if( calcType == ComputeEnergyDensityOptions::calcEnergyDensity ) return UNIT_CHARGE / UNIT_VOLUME * UNIT_ENERGY; - + else if( calcType == ComputeEnergyDensityOptions::calcCounter ) return NUM_EL_PER_PARTICLE; - - return 1.0; + else + return 1.0; } - - HDINLINE std::string getName( ) const + + HINLINE std::string getName( ) const { if( calcType == ComputeEnergyDensityOptions::calcDensity ) return "fields_Density"; + else if( calcType == ComputeEnergyDensityOptions::calcEnergy ) return "fields_ParticleEnergy"; + else if( calcType == ComputeEnergyDensityOptions::calcEnergyDensity ) return "fields_EnergyDensity"; + else if( calcType == ComputeEnergyDensityOptions::calcCounter ) return "fields_ParticleCounter"; - - return "fields_FieldTmp"; + else + return "fields_FieldTmp"; } template diff --git a/src/picongpu/include/plugins/output/HDF5Writer.hpp b/src/picongpu/include/plugins/output/HDF5Writer.hpp index 7dd4140f77..e4b36fe93c 100644 --- a/src/picongpu/include/plugins/output/HDF5Writer.hpp +++ b/src/picongpu/include/plugins/output/HDF5Writer.hpp @@ -16,8 +16,8 @@ * You should have received a copy of the GNU General Public License * along with PIConGPU. * If not, see . - */ - + */ + #ifndef HDF5WRITER_HPP @@ -67,6 +67,9 @@ #include #include +#include "RefWrapper.hpp" +#include + namespace picongpu { @@ -77,52 +80,14 @@ namespace bmpl = boost::mpl; namespace po = boost::program_options; -namespace hdf5Helper +struct PhysField { - template< typename T > - struct getName - { - template< typename Solver, typename Species > - static std::string evaluate( ) - { - return T::getName( ); - } - }; - - template< > - struct getName - { - template< typename Solver, typename Species > - static std::string evaluate( ) - { - std::stringstream str; - str << FieldTmp::getName( ); - str << "_"; - str << Species::FrameType::getName( ); - return str.str(); - } - }; - - template< typename T > - struct getUnit - { - template< typename Solver > - static typename T::UnitValueType evaluate( ) - { - return T::getUnit( ); - } - }; - - template< > - struct getUnit - { - template< typename Solver > - static typename FieldTmp::UnitValueType evaluate( ) - { - return FieldTmp::getUnit( ); - } - }; -} // namespace hdf5Helper + void* ptrField; + std::string nameField; + int numCompoField; + std::vector unitField; + GridLayout gridLayout; +}; /** * Writes simulation data to hdf5 files. @@ -138,7 +103,7 @@ class HDF5Writer : public ISimulationIO, public IPluginModule private: typedef bmpl::vector< PositionFilter3D<> > usedFilters; typedef typename FilterFactory::FilterType MyParticleFilter; - + #if (ENABLE_ELECTRONS == 1) typedef FrameContainer, MappingDesc::SuperCellSize, MyParticleFilter> MyFrameContainerE; @@ -152,7 +117,9 @@ class HDF5Writer : public ISimulationIO, public IPluginModule typedef typename MyFrameContainerI::ParticleType MyBigFrameI; #endif - typedef struct + MyParticleFilter filter; + + struct ThreadParams { uint32_t currentStep; DCollector::DomainCollector *dataCollector; @@ -166,75 +133,140 @@ class HDF5Writer : public ISimulationIO, public IPluginModule #endif VirtualWindow window; - } ThreadParams; - + }; + + template + static std::vector createUnit(UnitType unit, uint32_t numComponents) + { + std::vector tmp(numComponents); + for (uint i = 0; i < numComponents; ++i) + tmp[i] = unit[i]; + return tmp; + } + + template< typename T > struct getDCFields { - struct PhysField + private: + + static std::string getName() { - void* ptrField; - std::string nameField; - int numCompoField; - std::vector unitField; - }; - - template< typename T > - HDINLINE static void evaluate( ) + return T::getName(); + } + + static std::vector getUnit() { -#if !defined(__CUDA_ARCH__) // Host code path - DataConnector &dc = DataConnector::getInstance( ); + typedef typename T::UnitValueType UnitType; + UnitType unit = T::getUnit(); + return createUnit(unit, T::numComponents); + } - T* field = &( dc.getData ( T::getCommTag( ) ) ); - gridLayout = field->getGridLayout( ); - - /// \todo loop with for each over all FieldTmp Solvers - // - //const bool isFieldTmp = boost::is_same::value; - //const int numTmpSolvers = bmpl::size::type::value; - typedef typename bmpl::at_c::type thisSolverPair; - typedef typename thisSolverPair::first thisSolver; - typedef typename thisSolverPair::second thisSpecies; + public: + HDINLINE void operator()(RefWrapper params) + { +#ifndef __CUDA_ARCH__ + DCollector::ColTypeFloat ctFloat; PhysField thisField; - thisField.numCompoField = T::numComponents; - thisField.ptrField = field->getHostDataBox( ).getPointer( ); - thisField.nameField = - hdf5Helper::getName::template evaluate(); + DataConnector &dc = DataConnector::getInstance(); + + T* field = &(dc.getData (T::getCommTag())); + thisField.gridLayout = field->getGridLayout(); + params.get()->gridLayout = thisField.gridLayout; - thisField.unitField.resize( thisField.numCompoField, 0.0 ); - for( int i = 0; i < thisField.numCompoField; ++i ) - thisField.unitField.at( i ) = - hdf5Helper::getUnit::template evaluate()[i]; + writeField(params.get(), + ctFloat, + T::numComponents, + getName(), + getUnit(), + field->getHostDataBox().getPointer()); - physFields.push_back( thisField ); + dc.releaseData(T::getCommTag()); #endif } - - static void clear( ) - { - physFields.clear( ); - // gridLayout = ? - } - static std::list physFields; - static PMacc::GridLayout gridLayout; }; - - struct releaseDCFields + + template< typename ThisSolver, typename ThisSpecies > + struct getDCFields > { - template< typename T > - HDINLINE static void evaluate( ) + + /* + * This is only a wrapper function to allow disable nvcc warnings. + * Warning: calling a __host__ function from __host__ __device__ + * function. + * Use of PMACC_NO_NVCC_HDWARNING is not possible if we call a virtual + * method inside of the method were we disable the warnings. + * Therefore we create this method and call a new method were we can + * call virtual functions. + */ + PMACC_NO_NVCC_HDWARNING + HDINLINE void operator()(RefWrapper tparam) { -#if !defined(__CUDA_ARCH__) // Host code path - DataConnector &dc = DataConnector::getInstance( ); + this->operator_impl(tparam); + } + private: + + template< typename Solver, typename Species > + static std::string getName() + { + std::stringstream str; + str << FieldTmp::getName(); + str << "_"; + str << Species::FrameType::getName(); + return str.str(); + } + + template + static std::vector getUnit() + { + typedef typename FieldTmp::UnitValueType UnitType; + UnitType unit = FieldTmp::getUnit(); + return createUnit(unit, FieldTmp::numComponents); + } + + HINLINE void operator_impl(RefWrapper params) + { + + PhysField thisField; + DCollector::ColTypeFloat ctFloat; + + DataConnector &dc = DataConnector::getInstance(); + + /*## update field ##*/ - dc.releaseData( T::getCommTag( ) ); -#endif + /*load FieldTmp without copy data to host*/ + FieldTmp* fieldTmp = &(dc.getData (FIELD_TMP, true)); + /*load particle without copy particle data to host*/ + ThisSpecies* speciesTmp = &(dc.getData(ThisSpecies::FrameType::CommunicationTag, true)); + + fieldTmp->getGridBuffer().getDeviceBuffer().setValue(FieldTmp::ValueType(0.0)); + /*run algorithm*/ + fieldTmp->computeValue < CORE + BORDER, ThisSolver > (*speciesTmp, params.get()->currentStep); + + EventTask fieldTmpEvent = fieldTmp->asyncCommunication(__getTransactionEvent()); + __setTransactionEvent(fieldTmpEvent); + /* copy data to host that we can write same to disk*/ + fieldTmp->getGridBuffer().deviceToHost(); + dc.releaseData(ThisSpecies::FrameType::CommunicationTag); + /*## finish update field ##*/ + + thisField.gridLayout = fieldTmp->getGridLayout(); + params.get()->gridLayout = thisField.gridLayout; + + writeField(params.get(), + ctFloat, + FieldTmp::numComponents, + getName(), + getUnit(), + fieldTmp->getHostDataBox().getPointer()); + + dc.releaseData(FIELD_TMP); + } + }; - - MyParticleFilter filter; public: @@ -272,47 +304,12 @@ class HDF5Writer : public ISimulationIO, public IPluginModule this->cellDescription = cellDescription; } - void notify(uint32_t currentStep) + __host__ void notify(uint32_t currentStep) { - - DataConnector &dc = DataConnector::getInstance(); mThreadParams.currentStep = currentStep; mThreadParams.gridPosition = SubGrid::getInstance().getSimulationBox().getGlobalOffset(); - - /// \todo Calculate more then first element of hdf5TmpFields - /// Move this to writeHDF5 method - typedef typename bmpl::find::type itFindFieldTmp; - typedef typename bmpl::end< hdf5OutputFields>::type itEnd; - const bool containsFieldTmp = ! (boost::is_same::value); - - if( containsFieldTmp ) - { - typedef typename bmpl::at_c::type thisSolverPair; - typedef typename thisSolverPair::first thisSolver; - typedef typename thisSolverPair::second thisSpecies; - - DataConnector &dc = DataConnector::getInstance(); - FieldTmp* fieldTmp = &(dc.getData (FIELD_TMP, true)); - thisSpecies* speciesTmp = &(dc.getData( thisSpecies::FrameType::CommunicationTag )); - - fieldTmp->getGridBuffer().getDeviceBuffer().setValue( FieldTmp::ValueType( 0.0 ) ); - fieldTmp->computeValue< CORE + BORDER, thisSolver >( *speciesTmp, currentStep ); - - EventTask fieldTmpEvent = fieldTmp->asyncCommunication(__getTransactionEvent()); - __setTransactionEvent(fieldTmpEvent); - - dc.releaseData( thisSpecies::FrameType::CommunicationTag ); - } - - // synchronize simulation data with DataConnector - getDCFields::clear( ); - ForEach forEachGetFields; - forEachGetFields(); - - mThreadParams.gridLayout = getDCFields::gridLayout; - this->filter.setStatus(false); mThreadParams.window = MovingWindow::getInstance().getVirtualWindow(currentStep); @@ -372,7 +369,7 @@ class HDF5Writer : public ISimulationIO, public IPluginModule void openH5File() { const uint32_t maxOpenFilesPerNode = 4; - mThreadParams.dataCollector = new DCollector::DomainCollector( maxOpenFilesPerNode ); + mThreadParams.dataCollector = new DCollector::DomainCollector(maxOpenFilesPerNode); // set attributes for datacollector files DCollector::DataCollector::FileCreationAttr attr; @@ -461,13 +458,16 @@ class HDF5Writer : public ISimulationIO, public IPluginModule static void writeField(ThreadParams *params, DCollector::CollectionType& colType, const uint32_t dims, const std::string name, std::vector unit, void *ptr) { + log ("HDF5 write field: %1% %2% %3%") % + name % dims % ptr; + std::vector name_lookup; { const std::string name_lookup_tpl[] = {"x", "y", "z", "w"}; - for( uint32_t d = 0; d < dims; d++ ) - name_lookup.push_back( name_lookup_tpl[d] ); + for (uint32_t d = 0; d < dims; d++) + name_lookup.push_back(name_lookup_tpl[d]); } - + GridLayout field_layout = params->gridLayout; DataSpace field_full = field_layout.getDataSpace(); DataSpace field_no_guard = params->window.localSize; //field_layout.getDataSpaceWithoutGuarding(); @@ -507,7 +507,7 @@ class HDF5Writer : public ISimulationIO, public IPluginModule { std::stringstream str; str << name; - if ( dims > 1 ) + if (dims > 1) str << "_" << name_lookup.at(d); params->dataCollector->writeDomain(params->currentStep, colType, DIM, @@ -523,7 +523,7 @@ class HDF5Writer : public ISimulationIO, public IPluginModule params->dataCollector->writeAttribute(params->currentStep, DCollector::ColTypeDim(), str.str().c_str(), "sim_size", &sim_size); params->dataCollector->writeAttribute(params->currentStep, DCollector::ColTypeDim(), str.str().c_str(), "sim_global_offset", &sim_global_offset); - params->dataCollector->writeAttribute(params->currentStep, ctDouble, str.str().c_str(), "sim_unit", &( unit.at(d) )); + params->dataCollector->writeAttribute(params->currentStep, ctDouble, str.str().c_str(), "sim_unit", &(unit.at(d))); } } } @@ -708,28 +708,14 @@ class HDF5Writer : public ISimulationIO, public IPluginModule // synchronize, because following operations will be blocking anyway ThreadParams *threadParams = (ThreadParams*) (p_args); + /*print all fields*/ + ForEach > forEachGetFields; + forEachGetFields(ref(threadParams)); + // write fields /// \todo this should be a type trait DCollector::ColTypeFloat ctFloat; - - // iterators for fields - typename std::list::iterator itFields; - - for( itFields = getDCFields::physFields.begin(); - itFields != getDCFields::physFields.end(); - ++itFields ) - { - log ("HDF5 write field: %1% %2% %3%") % - itFields->nameField % itFields->numCompoField % itFields->ptrField; - - writeField( threadParams, - ctFloat, - itFields->numCompoField, - itFields->nameField, - itFields->unitField, - itFields->ptrField ); - } - + // write particles DataSpace sim_offset = threadParams->gridPosition - threadParams->window.globalSimulationOffset; DataSpace localOffset = threadParams->window.localOffset; @@ -740,14 +726,14 @@ class HDF5Writer : public ISimulationIO, public IPluginModule writeParticles (threadParams, threadParams->frameContainerE, sim_offset, localSize, sim_offset, - ElectronsBuffer::FrameType::getName( ) ); + ElectronsBuffer::FrameType::getName()); #endif #if (ENABLE_IONS == 1) threadParams->frameContainerI->getFilter().setWindowPosition(localOffset, localSize); writeParticles (threadParams, threadParams->frameContainerI, sim_offset, localSize, sim_offset, - IonsBuffer::FrameType::getName( ) ); + IonsBuffer::FrameType::getName()); #endif if (MovingWindow::getInstance().isSlidingWindowActive()) { @@ -770,11 +756,11 @@ class HDF5Writer : public ISimulationIO, public IPluginModule threadParams->frameContainerE->getFilter().setWindowPosition(localOffset, localSize); std::stringstream strNameTopE; strNameTopE << "_top_"; - strNameTopE << ElectronsBuffer::FrameType::getName( ); + strNameTopE << ElectronsBuffer::FrameType::getName(); writeParticles (threadParams, container, sim_offset, localSize, DataSpace (), - strNameTopE.str( ) ); + strNameTopE.str()); #endif #if (ENABLE_IONS == 1) PMACC_AUTO(containerI, threadParams->frameContainerI); @@ -784,11 +770,11 @@ class HDF5Writer : public ISimulationIO, public IPluginModule threadParams->frameContainerI->getFilter().setWindowPosition(localOffset, localSize); std::stringstream strNameTopI; strNameTopI << "_top_"; - strNameTopI << IonsBuffer::FrameType::getName( ); + strNameTopI << IonsBuffer::FrameType::getName(); writeParticles (threadParams, containerI, sim_offset, localSize, DataSpace (), - strNameTopI.str( ) ); + strNameTopI.str()); #endif sim_offset = threadParams->gridPosition; @@ -811,11 +797,11 @@ class HDF5Writer : public ISimulationIO, public IPluginModule localSize); std::stringstream strNameBottomE; strNameBottomE << "_bottom_"; - strNameBottomE << ElectronsBuffer::FrameType::getName( ); + strNameBottomE << ElectronsBuffer::FrameType::getName(); writeParticles (threadParams, containerBottom, sim_offset, localSize, DataSpace (), - strNameBottomE.str( ) ); + strNameBottomE.str()); #endif #if (ENABLE_IONS == 1) PMACC_AUTO(containerBottomI, threadParams->frameContainerI); @@ -826,11 +812,11 @@ class HDF5Writer : public ISimulationIO, public IPluginModule localSize); std::stringstream strNameBottomI; strNameBottomI << "_bottom_"; - strNameBottomI << IonsBuffer::FrameType::getName( ); + strNameBottomI << IonsBuffer::FrameType::getName(); writeParticles (threadParams, containerBottomI, sim_offset, localSize, DataSpace (), - strNameBottomI.str( ) ); + strNameBottomI.str()); #endif } @@ -838,10 +824,6 @@ class HDF5Writer : public ISimulationIO, public IPluginModule DataConnector &dc = DataConnector::getInstance(); - - // release field data - ForEach forEachFieldRelease; - forEachFieldRelease(); // release particle data #if (ENABLE_ELECTRONS == 1) @@ -868,16 +850,6 @@ class HDF5Writer : public ISimulationIO, public IPluginModule }; - -// init static member variables -template -std::list::getDCFields::PhysField> -HDF5Writer::getDCFields::physFields; - -template -PMacc::GridLayout -HDF5Writer::getDCFields::gridLayout; - } #endif /* HDF5WRITER_HPP */ diff --git a/src/picongpu/include/simulation_defines/unitless/hdf5Output.unitless b/src/picongpu/include/simulation_defines/unitless/hdf5Output.unitless index 65176629bc..9e43d43a05 100644 --- a/src/picongpu/include/simulation_defines/unitless/hdf5Output.unitless +++ b/src/picongpu/include/simulation_defines/unitless/hdf5Output.unitless @@ -34,13 +34,15 @@ #include "particles/particleToGrid/energyDensity.kernel" +#include "particles/boostExtension/JoinVectors.hpp" + namespace picongpu { /** Note: you will need at least FieldE and FieldB for restart * capability! - * Possible fields: FieldE, FieldB, FieldJ, FieldTmp + * Possible fields: FieldE, FieldB, FieldJ */ - typedef boost::mpl::vector hdf5OutputFields; + typedef boost::mpl::vector NativeHdf5OutputFields; /** TimeAvg Fields * \todo Reduce/Avg on host-side RAM with an analyser @@ -65,13 +67,18 @@ namespace picongpu ComputeEnergyDensityOptions::calcCounter > TmpParticleCounter; - /** \warning Only uses the 1st argument right now - * \todo implement loop through each argument - */ + typedef boost::mpl::vector< - boost::mpl::pair< TmpParticleDensity, PIC_Electrons > /*, +#if (ENABLE_ELECTRONS == 1) + boost::mpl::pair< TmpParticleDensity, PIC_Electrons > , + boost::mpl::pair< TmpParticleEnergyDensity, PIC_Electrons > +#endif +#if (ENABLE_IONS == 1) boost::mpl::pair< TmpParticleDensity, PIC_Ions >, - boost::mpl::pair< TmpParticleEnergyDensity, PIC_Electrons >, - boost::mpl::pair< TmpParticleEnergyDensity, PIC_Ions >*/ - > hdf5TmpFields; + boost::mpl::pair< TmpParticleEnergyDensity, PIC_Ions > +#endif + > PluginsHdf5OutputFields; + + + typedef JoinVectors::type Hdf5OutputFields; } From d6adc020fc4e3f4a93ff9bc2944a3e72bcc11b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Widera?= Date: Sat, 14 Sep 2013 11:17:28 +0200 Subject: [PATCH 35/54] add documentation to HDF5 functors --- src/picongpu/include/plugins/output/HDF5Writer.hpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/picongpu/include/plugins/output/HDF5Writer.hpp b/src/picongpu/include/plugins/output/HDF5Writer.hpp index e4b36fe93c..3d9d7c3571 100644 --- a/src/picongpu/include/plugins/output/HDF5Writer.hpp +++ b/src/picongpu/include/plugins/output/HDF5Writer.hpp @@ -145,7 +145,7 @@ class HDF5Writer : public ISimulationIO, public IPluginModule } template< typename T > - struct getDCFields + struct GetDCFields { private: @@ -188,8 +188,13 @@ class HDF5Writer : public ISimulationIO, public IPluginModule }; + /** Calculate FieldTmp with given solver and particle species + * and write them to hdf5. + * + * If we get a pir + */ template< typename ThisSolver, typename ThisSpecies > - struct getDCFields > + struct GetDCFields > { /* @@ -709,7 +714,7 @@ class HDF5Writer : public ISimulationIO, public IPluginModule ThreadParams *threadParams = (ThreadParams*) (p_args); /*print all fields*/ - ForEach > forEachGetFields; + ForEach > forEachGetFields; forEachGetFields(ref(threadParams)); // write fields From 147f16ded027323a6a7504ebf2b2d7a02588b22a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Widera?= Date: Mon, 16 Sep 2013 11:28:19 +0200 Subject: [PATCH 36/54] update comments, add explicit type for FieldTmp operations - add struct FieldTmpOperation whose used to define a solver for a species. - HDF5Writer.hpp: delete getName() in for default field functor --- .../include/plugins/output/HDF5Writer.hpp | 28 +++++++++---------- .../unitless/hdf5Output.unitless | 25 ++++++++++++++--- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/src/picongpu/include/plugins/output/HDF5Writer.hpp b/src/picongpu/include/plugins/output/HDF5Writer.hpp index 3d9d7c3571..cc1bf70aad 100644 --- a/src/picongpu/include/plugins/output/HDF5Writer.hpp +++ b/src/picongpu/include/plugins/output/HDF5Writer.hpp @@ -20,8 +20,7 @@ -#ifndef HDF5WRITER_HPP -#define HDF5WRITER_HPP +#pragma once #include #include @@ -144,16 +143,15 @@ class HDF5Writer : public ISimulationIO, public IPluginModule return tmp; } + + /** Write calculated fields to HDF5 file. + * + */ template< typename T > struct GetDCFields { private: - static std::string getName() - { - return T::getName(); - } - static std::vector getUnit() { typedef typename T::UnitValueType UnitType; @@ -178,7 +176,7 @@ class HDF5Writer : public ISimulationIO, public IPluginModule writeField(params.get(), ctFloat, T::numComponents, - getName(), + T::getName(), getUnit(), field->getHostDataBox().getPointer()); @@ -191,10 +189,10 @@ class HDF5Writer : public ISimulationIO, public IPluginModule /** Calculate FieldTmp with given solver and particle species * and write them to hdf5. * - * If we get a pir + * FieldTmp is calculated on device and than dumped to HDF5. */ template< typename ThisSolver, typename ThisSpecies > - struct GetDCFields > + struct GetDCFields > { /* @@ -212,7 +210,8 @@ class HDF5Writer : public ISimulationIO, public IPluginModule this->operator_impl(tparam); } private: - + /** Create a name for the hdf5 identifier. + */ template< typename Solver, typename Species > static std::string getName() { @@ -223,6 +222,7 @@ class HDF5Writer : public ISimulationIO, public IPluginModule return str.str(); } + /** Get the unit for the result from the solver*/ template static std::vector getUnit() { @@ -259,7 +259,7 @@ class HDF5Writer : public ISimulationIO, public IPluginModule thisField.gridLayout = fieldTmp->getGridLayout(); params.get()->gridLayout = thisField.gridLayout; - + /*write data to HDF5 file*/ writeField(params.get(), ctFloat, FieldTmp::numComponents, @@ -855,7 +855,5 @@ class HDF5Writer : public ISimulationIO, public IPluginModule }; -} - -#endif /* HDF5WRITER_HPP */ +} //namepsace picongpu diff --git a/src/picongpu/include/simulation_defines/unitless/hdf5Output.unitless b/src/picongpu/include/simulation_defines/unitless/hdf5Output.unitless index 9e43d43a05..b8f1c6e38c 100644 --- a/src/picongpu/include/simulation_defines/unitless/hdf5Output.unitless +++ b/src/picongpu/include/simulation_defines/unitless/hdf5Output.unitless @@ -67,18 +67,35 @@ namespace picongpu ComputeEnergyDensityOptions::calcCounter > TmpParticleCounter; + + /** Define which operation is used to fill up FieldTmp + * + * This is better than use of boost::mtl::pair because + * we can use this special struct to define functors + * only for FieldTmp. If we create a second FieldTmp, for example + * with three components, we can create a new struct (like this) + * and build a special functor to handle the type. + */ + template + struct TmpFieldOperation + { + typedef TSolver Solver; + typedef TSpecies Species; + }; + /** List of solver which use TmpField*/ typedef boost::mpl::vector< #if (ENABLE_ELECTRONS == 1) - boost::mpl::pair< TmpParticleDensity, PIC_Electrons > , - boost::mpl::pair< TmpParticleEnergyDensity, PIC_Electrons > + TmpFieldOperation< TmpParticleDensity, PIC_Electrons > , + TmpFieldOperation< TmpParticleEnergyDensity, PIC_Electrons > #endif #if (ENABLE_IONS == 1) - boost::mpl::pair< TmpParticleDensity, PIC_Ions >, - boost::mpl::pair< TmpParticleEnergyDensity, PIC_Ions > + TmpFieldOperation< TmpParticleDensity, PIC_Ions >, + TmpFieldOperation< TmpParticleEnergyDensity, PIC_Ions > #endif > PluginsHdf5OutputFields; + /** This list is use to dump fields to HDf5. */ typedef JoinVectors::type Hdf5OutputFields; } From c71e4632fe4c9b20114932e2fcbfbe0ec612bad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Widera?= Date: Mon, 16 Sep 2013 11:38:33 +0200 Subject: [PATCH 37/54] add Heiko Burau to copyright list - it was a wrong delete in a previous commit --- src/libPMacc/include/algorithms/ForEach.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libPMacc/include/algorithms/ForEach.hpp b/src/libPMacc/include/algorithms/ForEach.hpp index 6cbe5171ef..27ea4f8c2a 100644 --- a/src/libPMacc/include/algorithms/ForEach.hpp +++ b/src/libPMacc/include/algorithms/ForEach.hpp @@ -1,5 +1,5 @@ /** - * Copyright 2013 Axel Huebl, René Widera + * Copyright 2013 Axel Huebl, Heiko Burau, René Widera * * This file is part of libPMacc. * From 3c8ed4fb6d364299b0bec1a7c00b0ea22a364205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Widera?= Date: Mon, 16 Sep 2013 16:56:20 +0200 Subject: [PATCH 38/54] fix compile time error in examples with ions and electrons --- .../simulation_defines/unitless/hdf5Output.unitless | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/picongpu/include/simulation_defines/unitless/hdf5Output.unitless b/src/picongpu/include/simulation_defines/unitless/hdf5Output.unitless index b8f1c6e38c..0371985091 100644 --- a/src/picongpu/include/simulation_defines/unitless/hdf5Output.unitless +++ b/src/picongpu/include/simulation_defines/unitless/hdf5Output.unitless @@ -83,19 +83,26 @@ namespace picongpu typedef TSpecies Species; }; - /** List of solver which use TmpField*/ + /** List of solver which use TmpField and electons*/ typedef boost::mpl::vector< #if (ENABLE_ELECTRONS == 1) TmpFieldOperation< TmpParticleDensity, PIC_Electrons > , TmpFieldOperation< TmpParticleEnergyDensity, PIC_Electrons > #endif + > PluginsHdf5OutputFieldsElectrons; + + /** List of solver which use TmpField andions*/ + typedef boost::mpl::vector< #if (ENABLE_IONS == 1) TmpFieldOperation< TmpParticleDensity, PIC_Ions >, TmpFieldOperation< TmpParticleEnergyDensity, PIC_Ions > #endif - > PluginsHdf5OutputFields; + > PluginsHdf5OutputFieldsIons; /** This list is use to dump fields to HDf5. */ - typedef JoinVectors::type Hdf5OutputFields; + typedef JoinVectors::type Hdf5OutputFields; } From 821f0f478534e07aaa044ced9c3568c18ade42a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Widera?= Date: Tue, 17 Sep 2013 12:54:49 +0200 Subject: [PATCH 39/54] fix explanatory notes for pull request - add FieldTmp.def with definition of class FieldTmp and FieldTmpOperation - delete struct PhysField in Hdf5Writer.hpp - fix typo in FieldTmp.hpp --- src/picongpu/include/fields/FieldTmp.def | 48 +++++++++++++++++++ src/picongpu/include/fields/FieldTmp.hpp | 3 +- .../include/plugins/output/HDF5Writer.hpp | 21 ++------ .../unitless/hdf5Output.unitless | 34 ++++--------- 4 files changed, 63 insertions(+), 43 deletions(-) create mode 100644 src/picongpu/include/fields/FieldTmp.def diff --git a/src/picongpu/include/fields/FieldTmp.def b/src/picongpu/include/fields/FieldTmp.def new file mode 100644 index 0000000000..51fe14efbb --- /dev/null +++ b/src/picongpu/include/fields/FieldTmp.def @@ -0,0 +1,48 @@ +/** + * Copyright 2013 René Widera, Axel Huebl + * + * This file is part of PIConGPU. + * + * PIConGPU is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PIConGPU is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PIConGPU. + * If not, see + */ + +#pragma once + +#include "simulation_defines.hpp" + +namespace picongpu +{ + + /** Define which operation is used to fill up FieldTmp + * + * This is better than use of boost::mtl::pair because + * we can use this special struct to define functors + * only for FieldTmp. If we create a second FieldTmp, for example + * with three components, we can create a new struct (like this) + * and build a special functor to handle the type. + */ + template + struct FieldTmpOperation + { + typedef TSolver Solver; + typedef TSpecies Species; + }; + + /** Tmp (at the moment: scalar) field for analysers and tmp data like + * "gridded" particle data (charge density, energy density, ...) + */ + class FieldTmp; + +}//namespace picongpu diff --git a/src/picongpu/include/fields/FieldTmp.hpp b/src/picongpu/include/fields/FieldTmp.hpp index 2d228e40c9..f6c4bc75ed 100644 --- a/src/picongpu/include/fields/FieldTmp.hpp +++ b/src/picongpu/include/fields/FieldTmp.hpp @@ -26,6 +26,7 @@ /*pic default*/ #include "types.h" +#include "fields/FieldTmp.def" #include "simulation_defines.hpp" #include "simulation_classTypes.hpp" @@ -58,7 +59,7 @@ namespace picongpu typedef MappingDesc::SuperCellSize SuperCellSize; typedef DataBox > DataBoxType; - MappingDesc getCelDescription() + MappingDesc getCellDescription() { return this->cellDescription; } diff --git a/src/picongpu/include/plugins/output/HDF5Writer.hpp b/src/picongpu/include/plugins/output/HDF5Writer.hpp index cc1bf70aad..bedd740988 100644 --- a/src/picongpu/include/plugins/output/HDF5Writer.hpp +++ b/src/picongpu/include/plugins/output/HDF5Writer.hpp @@ -42,6 +42,7 @@ #include "fields/FieldB.hpp" #include "fields/FieldE.hpp" #include "fields/FieldJ.hpp" +#include "fields/FieldTmp.def" #include "fields/FieldTmp.hpp" #include "particles/particleFilter/FilterFactory.hpp" #include "particles/particleFilter/PositionFilter.hpp" @@ -79,15 +80,6 @@ namespace bmpl = boost::mpl; namespace po = boost::program_options; -struct PhysField -{ - void* ptrField; - std::string nameField; - int numCompoField; - std::vector unitField; - GridLayout gridLayout; -}; - /** * Writes simulation data to hdf5 files. * Implements the ISimulationIO interface. @@ -142,7 +134,6 @@ class HDF5Writer : public ISimulationIO, public IPluginModule tmp[i] = unit[i]; return tmp; } - /** Write calculated fields to HDF5 file. * @@ -165,13 +156,11 @@ class HDF5Writer : public ISimulationIO, public IPluginModule { #ifndef __CUDA_ARCH__ DCollector::ColTypeFloat ctFloat; - PhysField thisField; DataConnector &dc = DataConnector::getInstance(); T* field = &(dc.getData (T::getCommTag())); - thisField.gridLayout = field->getGridLayout(); - params.get()->gridLayout = thisField.gridLayout; + params.get()->gridLayout = field->getGridLayout(); writeField(params.get(), ctFloat, @@ -192,7 +181,7 @@ class HDF5Writer : public ISimulationIO, public IPluginModule * FieldTmp is calculated on device and than dumped to HDF5. */ template< typename ThisSolver, typename ThisSpecies > - struct GetDCFields > + struct GetDCFields > { /* @@ -234,7 +223,6 @@ class HDF5Writer : public ISimulationIO, public IPluginModule HINLINE void operator_impl(RefWrapper params) { - PhysField thisField; DCollector::ColTypeFloat ctFloat; DataConnector &dc = DataConnector::getInstance(); @@ -257,8 +245,7 @@ class HDF5Writer : public ISimulationIO, public IPluginModule dc.releaseData(ThisSpecies::FrameType::CommunicationTag); /*## finish update field ##*/ - thisField.gridLayout = fieldTmp->getGridLayout(); - params.get()->gridLayout = thisField.gridLayout; + params.get()->gridLayout =fieldTmp->getGridLayout(); /*write data to HDF5 file*/ writeField(params.get(), ctFloat, diff --git a/src/picongpu/include/simulation_defines/unitless/hdf5Output.unitless b/src/picongpu/include/simulation_defines/unitless/hdf5Output.unitless index 0371985091..ff98c42fc2 100644 --- a/src/picongpu/include/simulation_defines/unitless/hdf5Output.unitless +++ b/src/picongpu/include/simulation_defines/unitless/hdf5Output.unitless @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with PIConGPU. * If not, see . - */ + */ @@ -28,7 +28,7 @@ #include "fields/FieldE.hpp" #include "fields/FieldB.hpp" #include "fields/FieldJ.hpp" -#include "fields/FieldTmp.hpp" +#include "fields/FieldTmp.def" #include "particles/Species.hpp" @@ -66,36 +66,20 @@ namespace picongpu particleShape::Counter::ChargeAssignment, ComputeEnergyDensityOptions::calcCounter > TmpParticleCounter; - - - /** Define which operation is used to fill up FieldTmp - * - * This is better than use of boost::mtl::pair because - * we can use this special struct to define functors - * only for FieldTmp. If we create a second FieldTmp, for example - * with three components, we can create a new struct (like this) - * and build a special functor to handle the type. - */ - template - struct TmpFieldOperation - { - typedef TSolver Solver; - typedef TSpecies Species; - }; - /** List of solver which use TmpField and electons*/ + /** List of solvers which use TmpField and electons*/ typedef boost::mpl::vector< #if (ENABLE_ELECTRONS == 1) - TmpFieldOperation< TmpParticleDensity, PIC_Electrons > , - TmpFieldOperation< TmpParticleEnergyDensity, PIC_Electrons > + FieldTmpOperation< TmpParticleDensity, PIC_Electrons > , + FieldTmpOperation< TmpParticleEnergyDensity, PIC_Electrons > #endif > PluginsHdf5OutputFieldsElectrons; - /** List of solver which use TmpField andions*/ + /** List of solvers which use TmpField and ions*/ typedef boost::mpl::vector< #if (ENABLE_IONS == 1) - TmpFieldOperation< TmpParticleDensity, PIC_Ions >, - TmpFieldOperation< TmpParticleEnergyDensity, PIC_Ions > + FieldTmpOperation< TmpParticleDensity, PIC_Ions >, + FieldTmpOperation< TmpParticleEnergyDensity, PIC_Ions > #endif > PluginsHdf5OutputFieldsIons; @@ -104,5 +88,5 @@ namespace picongpu typedef JoinVectors::type Hdf5OutputFields; + >::type Hdf5OutputFields; } From 0930b85113477777a908ac04829ae5cb82c2adc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Widera?= Date: Tue, 17 Sep 2013 19:12:18 +0200 Subject: [PATCH 40/54] update and fix comments - use short notation description to descripe BOOST_PP commands - fix same wrong documentation --- src/libPMacc/include/algorithms/ForEach.hpp | 60 ++++++++++----------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/src/libPMacc/include/algorithms/ForEach.hpp b/src/libPMacc/include/algorithms/ForEach.hpp index 27ea4f8c2a..20031cf546 100644 --- a/src/libPMacc/include/algorithms/ForEach.hpp +++ b/src/libPMacc/include/algorithms/ForEach.hpp @@ -64,18 +64,16 @@ namespace algorithms /** create operator() for EmptyFunctor * * template - * HDINLINE void operator()(const T0, ..., const TN ) const {}; + * HDINLINE void operator()(const T0, ..., const TN ) const {} * * All operator are empty and do nothing. * The operator parameters are plain type-only (without a name) to support * compiler flags like -Wextras (with -Wunused-params) */ #define PMACC_FOREACH_OPERATOR_CONST_NO_USAGE(Z, N, FUNCTIONS) \ - /* BOOST_PP_ENUM_PARAMS(N, typename T) is unrolled to \ - "typename T0, ... , typename TN" */ \ + /* */ \ template \ - /* BOOST_PP_ENUM_PARAMS(N, cont T) is unrolled to \ - "const T0, ... , cont TN" */ \ + /* ( const T0, ... , cont TN ) */ \ HDINLINE void operator()( BOOST_PP_ENUM_PARAMS(N, const T)) const \ { \ }/*end of operator()*/ @@ -90,8 +88,10 @@ struct EmptyFunctor { } - /* N=PMACC_MAX_FUNCTOR_OPERATOR_PARAMS-1 - * create operator()(const T0 ,...,const TN) + /* N=PMACC_MAX_FUNCTOR_OPERATOR_PARAMS + * create: + * template + * void operator()(const T0 ,...,const TN){} */ BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(PMACC_MAX_FUNCTOR_OPERATOR_PARAMS), PMACC_FOREACH_OPERATOR_CONST_NO_USAGE, _) @@ -112,18 +112,17 @@ struct ForEach; /** create operator() for ForEach * * template - * HDINLINE void operator()(const T0 t0, ..., const TN tN) const {}; + * HDINLINE void operator()(const T0 t0, ..., const TN tN) const {} */ #define PMACC_FOREACH_OPERATOR_CONST(Z, N, _) \ - /* BOOST_PP_ENUM_PARAMS(N, typename T) is unrolled to \ - "typename T0, ... , typename TN" */ \ + /* */ \ template \ - /* BOOST_PP_ENUM_BINARY_PARAMS(N, T, const t) is unrolled to \ - "const T0 &t0, ... , const TN &tN" */ \ + /* ( const T0& t0, ... , const TN& tN ) */ \ HDINLINE void operator()( BOOST_PP_ENUM_BINARY_PARAMS(N, const T, &t)) const \ { \ - /* BOOST_PP_ENUM_PARAMS(N, t) is unrolled to "t0, ..., tn" */ \ + /* (t0, ..., tn ) */ \ FunctorType()(BOOST_PP_ENUM_PARAMS(N, t)); \ + /* (t0, ..., tn ) */ \ NextCall()(BOOST_PP_ENUM_PARAMS(N, t)); \ } /*end of operator()*/ @@ -135,8 +134,9 @@ struct ForEach; #define TEXTAPPEND(Z, N, text) COMMA text ## N -/** Create struct - * ForEach class Functor>{} +/** Create: + * struct ForEach + * class Functor>{} * * \tparam Accessor A class with one template argument where ::type is defined. * Accessor::type is called -> return type is given to Functor @@ -156,26 +156,21 @@ template< \ typename AccessorType, \ typename itBegin, \ typename itEnd, \ - /* BOOST_PP_ENUM(N, TEXT,typename) is unrolled to \ - "typename , ... , typename " */ \ + /* */ \ template class Functor_, \ - /* BOOST_PP_ENUM_PARAMS(N, typename A) is unrolled to \ - "typename A0, ... , typename AN" */ \ + /* typename A0, ... , typename AN */ \ BOOST_PP_ENUM_PARAMS(N, typename A)> \ - /* BOOST_PP_ENUM_PARAMS(N, A) is unrolled to \ - "A0, ... , AN" */ \ -struct ForEach< Accessor, itBegin, itEnd, Functor_ > \ + /* */ \ +struct ForEach< Accessor, itBegin, itEnd, Functor_ > \ { \ typedef typename boost::mpl::next::type nextIt; \ typedef typename boost::mpl::deref::type usedType; \ typedef typename boost::is_same::type isEnd; \ - /* BOOST_PP_ENUM_PARAMS(N, A) is unrolled to "A0, ... , AN" */ \ + /* */ \ typedef Functor_ FunctorUnchanged; \ - /* BOOST_PP_REPEAT_FROM_TO(1,N,TEXTAPPEND, A) is unrolled to \ - ",A1, ... , AN" \ - Nothing is done if N equal 0 \ - */ \ typedef Functor_::type \ + /* Nothing is done if N equal 1 \ + ,A1, ... , AN */ \ BOOST_PP_REPEAT_FROM_TO(1,N,TEXTAPPEND, A) > FunctorType; \ typedef detail::ForEach< Accessor, nextIt, itEnd, FunctorUnchanged > TmpNextCall; \ /* if nextIt is equal to itEnd we use EmptyFunctor \ @@ -189,7 +184,8 @@ struct ForEach< Accessor, itBegin, itEnd, Functor_ \ * create operator()(const T0 t0,...,const TN tN) \ */ \ BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(PMACC_MAX_FUNCTOR_OPERATOR_PARAMS), \ @@ -198,8 +194,9 @@ struct ForEach< Accessor, itBegin, itEnd, Functor_ +/* N = PMACC_MAX_FUNCTOR_TEMPLATES + * create: + * struct definitions ForEach{} * \see PMACC_FOREACH_STRUCT */ BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(PMACC_MAX_FUNCTOR_TEMPLATES), PMACC_FOREACH_STRUCT, _) @@ -245,7 +242,8 @@ struct ForEach NextCall()(); } - /* N=PMACC_MAX_FUNCTOR_OPERATOR_PARAMS-1 + /* N=PMACC_MAX_FUNCTOR_OPERATOR_PARAMS + * template * create operator()(const T0 t0,...,const TN tN) */ BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(PMACC_MAX_FUNCTOR_OPERATOR_PARAMS), From b7bd99b81951b44160811475df94910b389e4b6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Widera?= Date: Wed, 18 Sep 2013 14:55:56 +0200 Subject: [PATCH 41/54] close #48,clean up code,add new math::pow function - move basisLib/vector/Vector.tpp to math/vector/Vector.tpp (trait definitions) - delete old folder basisLib - fix all dependencies - add specialization for float (C++98 standard) - add specialization for pow(vector,scalar) - add comments for better overview of specializations --- src/libPMacc/include/algorithms/math.hpp | 3 + .../include/algorithms/math/floatMath/pow.tpp | 77 ++++++++++ .../include/basisLib/vector/Vector.hpp | 28 ---- src/libPMacc/include/math/Vector.hpp | 18 +-- .../{basisLib => math}/vector/Vector.tpp | 134 +++++------------- .../particles/memory/frames/BigFrame.hpp | 2 +- .../particles/memory/frames/BorderFrame.hpp | 2 +- .../particles/memory/frames/CoreFrame.hpp | 2 +- src/picongpu/include/fields/FieldB.hpp | 2 +- src/picongpu/include/fields/FieldE.hpp | 2 +- src/picongpu/include/fields/FieldJ.hpp | 2 +- .../species/default/ParticlesData.hpp | 2 +- .../unitless/precision.unitless | 2 +- 13 files changed, 134 insertions(+), 142 deletions(-) create mode 100644 src/libPMacc/include/algorithms/math/floatMath/pow.tpp delete mode 100644 src/libPMacc/include/basisLib/vector/Vector.hpp rename src/libPMacc/include/{basisLib => math}/vector/Vector.tpp (73%) diff --git a/src/libPMacc/include/algorithms/math.hpp b/src/libPMacc/include/algorithms/math.hpp index d8125dfc54..5b44317594 100644 --- a/src/libPMacc/include/algorithms/math.hpp +++ b/src/libPMacc/include/algorithms/math.hpp @@ -31,17 +31,20 @@ #include "algorithms/math/defines/dot.hpp" #include "algorithms/math/defines/comparison.hpp" #include "algorithms/math/defines/floatingPoint.hpp" +#include "algorithms/math/defines/pow.hpp" #include "algorithms/math/floatMath/abs.tpp" #include "algorithms/math/floatMath/sqrt.tpp" #include "algorithms/math/floatMath/exp.tpp" #include "algorithms/math/floatMath/trigo.tpp" #include "algorithms/math/floatMath/floatingPoint.tpp" +#include "algorithms/math/floatMath/pow.tpp" #include "algorithms/math/doubleMath/abs.tpp" #include "algorithms/math/doubleMath/sqrt.tpp" #include "algorithms/math/doubleMath/exp.tpp" #include "algorithms/math/doubleMath/trigo.tpp" #include "algorithms/math/doubleMath/floatingPoint.tpp" +#include "algorithms/math/doubleMath/pow.tpp" diff --git a/src/libPMacc/include/algorithms/math/floatMath/pow.tpp b/src/libPMacc/include/algorithms/math/floatMath/pow.tpp new file mode 100644 index 0000000000..8dcaf2813b --- /dev/null +++ b/src/libPMacc/include/algorithms/math/floatMath/pow.tpp @@ -0,0 +1,77 @@ +/** + * Copyright 2013 René Widera + * + * This file is part of libPMacc. + * + * libPMacc is free software: you can redistribute it and/or modify + * it under the terms of of either the GNU General Public License or + * the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * libPMacc is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License and the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License + * and the GNU Lesser General Public License along with libPMacc. + * If not, see . + */ + + +#pragma once + +#include "types.h" +#include /*provide host version of pow*/ + +namespace PMacc +{ +namespace algorithms +{ +namespace math +{ +namespace detail +{ + +/*C++98 standard define a separate version for int and float exponent*/ + +template<> +struct Pow +{ + typedef float result; + + HDINLINE result operator()(const float& base, const float& exponent) + { +#ifdef __CUDA_ARCH__ /*device version*/ + return ::powf(base, exponent); +#else + return ::pow(base, exponent); +#endif + + } +}; + +template<> +struct Pow +{ + typedef float result; + + HDINLINE result operator()(const float& base,const int& exponent) + { +#ifdef __CUDA_ARCH__ /*device version*/ + return ::powf(base, exponent); +#else + return ::pow(base, exponent); +#endif + + } +}; + + +} //namespace detail +} //namespace math +} //namespace algorithms +} // namespace PMacc + + diff --git a/src/libPMacc/include/basisLib/vector/Vector.hpp b/src/libPMacc/include/basisLib/vector/Vector.hpp deleted file mode 100644 index 9c828df6c0..0000000000 --- a/src/libPMacc/include/basisLib/vector/Vector.hpp +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2013 Heiko Burau, René Widera - * - * This file is part of libPMacc. - * - * libPMacc is free software: you can redistribute it and/or modify - * it under the terms of of either the GNU General Public License or - * the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * libPMacc is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License and the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License - * and the GNU Lesser General Public License along with libPMacc. - * If not, see . - */ - -#pragma once - -#include "types.h" -#include -#include - -#include "basisLib/vector/Vector.tpp" diff --git a/src/libPMacc/include/math/Vector.hpp b/src/libPMacc/include/math/Vector.hpp index 708b79f37e..546f62ba80 100644 --- a/src/libPMacc/include/math/Vector.hpp +++ b/src/libPMacc/include/math/Vector.hpp @@ -21,11 +21,13 @@ #pragma once -#include "vector/Vector.hpp" -#include "vector/Int.hpp" -#include "vector/UInt.hpp" -#include "vector/Size_t.hpp" -#include "vector/Float.hpp" -#include "vector/compile-time/Vector.hpp" -#include "vector/compile-time/Int.hpp" -#include "vector/compile-time/Size_t.hpp" +#include "math/vector/Vector.hpp" +#include "math/vector/Int.hpp" +#include "math/vector/UInt.hpp" +#include "math/vector/Size_t.hpp" +#include "math/vector/Float.hpp" +#include "math/vector/compile-time/Vector.hpp" +#include "math/vector/compile-time/Int.hpp" +#include "math/vector/compile-time/Size_t.hpp" + +#include "math/vector/Vector.tpp" diff --git a/src/libPMacc/include/basisLib/vector/Vector.tpp b/src/libPMacc/include/math/vector/Vector.tpp similarity index 73% rename from src/libPMacc/include/basisLib/vector/Vector.tpp rename to src/libPMacc/include/math/vector/Vector.tpp index 96ff5d4a70..fbe154a51f 100644 --- a/src/libPMacc/include/basisLib/vector/Vector.tpp +++ b/src/libPMacc/include/math/vector/Vector.tpp @@ -23,106 +23,12 @@ #pragma once -#include "basisLib/vector/Vector.hpp" +#include "math/vector/Vector.hpp" #include "algorithms/math.hpp" #include "algorithms/TypeCast.hpp" #include "mpi/GetMPI_StructAsArray.hpp" #include "traits/GetType.hpp" -/* -namespace PMacc -{ - -namespace math -{ - -template -std::ostream& operator<<( std::ostream& s, const Vector& vec ) -{ - for ( int i = 0; i < dim - 1; i++ ) - s << vec[i] << ", "; - return s << vec[dim - 1]; -} - -template -HDINLINE -Vector operator+(const Vector& lhs, const Vector& rhs ) -{ - Vector result( lhs ); - result += rhs; - return result; -} - -template -HDINLINE -Vector operator-(const Vector& lhs, const Vector& rhs ) -{ - Vector result( lhs ); - result -= rhs; - return result; -} - -template -HDINLINE -Vector operator*(const Vector& lhs, const Vector& rhs ) -{ - Vector result( lhs ); - result *= rhs; - return result; -} - -template -HDINLINE -Vector operator/(const Vector& lhs, const Vector& rhs ) -{ - Vector result( lhs ); - result /= rhs; - return result; -} - -template -HDINLINE -Vector operator*(const Vector& lhs, const Type& rhs ) -{ - Vector result( lhs ); - result *= rhs; - return result; -} - -template -HDINLINE -Vector operator*(const Type& lhs, const Vector& rhs ) -{ - Vector result( rhs ); - result *= lhs; - return result; -} - -template -HDINLINE -Vector operator/(const Vector& lhs, const Type& rhs ) -{ - Vector result( lhs ); - result /= rhs; - return result; -} - -template -HDINLINE -Vector operator-(const Vector& vec ) -{ - Vector result( vec ); - for ( int i = 0; i < dim; i++ ) - result[i] = -result[i]; - return result; -} - -} //namespace math - - -}//namepsace PMacc -*/ - namespace PMacc { namespace traits @@ -148,6 +54,8 @@ namespace math namespace detail { +/*#### comparsion ############################################################*/ + /*specialize max algorithm*/ template struct Max< ::PMacc::math::Vector,::PMacc::math::Vector > @@ -178,6 +86,8 @@ struct Min< ::PMacc::math::Vector,::PMacc::math::Vector > } }; +/*#### abs ###################################################################*/ + /*specialize abs2 algorithm*/ template struct Abs2< ::PMacc::math::Vector > @@ -206,6 +116,8 @@ struct Abs< ::PMacc::math::Vector > } }; +/*#### cross #################################################################*/ + template struct Cross< ::PMacc::math::Vector, ::PMacc::math::Vector > { @@ -220,6 +132,8 @@ struct Cross< ::PMacc::math::Vector, ::PMacc::math::Vector struct Dot< ::PMacc::math::Vector, ::PMacc::math::Vector > { @@ -229,10 +143,34 @@ struct Dot< ::PMacc::math::Vector, ::PMacc::math::Vector > HDINLINE result operator( )(const myType& a, const myType & b ) { BOOST_STATIC_ASSERT( dim > 0 ); - result result = a.x() * b.x(); + result tmp = a.x() * b.x(); for ( int i = 1; i < dim; i++ ) - result += a[i] * b[i]; - return result; + tmp += a[i] * b[i]; + return tmp; + } +}; + +/*#### pow ###################################################################*/ +/*! Specialisation of pow where base is a vector and exponent is a scalar + * + * Create pow separate for every dimension of the vector. + * + * @prama base vector with base values + * @param exponent scalar with exponent value + */ +template +struct Pow< ::PMacc::math::Vector, T2 > +{ + typedef ::PMacc::math::Vector Vector1; + typedef Vector1 result; + + HDINLINE result operator( )(const Vector1& base, const T2 & exponent ) + { + BOOST_STATIC_ASSERT( dim > 0 ); + result tmp; + for ( int i = 0; i < dim; ++i ) + tmp[i]=PMacc::algorithms::math::pow(base[i],exponent); + return tmp; } }; diff --git a/src/libPMacc/include/particles/memory/frames/BigFrame.hpp b/src/libPMacc/include/particles/memory/frames/BigFrame.hpp index 628e17b1a0..6aad7445a5 100644 --- a/src/libPMacc/include/particles/memory/frames/BigFrame.hpp +++ b/src/libPMacc/include/particles/memory/frames/BigFrame.hpp @@ -25,7 +25,7 @@ #include "types.h" #include "particles/frame_types.hpp" -#include "basisLib/vector/Vector.hpp" +#include "math/Vector.hpp" #include "particles/memory/boxes/TileDataBox.hpp" #include "FrameCopy.hpp" diff --git a/src/libPMacc/include/particles/memory/frames/BorderFrame.hpp b/src/libPMacc/include/particles/memory/frames/BorderFrame.hpp index 821d33d62d..0762df1551 100644 --- a/src/libPMacc/include/particles/memory/frames/BorderFrame.hpp +++ b/src/libPMacc/include/particles/memory/frames/BorderFrame.hpp @@ -24,7 +24,7 @@ #define BORDERFRAME_HPP #include "particles/frame_types.hpp" -#include "basisLib/vector/Vector.hpp" +#include "math/Vector.hpp" #include "particles/memory/boxes/TileDataBox.hpp" #include "particles/memory/frames/FrameCopy.hpp" diff --git a/src/libPMacc/include/particles/memory/frames/CoreFrame.hpp b/src/libPMacc/include/particles/memory/frames/CoreFrame.hpp index 69861239fa..f63574171a 100644 --- a/src/libPMacc/include/particles/memory/frames/CoreFrame.hpp +++ b/src/libPMacc/include/particles/memory/frames/CoreFrame.hpp @@ -24,7 +24,7 @@ #include "types.h" #include "particles/frame_types.hpp" -#include "basisLib/vector/Vector.hpp" +#include "math/Vector.hpp" #include "particles/memory/boxes/TileDataBox.hpp" #include "particles/memory/frames/FrameCopy.hpp" diff --git a/src/picongpu/include/fields/FieldB.hpp b/src/picongpu/include/fields/FieldB.hpp index 964fc5b5af..2953418b39 100644 --- a/src/picongpu/include/fields/FieldB.hpp +++ b/src/picongpu/include/fields/FieldB.hpp @@ -41,7 +41,7 @@ #include "memory/boxes/DataBox.hpp" #include "memory/boxes/PitchedBox.hpp" -#include "basisLib/vector/Vector.hpp" +#include "math/Vector.hpp" namespace picongpu diff --git a/src/picongpu/include/fields/FieldE.hpp b/src/picongpu/include/fields/FieldE.hpp index 3006a45d73..d9cb8bb735 100644 --- a/src/picongpu/include/fields/FieldE.hpp +++ b/src/picongpu/include/fields/FieldE.hpp @@ -41,7 +41,7 @@ #include "memory/boxes/DataBox.hpp" #include "memory/boxes/PitchedBox.hpp" -#include "basisLib/vector/Vector.hpp" +#include "math/Vector.hpp" namespace picongpu diff --git a/src/picongpu/include/fields/FieldJ.hpp b/src/picongpu/include/fields/FieldJ.hpp index 2e4686849a..7a8e89237a 100644 --- a/src/picongpu/include/fields/FieldJ.hpp +++ b/src/picongpu/include/fields/FieldJ.hpp @@ -41,7 +41,7 @@ #include "memory/boxes/DataBox.hpp" #include "memory/boxes/PitchedBox.hpp" -#include "basisLib/vector/Vector.hpp" +#include "math/Vector.hpp" namespace picongpu { diff --git a/src/picongpu/include/particles/species/default/ParticlesData.hpp b/src/picongpu/include/particles/species/default/ParticlesData.hpp index efecf77431..d88e7b999e 100644 --- a/src/picongpu/include/particles/species/default/ParticlesData.hpp +++ b/src/picongpu/include/particles/species/default/ParticlesData.hpp @@ -25,7 +25,7 @@ #include "particles/memory/boxes/TileDataBox.hpp" #include "types.h" -#include "basisLib/vector/Vector.hpp" +#include "math/Vector.hpp" #include "particles/memory/frames/NullFrame.hpp" namespace picongpu diff --git a/src/picongpu/include/simulation_defines/unitless/precision.unitless b/src/picongpu/include/simulation_defines/unitless/precision.unitless index 12023407b8..3b6652ef09 100644 --- a/src/picongpu/include/simulation_defines/unitless/precision.unitless +++ b/src/picongpu/include/simulation_defines/unitless/precision.unitless @@ -20,7 +20,7 @@ #pragma once -#include "basisLib/vector/Vector.hpp" +#include "math/Vector.hpp" namespace picongpu { From 4bf8dd743ed93ab7c713c5c08a7e851a38ec4058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Widera?= Date: Wed, 18 Sep 2013 15:02:47 +0200 Subject: [PATCH 42/54] add pow definition and double implementation - add specialisation for double (C++98 standard) --- .../include/algorithms/math/defines/pow.hpp | 55 +++++++++++++++ .../algorithms/math/doubleMath/pow.tpp | 67 +++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 src/libPMacc/include/algorithms/math/defines/pow.hpp create mode 100644 src/libPMacc/include/algorithms/math/doubleMath/pow.tpp diff --git a/src/libPMacc/include/algorithms/math/defines/pow.hpp b/src/libPMacc/include/algorithms/math/defines/pow.hpp new file mode 100644 index 0000000000..f9b357b02a --- /dev/null +++ b/src/libPMacc/include/algorithms/math/defines/pow.hpp @@ -0,0 +1,55 @@ +/** + * Copyright 2013 René Widera + * + * This file is part of libPMacc. + * + * libPMacc is free software: you can redistribute it and/or modify + * it under the terms of of either the GNU General Public License or + * the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * libPMacc is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License and the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License + * and the GNU Lesser General Public License along with libPMacc. + * If not, see . + */ + +#pragma once + +namespace PMacc +{ +namespace algorithms +{ + +namespace math +{ + +namespace detail +{ + +template +struct Pow; + +} //namespace detail + + +/** Raised the base to the power exponent + * + * @param base base value + * @param exponent power exponent + * @return base rased to the power exponent + */ +template +HDINLINE static typename detail::Pow< T1, T2 >::result pow(const T1& base,const T2& exponent) +{ + return detail::Pow< T1, T2 > ()(base, exponent); +} + +} //namespace math +} //namespace algorithms +}//namespace PMacc diff --git a/src/libPMacc/include/algorithms/math/doubleMath/pow.tpp b/src/libPMacc/include/algorithms/math/doubleMath/pow.tpp new file mode 100644 index 0000000000..6ece2170fa --- /dev/null +++ b/src/libPMacc/include/algorithms/math/doubleMath/pow.tpp @@ -0,0 +1,67 @@ +/** + * Copyright 2013 René Widera + * + * This file is part of libPMacc. + * + * libPMacc is free software: you can redistribute it and/or modify + * it under the terms of of either the GNU General Public License or + * the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * libPMacc is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License and the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License + * and the GNU Lesser General Public License along with libPMacc. + * If not, see . + */ + + +#pragma once + +#include "types.h" +#include /*provide host version of pow*/ + +namespace PMacc +{ +namespace algorithms +{ +namespace math +{ +namespace detail +{ + +/*C++98 standard define a separate version for int and double exponent*/ + +template<> +struct Pow +{ + typedef double result; + + HDINLINE result operator()(const double& base, const double& exponent) + { + return ::pow(base, exponent); + } +}; + +template<> +struct Pow +{ + typedef double result; + + HDINLINE result operator()(const double& base, const int& exponent) + { + return ::pow(base, exponent); + } +}; + + +} //namespace detail +} //namespace math +} //namespace algorithms +} // namespace PMacc + + From fb2354d6947140dc2930d5e52b734456e48b3cde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Widera?= Date: Wed, 18 Sep 2013 15:08:57 +0200 Subject: [PATCH 43/54] add Heiko to copyright list --- src/libPMacc/include/algorithms/math/defines/pow.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libPMacc/include/algorithms/math/defines/pow.hpp b/src/libPMacc/include/algorithms/math/defines/pow.hpp index f9b357b02a..1818873a4e 100644 --- a/src/libPMacc/include/algorithms/math/defines/pow.hpp +++ b/src/libPMacc/include/algorithms/math/defines/pow.hpp @@ -1,5 +1,5 @@ /** - * Copyright 2013 René Widera + * Copyright 2013 Heiko Burau, René Widera * * This file is part of libPMacc. * From fe8e4a27e57ad82d13d2367b689a2fce7b988c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Widera?= Date: Wed, 18 Sep 2013 15:18:07 +0200 Subject: [PATCH 44/54] fix spelling mistake --- src/libPMacc/include/math/vector/Vector.tpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libPMacc/include/math/vector/Vector.tpp b/src/libPMacc/include/math/vector/Vector.tpp index fbe154a51f..939a262321 100644 --- a/src/libPMacc/include/math/vector/Vector.tpp +++ b/src/libPMacc/include/math/vector/Vector.tpp @@ -54,7 +54,7 @@ namespace math namespace detail { -/*#### comparsion ############################################################*/ +/*#### comparison ############################################################*/ /*specialize max algorithm*/ template @@ -153,7 +153,7 @@ struct Dot< ::PMacc::math::Vector, ::PMacc::math::Vector > /*#### pow ###################################################################*/ /*! Specialisation of pow where base is a vector and exponent is a scalar * - * Create pow separate for every dimension of the vector. + * Create pow separatley for every component of the vector. * * @prama base vector with base values * @param exponent scalar with exponent value From 54f3c51564f3abeca302b9d22a4a44ea559c0ba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Widera?= Date: Wed, 18 Sep 2013 16:16:15 +0200 Subject: [PATCH 45/54] close #53, warning in SimulationBox - delete HDINLINE in both constructors (there is no need device constuctor) --- src/libPMacc/include/mappings/simulation/SubGrid.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libPMacc/include/mappings/simulation/SubGrid.hpp b/src/libPMacc/include/mappings/simulation/SubGrid.hpp index 4b9dff532a..1b65902a56 100644 --- a/src/libPMacc/include/mappings/simulation/SubGrid.hpp +++ b/src/libPMacc/include/mappings/simulation/SubGrid.hpp @@ -37,7 +37,7 @@ class SimulationBox static const uint32_t Dim = DIM; public: - HDINLINE SimulationBox(const Size& localSize, + SimulationBox(const Size& localSize, const Size& globalSize, const Size& globalOffset) : localSize(localSize), @@ -49,7 +49,7 @@ class SimulationBox assert(localSize[i] <= globalSize[i]); } - HDINLINE SimulationBox() + SimulationBox() { } From e9b1309540d1f942c908805e7597dc06a837081e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20H=C3=BCbl?= Date: Wed, 18 Sep 2013 16:45:36 +0200 Subject: [PATCH 46/54] Update PARTICIPATE.md - add more useful log aliases --- doc/PARTICIPATE.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/PARTICIPATE.md b/doc/PARTICIPATE.md index 195da74fa6..f6e4bd1f65 100644 --- a/doc/PARTICIPATE.md +++ b/doc/PARTICIPATE.md @@ -66,10 +66,13 @@ You may even improve your level of awesomeness by: (see how to [avoide merge commits](#keep-track-of-updates)) - `git config --global alias.pm "pull --rebase mainline"` (to sync with the mainline by `git pm dev`) - `git config --global alias.st "status -sb"` (short status version) -- `git config --global alias.l "log --oneline --graph --decorate --all"` (branch history) +- `git config --global alias.l "log --oneline --graph --decorate --first-parent"` (single branch history) +- `git config --global alias.la "log --oneline --graph --decorate --all"` (full branch history) - `git config --global rerere.enable 1` (see [git rerere](http://git-scm.com/blog/2010/03/08/rerere.html)) - +- More `alias` tricks: + - `git config --get-regexp alias` (show all aliases) + - `git config --global --unset alias.` (unset alias ``) ### git From 669cf8328ce0b3daccbb9d0ebc6175e2209d9d5b Mon Sep 17 00:00:00 2001 From: Heikman Date: Thu, 19 Sep 2013 13:37:19 +0200 Subject: [PATCH 47/54] fix bug in cuSTL/container/view/View.hpp - this->refCount has to be copied too --- src/libPMacc/include/cuSTL/container/view/View.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/libPMacc/include/cuSTL/container/view/View.hpp b/src/libPMacc/include/cuSTL/container/view/View.hpp index 8986460bde..9a7f5a4582 100644 --- a/src/libPMacc/include/cuSTL/container/view/View.hpp +++ b/src/libPMacc/include/cuSTL/container/view/View.hpp @@ -33,9 +33,7 @@ struct View : public Buffer template HDINLINE View(const View& other) { - this->dataPointer = other.dataPointer; - this->_size = other._size; - this->pitch = other.pitch; + *this = other; } HDINLINE ~View() @@ -49,6 +47,7 @@ struct View : public Buffer this->dataPointer = other.dataPointer; this->_size = other._size; this->pitch = other.pitch; + this->refCount = other.refCount; return *this; } From 6194391df1b7e9332e4276ad70cd50a6357b0989 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Tue, 17 Sep 2013 17:05:45 +0200 Subject: [PATCH 48/54] mpiInfo: fix broken CMakeFile - LINK_DIRECTORIES causes problems on taurus and is NOT necessary at all http://cmake.org/cmake/help/v2.8.11/cmake.html#command:link_directories - general clean-up --- src/mpiInfo/CMakeLists.txt | 23 ++++++++++++----------- src/mpiInfo/main.cpp | 8 +++----- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/mpiInfo/CMakeLists.txt b/src/mpiInfo/CMakeLists.txt index 77bd0b63bb..a5ce895525 100644 --- a/src/mpiInfo/CMakeLists.txt +++ b/src/mpiInfo/CMakeLists.txt @@ -28,31 +28,32 @@ IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) SET(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}" CACHE PATH "install prefix" FORCE) ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) +SET(CMAKE_CXX_FLAGS_DEFAULT "-Wall") + +#### DEPENDENCIES ############################################################# #set helper pathes to find libraries and packages -set(CMAKE_PREFIX_PATH "/usr/lib/x86_64-linux-gnu/" "$ENV{MPI_ROOT}" "$ENV{CUDA_ROOT}" "$ENV{BOOST_ROOT}" "$ENV{HDF5_ROOT}") +set(CMAKE_PREFIX_PATH "/usr/lib/x86_64-linux-gnu/" "$ENV{MPI_ROOT}" "$ENV{BOOST_ROOT}") +#include MPI FIND_PACKAGE(MPI REQUIRED) +INCLUDE_DIRECTORIES(SYSTEM ${MPI_C_INCLUDE_PATH}) +SET(LIBS ${LIBS} ${MPI_C_LIBRARIES}) -SET(CMAKE_CXX_FLAGS_DEFAULT "-Wall") - -#Boost from system +#include Boost FIND_PACKAGE(Boost REQUIRED COMPONENTS program_options) -INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) -LINK_DIRECTORIES(${Boost_LIBRARY_DIR}) +INCLUDE_DIRECTORIES(SYSTEM ${Boost_INCLUDE_DIRS}) SET(LIBS ${LIBS} ${Boost_LIBRARIES}) -INCLUDE_DIRECTORIES(${MPI_INCLUDE_PATH} ${mpi_include_path}) +#### TARGETS ################################################################## add_executable(mpiInfo main.cpp ) +target_link_libraries(mpiInfo ${LIBS}) -target_link_libraries(mpiInfo ${LIBS} ${MPI_LIBRARIES}) # not necessary ${MPI_EXTRA_LIBRARY} - - +#### INSTALLATION ############################################################# -#### INSTALLATION ##### INSTALL(TARGETS mpiInfo RUNTIME DESTINATION bin) diff --git a/src/mpiInfo/main.cpp b/src/mpiInfo/main.cpp index 52904a6774..56ed5035d8 100644 --- a/src/mpiInfo/main.cpp +++ b/src/mpiInfo/main.cpp @@ -18,8 +18,8 @@ * If not, see . */ -#include #include +#include #include #include @@ -28,9 +28,7 @@ #define MPI_CHECK(cmd) {int error = cmd; if(error!=MPI_SUCCESS){printf("<%s>:%i ",__FILE__,__LINE__); throw std::runtime_error(std::string("[MPI] Error"));}} -/* - * - */ + namespace po = boost::program_options; enum @@ -44,7 +42,7 @@ enum /* Set the first found non charactor or number to 0 (NULL) * name like p1223(Pid=1233) is than p1223 - * in some MPI implementation /mpich) the hostname is uniqu + * in some MPI implementation /mpich) the hostname is unique */ void cleanHostname( char* name ) { From c272dbb72f206c0b6720db67c5429e402a0df6f3 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Tue, 17 Sep 2013 20:12:05 +0200 Subject: [PATCH 49/54] BullXMPI / FindMPI fix - at least for mpiInfo, Bullxmpi tries to link against the deprecated MPI C++ Interfaces (whyyyyy?) - since it is hard to find what depencency resolves the same problem in PIConGPU, we add the same work-around here - another option: it would be possible to use the FindMPI deprecated var MPI_LIBRARIES instead, but we avoid that --- src/mpiInfo/CMakeLists.txt | 3 +++ src/picongpu/CMakeLists.txt | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/mpiInfo/CMakeLists.txt b/src/mpiInfo/CMakeLists.txt index a5ce895525..9fc69fde41 100644 --- a/src/mpiInfo/CMakeLists.txt +++ b/src/mpiInfo/CMakeLists.txt @@ -39,6 +39,9 @@ set(CMAKE_PREFIX_PATH "/usr/lib/x86_64-linux-gnu/" "$ENV{MPI_ROOT}" "$ENV{BOOST_ FIND_PACKAGE(MPI REQUIRED) INCLUDE_DIRECTORIES(SYSTEM ${MPI_C_INCLUDE_PATH}) SET(LIBS ${LIBS} ${MPI_C_LIBRARIES}) +IF(MPI_CXX_FOUND) # bullxmpi fails if it can not find its c++ counter part + SET(LIBS ${LIBS} ${MPI_CXX_LIBRARIES}) +ENDIF(MPI_CXX_FOUND) #include Boost FIND_PACKAGE(Boost REQUIRED COMPONENTS program_options) diff --git a/src/picongpu/CMakeLists.txt b/src/picongpu/CMakeLists.txt index 5a25943c64..3b34dfa87f 100644 --- a/src/picongpu/CMakeLists.txt +++ b/src/picongpu/CMakeLists.txt @@ -53,6 +53,9 @@ ENDIF(PIC_RELEASE) FIND_PACKAGE(MPI REQUIRED) INCLUDE_DIRECTORIES(SYSTEM ${MPI_C_INCLUDE_PATH}) SET(LIBS ${LIBS} ${MPI_C_LIBRARIES}) +IF(MPI_CXX_FOUND) # bullxmpi fails if it can not find its c++ counter part + SET(LIBS ${LIBS} ${MPI_CXX_LIBRARIES}) +ENDIF(MPI_CXX_FOUND) #include pthreads FIND_PACKAGE(Threads REQUIRED) From 9b907e2595d41de2edac50ec3287f424a7450a60 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Fri, 20 Sep 2013 13:07:52 +0200 Subject: [PATCH 50/54] Fix ELSEIF -> ELSE mismatch - messages for splash and pngwriter not found - fix bug introduced with 8e4609e06ef258cb08a646e665131e65b26cd3b5 --- src/picongpu/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/picongpu/CMakeLists.txt b/src/picongpu/CMakeLists.txt index 3b34dfa87f..e5ff47cf7b 100644 --- a/src/picongpu/CMakeLists.txt +++ b/src/picongpu/CMakeLists.txt @@ -221,7 +221,7 @@ IF(HDF5_FOUND) ADD_LIBRARY(splash_static STATIC IMPORTED) SET_TARGET_PROPERTIES(splash_static PROPERTIES IMPORTED_LOCATION ${PIC_SPLASH_ROOT_DIR}/lib/libsplash.a) SET(LIBS ${LIBS} splash_static ${HDF5_LIBRARIES}) - ELSEIF(PIC_SPLASH_ROOT_DIR) + ELSE(PIC_SPLASH_ROOT_DIR) MESSAGE(STATUS "Could NOT find Splash") ENDIF(PIC_SPLASH_ROOT_DIR) ENDIF(HDF5_FOUND) @@ -244,7 +244,7 @@ IF(PIC_PNGWRITER_ROOT_DIR) INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIRS}) SET(LIBS ${LIBS} ${FREETYPE_LIBRARIES}) ENDIF(FREETYPE_FOUND) -ELSEIF(PIC_PNGWRITER_ROOT_DIR) +ELSE(PIC_PNGWRITER_ROOT_DIR) MESSAGE(STATUS "Could NOT find PNGWriter") ENDIF(PIC_PNGWRITER_ROOT_DIR) From b4a56c9f85baed847e0f6ca0b77b6c18926e951e Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Mon, 23 Sep 2013 11:41:43 +0200 Subject: [PATCH 51/54] gasSphereFlanks: add inner radius - allows to simulate spheric shells / hollow cylinders --- .../simulation_defines/param/gasConfig.param | 3 +++ .../simulation_defines/param/gasConfig.param | 3 +++ .../simulation_defines/param/gasConfig.param | 3 +++ .../simulation_defines/param/gasConfig.param | 3 +++ .../simulation_defines/param/gasConfig.param | 3 +++ .../particles/gasProfiles/gasSphereFlanks.hpp | 20 +++++++++++-------- .../simulation_defines/param/gasConfig.param | 3 +++ .../unitless/gasConfig.unitless | 1 + 8 files changed, 31 insertions(+), 8 deletions(-) diff --git a/examples/Bunch/include/simulation_defines/param/gasConfig.param b/examples/Bunch/include/simulation_defines/param/gasConfig.param index 398f1607be..bddc761422 100644 --- a/examples/Bunch/include/simulation_defines/param/gasConfig.param +++ b/examples/Bunch/include/simulation_defines/param/gasConfig.param @@ -141,6 +141,9 @@ namespace picongpu /** Radius of the constant sphere * unit: meter */ const double GAS_R_SI = 1.0e3; + /** Inner radius if you want to build a shell/ring + * unit: meter */ + const double GAS_RI_SI = 0.0; /** Middle of the constant sphere * unit: meter */ diff --git a/examples/KelvinHelmholtz/include/simulation_defines/param/gasConfig.param b/examples/KelvinHelmholtz/include/simulation_defines/param/gasConfig.param index 73026e7643..98683019a4 100644 --- a/examples/KelvinHelmholtz/include/simulation_defines/param/gasConfig.param +++ b/examples/KelvinHelmholtz/include/simulation_defines/param/gasConfig.param @@ -141,6 +141,9 @@ namespace picongpu /** Radius of the constant sphere * unit: meter */ const double GAS_R_SI = 1.0e3; + /** Inner radius if you want to build a shell/ring + * unit: meter */ + const double GAS_RI_SI = 0.0; /** Middle of the constant sphere * unit: meter */ diff --git a/examples/LaserWakefield/include/simulation_defines/param/gasConfig.param b/examples/LaserWakefield/include/simulation_defines/param/gasConfig.param index ee3173d07e..4aefe8d033 100644 --- a/examples/LaserWakefield/include/simulation_defines/param/gasConfig.param +++ b/examples/LaserWakefield/include/simulation_defines/param/gasConfig.param @@ -141,6 +141,9 @@ namespace picongpu /** Radius of the constant sphere * unit: meter */ const double GAS_R_SI = 1.0e3; + /** Inner radius if you want to build a shell/ring + * unit: meter */ + const double GAS_RI_SI = 0.0; /** Middle of the constant sphere * unit: meter */ diff --git a/examples/ThermalTest/include/simulation_defines/param/gasConfig.param b/examples/ThermalTest/include/simulation_defines/param/gasConfig.param index 95adc34340..3a619cd550 100644 --- a/examples/ThermalTest/include/simulation_defines/param/gasConfig.param +++ b/examples/ThermalTest/include/simulation_defines/param/gasConfig.param @@ -141,6 +141,9 @@ namespace picongpu /** Radius of the constant sphere * unit: meter */ const double GAS_R_SI = 1.0e3; + /** Inner radius if you want to build a shell/ring + * unit: meter */ + const double GAS_RI_SI = 0.0; /** Middle of the constant sphere * unit: meter */ diff --git a/examples/WeibelTransverse/include/simulation_defines/param/gasConfig.param b/examples/WeibelTransverse/include/simulation_defines/param/gasConfig.param index 73026e7643..98683019a4 100644 --- a/examples/WeibelTransverse/include/simulation_defines/param/gasConfig.param +++ b/examples/WeibelTransverse/include/simulation_defines/param/gasConfig.param @@ -141,6 +141,9 @@ namespace picongpu /** Radius of the constant sphere * unit: meter */ const double GAS_R_SI = 1.0e3; + /** Inner radius if you want to build a shell/ring + * unit: meter */ + const double GAS_RI_SI = 0.0; /** Middle of the constant sphere * unit: meter */ diff --git a/src/picongpu/include/particles/gasProfiles/gasSphereFlanks.hpp b/src/picongpu/include/particles/gasProfiles/gasSphereFlanks.hpp index d9702892b8..f87e556611 100644 --- a/src/picongpu/include/particles/gasProfiles/gasSphereFlanks.hpp +++ b/src/picongpu/include/particles/gasProfiles/gasSphereFlanks.hpp @@ -40,15 +40,19 @@ namespace picongpu if( pos.y() < VACUUM_Y ) return float_X(0.0); const float_X r = math::abs( pos - float3_X(GAS_X, GAS_Y, GAS_Z) ); - - // "hard core" - if( r <= GAS_R ) + + /* "shell": inner radius */ + if( r < GAS_RI ) + return float_X(0.0); + /* "hard core" */ + else if( r <= GAS_R ) return float_X(1.0); - - // "soft exp. flanks" - // note: by definition (return, see above) the - // argument [ GAS_R - r ] will be element of (-inf, 0) - return math::exp( ( GAS_R - r ) * GAS_EXP ); + + /* "soft exp. flanks" + * note: by definition (return, see above) the + * argument [ GAS_R - r ] will be element of (-inf, 0) */ + else + return math::exp( ( GAS_R - r ) * GAS_EXP ); } } } diff --git a/src/picongpu/include/simulation_defines/param/gasConfig.param b/src/picongpu/include/simulation_defines/param/gasConfig.param index dc1f61f303..e7e617c764 100644 --- a/src/picongpu/include/simulation_defines/param/gasConfig.param +++ b/src/picongpu/include/simulation_defines/param/gasConfig.param @@ -141,6 +141,9 @@ namespace picongpu /** Radius of the constant sphere * unit: meter */ const double GAS_R_SI = 1.0e3; + /** Inner radius if you want to build a shell/ring + * unit: meter */ + const double GAS_RI_SI = 0.0; /** Middle of the constant sphere * unit: meter */ diff --git a/src/picongpu/include/simulation_defines/unitless/gasConfig.unitless b/src/picongpu/include/simulation_defines/unitless/gasConfig.unitless index ee400e3a13..00ac454050 100644 --- a/src/picongpu/include/simulation_defines/unitless/gasConfig.unitless +++ b/src/picongpu/include/simulation_defines/unitless/gasConfig.unitless @@ -62,6 +62,7 @@ namespace picongpu namespace gasSphereFlanks { const float_X GAS_R = float_X( SI::GAS_R_SI / UNIT_LENGTH ); + const float_X GAS_RI = float_X( SI::GAS_RI_SI / UNIT_LENGTH ); const float_X GAS_X = float_X( SI::GAS_X_SI / UNIT_LENGTH ); const float_X GAS_Y = float_X( SI::GAS_Y_SI / UNIT_LENGTH ); const float_X GAS_Z = float_X( SI::GAS_Z_SI / UNIT_LENGTH ); From a4211ab5395370410cbbb8afaad5c8b938ec7cdc Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Wed, 25 Sep 2013 19:05:43 +0200 Subject: [PATCH 52/54] Add TypeTraits for Splash Types --- src/picongpu/include/simulation_types.hpp | 2 + src/picongpu/include/traits/PICToSplash.hpp | 42 ++++++++++++ src/picongpu/include/traits/PICToSplash.tpp | 71 ++++++++++++++++++++ src/picongpu/include/traits/SplashToPIC.hpp | 42 ++++++++++++ src/picongpu/include/traits/SplashToPIC.tpp | 72 +++++++++++++++++++++ 5 files changed, 229 insertions(+) create mode 100644 src/picongpu/include/traits/PICToSplash.hpp create mode 100644 src/picongpu/include/traits/PICToSplash.tpp create mode 100644 src/picongpu/include/traits/SplashToPIC.hpp create mode 100644 src/picongpu/include/traits/SplashToPIC.tpp diff --git a/src/picongpu/include/simulation_types.hpp b/src/picongpu/include/simulation_types.hpp index d48ff6e4da..0c12e6ed9c 100644 --- a/src/picongpu/include/simulation_types.hpp +++ b/src/picongpu/include/simulation_types.hpp @@ -27,6 +27,8 @@ #include "algorithms/ForEach.hpp" #include "algorithms/math.hpp" #include "traits/GetMargin.hpp" +#include "traits/SplashToPIC.hpp" +#include "traits/PICToSplash.hpp" #include "traits/GetType.hpp" namespace picongpu diff --git a/src/picongpu/include/traits/PICToSplash.hpp b/src/picongpu/include/traits/PICToSplash.hpp new file mode 100644 index 0000000000..4dc020b514 --- /dev/null +++ b/src/picongpu/include/traits/PICToSplash.hpp @@ -0,0 +1,42 @@ +/** + * Copyright 2013 Axel Huebl + * + * This file is part of PIConGPU. + * + * PIConGPU is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PIConGPU is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PIConGPU. + * If not, see . + */ + +#pragma once + +#include "simulation_defines.hpp" + +namespace picongpu +{ + +namespace traits +{ + /** Convert a PIConGPU Type to a Splash CollectionType + * + * \tparam T_Type Typename in PIConGPU + * \return \p ::type as public typedef of a Splash DCollector::CollectionType + */ + template + struct PICToSplash; + +} //namespace traits + +}// namespace picongpu + +#include "PICToSplash.tpp" diff --git a/src/picongpu/include/traits/PICToSplash.tpp b/src/picongpu/include/traits/PICToSplash.tpp new file mode 100644 index 0000000000..729fba322c --- /dev/null +++ b/src/picongpu/include/traits/PICToSplash.tpp @@ -0,0 +1,71 @@ +/** + * Copyright 2013 Axel Huebl + * + * This file is part of PIConGPU. + * + * PIConGPU is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PIConGPU is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PIConGPU. + * If not, see . + */ + +#pragma once + +#if (ENABLE_HDF5==1) +#include + +#include "simulation_defines.hpp" + +namespace picongpu +{ + +namespace traits +{ + /** Trait for bool */ + template<> + struct PICToSplash + { + typedef DCollector::ColTypeBool type; + }; + /** Trait for float */ + template<> + struct PICToSplash + { + typedef DCollector::ColTypeFloat type; + }; + + /** Trait for double */ + template<> + struct PICToSplash + { + typedef DCollector::ColTypeDouble type; + }; + + /** Trait for int */ + template<> + struct PICToSplash + { + typedef DCollector::ColTypeInt type; + }; + + /** Trait for DCollector::Dimensions */ + template<> + struct PICToSplash + { + typedef DCollector::ColTypeDim type; + }; + +} //namespace traits + +}// namespace picongpu + +#endif // (ENABLE_HDF5==1) diff --git a/src/picongpu/include/traits/SplashToPIC.hpp b/src/picongpu/include/traits/SplashToPIC.hpp new file mode 100644 index 0000000000..0319634b04 --- /dev/null +++ b/src/picongpu/include/traits/SplashToPIC.hpp @@ -0,0 +1,42 @@ +/** + * Copyright 2013 Axel Huebl + * + * This file is part of PIConGPU. + * + * PIConGPU is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PIConGPU is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PIConGPU. + * If not, see . + */ + +#pragma once + +#include "simulation_defines.hpp" + +namespace picongpu +{ + +namespace traits +{ + /** Convert a Splash CollectionType to a PIConGPU Type + * + * \tparam T_SplashType Splash DCollector::CollectionType + * \return \p ::type as public typedef + */ + template + struct SplashToPIC; + +} //namespace traits + +}// namespace picongpu + +#include "SplashToPIC.tpp" diff --git a/src/picongpu/include/traits/SplashToPIC.tpp b/src/picongpu/include/traits/SplashToPIC.tpp new file mode 100644 index 0000000000..409606af52 --- /dev/null +++ b/src/picongpu/include/traits/SplashToPIC.tpp @@ -0,0 +1,72 @@ +/** + * Copyright 2013 Axel Huebl + * + * This file is part of PIConGPU. + * + * PIConGPU is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PIConGPU is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PIConGPU. + * If not, see . + */ + +#pragma once + +#if (ENABLE_HDF5==1) +#include + +#include "simulation_defines.hpp" + +namespace picongpu +{ + +namespace traits +{ + /** Trait for DCollector::ColTypeBool */ + template<> + struct SplashToPIC + { + typedef bool type; + }; + + /** Trait for DCollector::ColTypeFloat */ + template<> + struct SplashToPIC + { + typedef float type; + }; + + /** Trait for DCollector::ColTypeDouble */ + template<> + struct SplashToPIC + { + typedef double type; + }; + + /** Trait for DCollector::ColTypeInt */ + template<> + struct SplashToPIC + { + typedef int type; + }; + + /** Trait for DCollector::ColTypeInt */ + template<> + struct SplashToPIC + { + typedef DCollector::Dimensions type; + }; + +} //namespace traits + +}// namespace picongpu + +#endif // (ENABLE_HDF5==1) From 1528fd6836bad90b69d85148131dc949076c48c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Widera?= Date: Mon, 30 Sep 2013 13:01:30 +0200 Subject: [PATCH 53/54] fix #71, fix bug in cfg - delete double usage of parameter pos_e.period - fix current bug --- .../SingleParticleTest/submit/0008gpus.cfg | 3 +- src/picongpu/include/fields/FieldJ.kernel | 30 +++++++++++-------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/examples/SingleParticleTest/submit/0008gpus.cfg b/examples/SingleParticleTest/submit/0008gpus.cfg index ac26bcac4a..0b5003fd24 100644 --- a/examples/SingleParticleTest/submit/0008gpus.cfg +++ b/examples/SingleParticleTest/submit/0008gpus.cfg @@ -42,11 +42,10 @@ TBG_programParams="!TBG_devices \ !TBG_steps \ !TBG_analyser | tee output" -TBG_analyser="--pos_e.period 100\ +TBG_analyser="--pos_e.period 1 \ !TBG_pngYX \ !TBG_pngYZ \ --elec_cnt.period 100 \ - --pos_e.period 1 \ --period 1 0 1" TBG_pngYZ="--png_e.period 10 --png_e.axis yz --png_e.slicePoint 0.5 --png_e.folder pngElectronsYZ" diff --git a/src/picongpu/include/fields/FieldJ.kernel b/src/picongpu/include/fields/FieldJ.kernel index 18599e30aa..c263ccf5ed 100644 --- a/src/picongpu/include/fields/FieldJ.kernel +++ b/src/picongpu/include/fields/FieldJ.kernel @@ -66,10 +66,10 @@ __global__ void kernelComputeCurrent(JBox fieldJ, /* thread id, can be greater than cellsPerSuperCell*/ const int linearThreadIdx = DataSpaceOperations::template map (threadIndex); - + const uint32_t virtualBlockId = linearThreadIdx / cellsPerSuperCell; /* move linearThreadIdx for all threads to [0;cellsPerSuperCell) */ - const int virtualLinearId = linearThreadIdx-(virtualBlockId * cellsPerSuperCell); + const int virtualLinearId = linearThreadIdx - (virtualBlockId * cellsPerSuperCell); __shared__ FrameType * frame[workerMultiplier]; @@ -102,16 +102,17 @@ __global__ void kernelComputeCurrent(JBox fieldJ, if (!(isValid[0])) return; + /* This memory is used by all virtual blocks*/ PMACC_AUTO(cachedJ, CachedBox::create < 0, typename JBox::ValueType > (BlockDescription_())); Set set(float3_X(0.0, 0.0, 0.0)); ThreadCollective collectivSet(linearThreadIdx); collectivSet(set, cachedJ); - /* now all threads can leave if they have no frame */ + /* all threads of a virtual block will leave if it has no frame */ if (!(isValid[virtualBlockId])) return; - + __syncthreads(); /* all threads can check isValid[0] because we know that * we are at end of frame list if isValid[0] is not valid @@ -134,7 +135,8 @@ __global__ void kernelComputeCurrent(JBox fieldJ, isValid[0] = isValid[workerMultiplier - 1]; if (isValid[workerMultiplier - 1]) frame[0] = &(boxPar.getPreviousFrame(*(frame[workerMultiplier - 1]), isValid[0])); - /* read all frames in sequential order*/ + /* read all frames in sequential order + * but only if workerMultiplier>=1 */ for (int i = 1; i < workerMultiplier; ++i) { isValid[i] = false; @@ -144,14 +146,18 @@ __global__ void kernelComputeCurrent(JBox fieldJ, } __syncthreads(); } - /* we wait that all threads finush the loop*/ + /* we wait that all threads finish the loop*/ __syncthreads(); - /*now we can write to global memory with all threads*/ - nvidia::functors::Add add; - const DataSpace blockCell = block * SuperCellSize::getDataSpace(); - ThreadCollective collectivAdd(linearThreadIdx); - PMACC_AUTO(fieldJBlock, fieldJ.shift(blockCell)); - collectivAdd(add, fieldJBlock, cachedJ); + /* Write to global memory + * We only use virtual block 0, other frame could have left already */ + if (virtualBlockId == 0) + { + nvidia::functors::Add add; + const DataSpace blockCell = block * SuperCellSize::getDataSpace(); + ThreadCollective collectivAdd(linearThreadIdx); + PMACC_AUTO(fieldJBlock, fieldJ.shift(blockCell)); + collectivAdd(add, fieldJBlock, cachedJ); + } __syncthreads(); } From 0323ce970122738e94f0599be51fca7b50591df7 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Wed, 2 Oct 2013 14:15:45 +0200 Subject: [PATCH 54/54] Fix string compare for PGI --- src/picongpu/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/picongpu/CMakeLists.txt b/src/picongpu/CMakeLists.txt index e5ff47cf7b..07b8a54ddb 100644 --- a/src/picongpu/CMakeLists.txt +++ b/src/picongpu/CMakeLists.txt @@ -176,7 +176,7 @@ IF(CMAKE_COMPILER_IS_GNUCXX) ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") # PGI -ELSEIF(${CMAKE_CXX_COMPILER_ID} STREQUAL "PGI") +ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Minform=inform") ENDIF()