def step_1(self, instance): """This step downloads a sample UTF-8 file from a remote websever and calculates the SHA1 checksum of that file. The checksum is written to an output file and tranferred back to the host running this script. """ k = Kernel(name="misc.chksum") k.arguments = ["--inputfile=UTF-8-demo.txt", "--outputfile=checksum{0}.sha1".format(instance)] k.upload_input_data = "UTF-8-demo.txt" k.download_output_data = "checksum{0}.sha1".format(instance) k.post_exec = ['if [ -f "checksu{0}.sha1" ]; then exit 0; else echo "File checksum{0}.sha1 does not exist" >&2; exit 1; fi'.format(instance)] return k
def step_1(self, instance): """This step downloads a sample UTF-8 file from a remote websever and calculates the SHA1 checksum of that file. The checksum is written to an output file and tranferred back to the host running this script. """ k = Kernel(name="misc.chksum") k.arguments = [ "--inputfile=UTF-8-demo.txt", "--outputfile=checksum{0}.sha1".format(instance) ] k.upload_input_data = "UTF-8-demo.txt" k.download_output_data = "checksum{0}.sha1".format(instance) k.post_exec = [ 'if [ -f "checksu{0}.sha1" ]; then exit 0; else echo "File checksum{0}.sha1 does not exist" >&2; exit 1; fi' .format(instance) ] return k
def analysis_step(self, iteration, instance): ''' function : Merge the results of each of the simulation instances and run LSDMap analysis to generate the new coordinate file. Split this new coordinate file into smaller files to be used by the simulation stage in the next iteration. If a step as multiple kernels (say k1, k2), data generated in k1 is implicitly moved to k2 (if k2 requires). Data which needs to be moved between the various steps (pre_loop, simulation_step, analysis_step) needs to be mentioned by the user. pre_lsdmap :- Purpose : The output of each gromacs instance in the simulation_step is a small coordinate file. Concatenate such files from each of the gromacs instances to form a larger file. There is one instance of pre_lsdmap per iteration. Arguments : --numCUs = number of simulation instances / number of small files to be concatenated lsdmap :- Purpose : Perform LSDMap on the large coordinate file to generate weights and eigen values. There is one instance of lsdmap per iteration (MSSA : Multiple Simulation Single Analysis model). Arguments : --config = name of the config file to be used during LSDMap post_lsdmap :- Purpose : Use the weights, eigen values generated in lsdmap along with other parameter files from pre_loop to generate the new coordinate file to be used by the simulation_step in the next iteration. There is one instance of post_lsdmap per iteration. Arguments : --num_runs = number of configurations to be generated in the new coordinate file --out = output filename --cycle = iteration number --max_dead_neighbors = max dead neighbors to be considered --max_alive_neighbors = max alive neighbors to be considered --numCUs = number of simulation instances/ number of smaller files ''' pre_ana = Kernel(name="md.pre_lsdmap") pre_ana.arguments = ["--numCUs={0}".format(Kconfig.num_CUs)] pre_ana.post_exec = ["echo 2 | trjconv -f tmp.gro -s tmp.gro -o tmpha.gro"] pre_ana.link_input_data = ["$PRE_LOOP/pre_analyze.py > pre_analyze.py"] for i in range(1,Kconfig.num_CUs+1): pre_ana.link_input_data = pre_ana.link_input_data + ["$SIMULATION_ITERATION_{2}_INSTANCE_{0}/out.gro > out{1}.gro".format(i,i-1,iteration)] pre_ana.copy_output_data = ['tmpha.gro > $PRE_LOOP/tmpha.gro','tmp.gro > $PRE_LOOP/tmp.gro'] lsdmap = Kernel(name="md.lsdmap") lsdmap.arguments = ["--config={0}".format(os.path.basename(Kconfig.lsdm_config_file))] lsdmap.link_input_data = ['$PRE_LOOP/{0} > {0}'.format(os.path.basename(Kconfig.lsdm_config_file)),'$PRE_LOOP/lsdm.py > lsdm.py','$PRE_LOOP/tmpha.gro > tmpha.gro'] lsdmap.cores = RPconfig.PILOTSIZE if iteration > 1: lsdmap.link_input_data += ['$ANALYSIS_ITERATION_{0}_INSTANCE_1/weight.w > weight.w'.format(iteration-1)] lsdmap.copy_output_data = ['weight.w > $PRE_LOOP/weight.w'] lsdmap.copy_output_data = ['tmpha.ev > $PRE_LOOP/tmpha.ev','out.nn > $PRE_LOOP/out.nn'] if(iteration%Kconfig.nsave==0): lsdmap.download_output_data=['lsdmap.log > backup/iter{0}/lsdmap.log'.format(iteration)] post_ana = Kernel(name="md.post_lsdmap") post_ana.link_input_data = ["$PRE_LOOP/post_analyze.py > post_analyze.py", "$PRE_LOOP/select.py > select.py", "$PRE_LOOP/reweighting.py > reweighting.py", "$PRE_LOOP/spliter.py > spliter.py", "$PRE_LOOP/gro.py > gro.py", "$PRE_LOOP/tmp.gro > tmp.gro", "$PRE_LOOP/tmpha.ev > tmpha.ev", "$PRE_LOOP/out.nn > out.nn", "$PRE_LOOP/input.gro > input.gro"] post_ana.arguments = ["--num_runs={0}".format(Kconfig.num_runs), "--out=out.gro", "--cycle={0}".format(iteration-1), "--max_dead_neighbors={0}".format(Kconfig.max_dead_neighbors), "--max_alive_neighbors={0}".format(Kconfig.max_alive_neighbors), "--numCUs={0}".format(Kconfig.num_CUs)] if iteration > 1: post_ana.link_input_data += ['$ANALYSIS_ITERATION_{0}_INSTANCE_1/weight.w > weight_new.w'.format(iteration-1)] if(iteration%Kconfig.nsave==0): post_ana.download_output_data = ['out.gro > backup/iter{0}/out.gro'.format(iteration), 'weight.w > backup/iter{0}/weight.w'.format(iteration)] return [pre_ana,lsdmap,post_ana]