From 3003fd757e8092104194de9821d4ea5efbaa01a5 Mon Sep 17 00:00:00 2001 From: Lee James O'Riordan Date: Fri, 15 Jul 2016 19:24:12 +0900 Subject: [PATCH] Dislocation engineering release --- Makefile | 2 +- bin/run.sh | 9 ++++----- bin/run_params.conf | 15 ++++++++++----- py/vis.py | 13 +------------ py/vort.py | 2 +- src/split_op.cu | 31 +++++++++++++++++++++---------- src/tracker.cc | 2 +- 7 files changed, 39 insertions(+), 35 deletions(-) diff --git a/Makefile b/Makefile index e6e0597b..3b538178 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -CUDA_HOME = /usr/local/cuda +CUDA_HOME = /apps/free/cuda/7.5.18/ GPU_ARCH = sm_30 OS:= $(shell uname) ifeq ($(OS),Darwin) diff --git a/bin/run.sh b/bin/run.sh index 87374938..1d1411b9 100755 --- a/bin/run.sh +++ b/bin/run.sh @@ -29,10 +29,10 @@ #SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #!/bin/bash i=0 -EMAIL=lee.oriordan@oist.jp +EMAIL=$1 count=0 -NAME=$1 -PARAMS=$2 +NAME=$2 +PARAMS=$3 declare -a JOBS=(-1 -1 -1 -1 -1 -1 -1 -1) function run_gpue_test { echo $1 @@ -54,7 +54,7 @@ function run_gpue { cd ./$NAME$A pwd >> result.log echo $1 >>result.log - mail -s "#Started GPU Job# $A" lee.oriordan@oist.jp < result.log + mail -s "#Started GPU Job# $A" ${EMAIL} < result.log ./gpue $1 2>&1> result.log mkdir -p ./images #python ./py/vis.py >> result.log @@ -62,7 +62,6 @@ function run_gpue { cd ./images ls | grep wfc_evr | grep _abs | grep png | sort -k3 -t _ -n > list1.txt;mencoder mf://@list1.txt -mf w=1280:h=1024:fps=24:type=png -oac copy -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:predia=2:dia=2:vmax_b_frames=2:vb_strategy=1:precmp=2:cmp=2:subcmp=2:preme=2:qns=2:vbitrate=10000000 -o wfc_${PWD##*/}.avi rm -rf ./*.png - #python ./py/hist3d.py rm wfc* mail -s "#Completed GPU Job# $A" $EMAIL < $(echo $(cat result.log; cat ./Params.dat)) cd ../../../../.. diff --git a/bin/run_params.conf b/bin/run_params.conf index c0a5029d..3a52eb45 100755 --- a/bin/run_params.conf +++ b/bin/run_params.conf @@ -51,12 +51,17 @@ # vortex creation. # -X, -Y are omega_x and omega_y (omega_perp when both are equal) # -k is the potential kick mode. 0 is off, 1 is periodic, 2 is single. -# -O is the kicking potential rotation angle. +# -O is the kicking potential/kill vortex relative phase rotation angle. # -S is the kicking potential lattice spacing scaling. # -W turns on or off the wavefunction output printing. # -V, -U are the x and y shifts of the kicking potential. +# -a, turns on the graph calculation code. Necessary for vortex annihilation +# -K, selects vortex with specified UID for termination. Plot adjacency matrix of initial state to determine which index (graph_0 --- need to do simulation before you get this; will be updated at some point) +# -D, sets offset for kill vortex distance radially --x 1024 -y 1024 -T 1e-5 -t 1e-5 -n 1e6 -g 0 -e 2e5 -p 1000 -r 1 -w 0.995 -o 100 -d 4 -l 1 -s 1 -i 1.0 -P 10000.0 -G 1.0 -L 0 -X 6.28318 -Y 6.28318 -k 0 -O 10.0 -W 1 -U 0 -V 0 -S 3.0 --x 1024 -y 1024 -T 1e-5 -t 1e-5 -n 1e6 -g 0 -e 2e5 -p 1000 -r 1 -w 0.995 -o 100 -d 4 -l 1 -s 1 -i 1.0 -P 15000.0 -G 1.0 -L 0 -X 6.28318 -Y 6.28318 -k 0 -O 10.0 -W 1 -U 0 -V 0 -S 3.0 --x 1024 -y 1024 -T 1e-5 -t 1e-5 -n 1e6 -g 0 -e 2e5 -p 1000 -r 1 -w 0.995 -o 100 -d 4 -l 1 -s 1 -i 1.0 -P 20000.0 -G 1.0 -L 0 -X 6.28318 -Y 6.28318 -k 0 -O 10.0 -W 1 -U 0 -V 0 -S 3.0 --x 1024 -y 1024 -T 1e-5 -t 1e-5 -n 1e6 -g 0 -e 2e5 -p 1000 -r 1 -w 0.995 -o 100 -d 4 -l 1 -s 1 -i 1.0 -P 25000.0 -G 1.0 -L 0 -X 6.28318 -Y 6.28318 -k 0 -O 10.0 -W 1 -U 0 -V 0 -S 3.0 + +# Sample simulation data sets +-x 256 -y 256 -T 1e-5 -t 1e-5 -n 1e6 -g 2.01e5 -e 2e5 -p 1000 -r 0 -w 0.65 -o 100 -d 0 -l 1 -s 1 -i 1.0 -P 10000.0 -G 1.0 -L 10 -X 6.28318 -Y 6.28318 -k 0 -O 0.0 -W 1 -U 0 -V 0 -S 3.0 -a 1 -K 1 -D 0.0 +-x 512 -y 512 -T 1e-5 -t 1e-5 -n 1e6 -g 2.01e5 -e 2e5 -p 1000 -r 0 -w 0.75 -o 100 -d 1 -l 1 -s 1 -i 1.0 -P 15000.0 -G 1.0 -L 20 -X 6.28318 -Y 6.28318 -k 0 -O 10.0 -W 1 -U 0 -V 0 -S 3.0 -a 1 -K 2 -D 1.0 +-x 1024 -y 1024 -T 1e-5 -t 1e-5 -n 1e6 -g 2.01e5 -e 2e5 -p 1000 -r 0 -w 0.85 -o 100 -d 2 -l 1 -s 1 -i 1.0 -P 20000.0 -G 1.0 -L 30 -X 6.28318 -Y 6.28318 -k 0 -O 20.0 -W 1 -U 0 -V 0 -S 3.0 -a 1 -K 3 -D -4.5 +-x 2048 -y 2048 -T 1e-5 -t 1e-5 -n 1e6 -g 2.01e5 -e 2e5 -p 1000 -r 0 -w 0.95 -o 100 -d 3 -l 1 -s 1 -i 1.0 -P 25000.0 -G 1.0 -L 0 -X 6.28318 -Y 6.28318 -k 0 -O 0.0 -W 1 -U 0 -V 0 -S 3.0 -a 0 -K 0 -D 0 diff --git a/py/vis.py b/py/vis.py index 03e98ead..c9e1853a 100755 --- a/py/vis.py +++ b/py/vis.py @@ -31,7 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ''' import os -CPUs = 4# os.environ['SLURM_JOB_CPUS_PER_NODE'] +CPUs = os.environ['SLURM_JOB_CPUS_PER_NODE'] print "Number of cores: " + str(CPUs) from numpy import genfromtxt import math as m @@ -320,13 +320,6 @@ def overlap(dataName, initValue, finalValue, increment): print i, np.sum(b) if __name__ == '__main__': - try: - delaunay('vort_arr_',0) - stats.lsFit(0,evMaxVal,incr) - hist3d.plot_hist_pcolor(0,evMaxVal,incr,'b') - vort_traj('traj_plot',200) - except: - print "Unhandled error occurred. Blame Lee." opPot('V_opt_0',200) opPot('V_0',200) opPot('K_0',200) @@ -345,10 +338,6 @@ def overlap(dataName, initValue, finalValue, increment): while evImgList: i=evImgList.pop() ev_proc.append(Process(target=image_gen_single,args=("wfc_ev",i,200,0b101000))) - #ev_proc.append(Process(target=mpld3.show,)) - ev_proc.append(Process(target=delaunay,args=("vort_lsq_",'.csv',i))) - ev_proc.append(Process(target=voronoi,args=("vort_lsq_",'.csv',i))) - ev_proc.append(Process(target=hist_gen,args=("hist_ev",i,128))) proc = gnd_proc + ev_proc while proc: #if (mp.cpu_count()/2) > len(mp.active_children()): diff --git a/py/vort.py b/py/vort.py index 4102ee59..d1e61bc2 100644 --- a/py/vort.py +++ b/py/vort.py @@ -188,7 +188,7 @@ def idx_min_dist(self,vortex, isSelf=False): #Closest vtx to self return (ret_idx,r) ############################################################################### - def remove(self,pos): #Remove vortices outside articificial boundary + def remove(self,pos): #Remove vortices outside artificial boundary ############################################################################### if self.length > 1 and pos > 1: current = self.element(pos-1).next diff --git a/src/split_op.cu b/src/split_op.cu index b4decbdb..a25adb54 100644 --- a/src/split_op.cu +++ b/src/split_op.cu @@ -48,7 +48,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. unsigned int LatticeGraph::Edge::suid = 0; unsigned int LatticeGraph::Node::suid = 0; - +double DX = 0.0; char buffer[100]; int verbose; //Print more info. Not curently implemented. int device; //GPU ID choice. @@ -64,7 +64,7 @@ double x0_shift, y0_shift; //Optical lattice shift parameters. double Rxy; //Condensate scaling factor. double a0x, a0y; //Harmonic oscillator length in x and y directions double sepMinEpsilon=0.0; //Minimum separation for epsilon. - +int kill_idx = -1;; /* * Checks CUDA routines have exitted correctly. */ @@ -395,7 +395,7 @@ int evolve( cufftDoubleComplex *gpuWfc, case 2: //Real-time evolution, constant Omega value. fileName = "wfc_ev"; vortexLocation = (int *) calloc(xDim * yDim, sizeof(int)); - num_vortices[0] = Tracker::findVortex(vortexLocation, wfc, 1e-4, xDim, x, i); + num_vortices[0] = Tracker::findVortex(vortexLocation, wfc, 2e-4, xDim, x, i); if (i == 0) { //If initial step, locate vortices, least-squares to find exact centre, calculate lattice angle, generate optical lattice. vortCoords = (struct Vtx::Vortex *) malloc( @@ -447,14 +447,15 @@ int evolve( cufftDoubleComplex *gpuWfc, } if(i==0) { //Lambda for vortex annihilation/creation. - auto killIt=[&](int idx) { - WFC::phaseWinding(Phi, 1, x, y, dx, dy, lattice.getVortexUid(idx)->getData().coordsD.x, - lattice.getVortexUid(idx)->getData().coordsD.y, xDim); + auto killIt=[&](int idx, int winding, double delta_x) { + WFC::phaseWinding(Phi, winding, x, y, dx, dy, lattice.getVortexUid(idx)->getData().coordsD.x + cos(angle_sweep + vort_angle)*delta_x, + lattice.getVortexUid(idx)->getData().coordsD.y + sin(angle_sweep + vort_angle)*delta_x, xDim); cudaMemcpy(Phi_gpu, Phi, sizeof(double) * xDim * yDim, cudaMemcpyHostToDevice); cMultPhi <<>> (gpuWfc, Phi_gpu, gpuWfc); - }; - //killIt(44); //Kills vortex with UID 44 - + }; + if (kill_idx > 0){ + killIt(kill_idx,1,DX); //Kills vortex with UID idx + } } lattice.createEdges(1.5 * 2e-5 / dx); @@ -768,7 +769,7 @@ template void parSum(T *gpuToSumArr, T *gpuParSum, int xDim, int yDi //################################################################################################################### int parseArgs(int argc, char** argv){ int opt; - while ((opt = getopt (argc, argv, "d:x:y:w:G:g:e:T:t:n:p:r:o:L:l:s:i:P:X:Y:O:k:W:U:V:S:a:")) != -1) { + while ((opt = getopt (argc, argv, "D:d:x:y:w:G:g:e:T:t:n:p:r:o:L:l:s:i:P:X:Y:O:k:W:U:V:S:a:K:")) != -1) { switch (opt) { case 'x': @@ -906,6 +907,16 @@ int parseArgs(int argc, char** argv){ printf("Argument for graph is %d\n",graph); appendData(¶ms,"graph",graph); break; + case 'K': + kill_idx = atoi(optarg); + printf("Argument for kill_idx is %d\n",kill_idx); + appendData(¶ms,"kill_idx",kill_idx); + break; + case 'D': + DX = atoi(optarg); + printf("Argument for DX is %d\n",DX); + appendData(¶ms,"DX",DX); + break; case '?': if (optopt == 'c') { fprintf (stderr, "Option -%c requires an argument.\n", optopt); diff --git a/src/tracker.cc b/src/tracker.cc index f66300d7..ad3a78a8 100644 --- a/src/tracker.cc +++ b/src/tracker.cc @@ -298,7 +298,7 @@ namespace Tracker { location = i; } } - double ang=(fmod(atan2( (vortCoords[location].coords.y - central.coords.y), (vortCoords[location].coords.x - central.coords.x) ),PI/3)); + double ang=0;//(fmod(atan2( (vortCoords[location].coords.y - central.coords.y), (vortCoords[location].coords.x - central.coords.x) ),PI/3)); printf("Angle=%e\n",ang); return PI/3 - ang;