-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #126 from Milkyway-at-home/mendel_auto_diff
Mendel auto diff
- Loading branch information
Showing
137 changed files
with
1,119,089 additions
and
4,096 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
########################################################### | ||
#This code runs the model tests and records their results.# | ||
# Useful for when they need to be updated. # | ||
# Needs get_test_likelihood.sh to work. # | ||
########################################################### | ||
|
||
#Import necessary packages | ||
import os | ||
import os.path as pth | ||
|
||
#Set Pathways | ||
lua_pth = '~/milkywayathome_client/nbody/tests/RunTestUnits.lua' | ||
tmp_pth = '~/likelitemp.out' | ||
result_pth = '~/test_likelihoods.txt' | ||
|
||
#Define lists | ||
|
||
model_list = ["model_1","model_2","model_3","model_4","model_5","model_5_bounds_test","model_6","model_7","model_8","model_9","model_ninkovic","model_triaxial","model_newhist1","model_newhist2","model_newhist3","model_LMC","model_bar","model_LMC_bar"] | ||
body_list = ["100","1024","10000"] | ||
seed_list = ["670828913", "886885833", "715144259", "430281807", "543966758"] | ||
|
||
#model_list = ["model_1","model_2"] | ||
#body_list = ["100","1024"] | ||
#seed_list = ["670828913", "886885833"] | ||
|
||
empty_seed_array = [] | ||
empty_body_array = [] | ||
likelihoods = [] | ||
for s in range(len(seed_list)): | ||
empty_seed_array.append(' ') | ||
for t in range(len(body_list)): | ||
exec("empty_body_array.append("+str(empty_seed_array)+")") | ||
for u in range(len(model_list)): | ||
exec("likelihoods.append("+str(empty_body_array)+")") | ||
|
||
#Loop through all tests | ||
|
||
for i in range(len(model_list)): | ||
for j in range(len(body_list)): | ||
for k in range(len(seed_list)): | ||
#Change seed in lua file | ||
print("REWRITING LUA FILE................................") | ||
temp = open('~/lua_temp.lua','w+') | ||
lua_file = open(lua_pth,'r') | ||
for line in lua_file: | ||
if (line.startswith('local testSeed =')): | ||
temp.write('local testSeed = testSeeds['+str(k+1)+']\n') | ||
else: | ||
temp.write(line) | ||
lua_file.close() | ||
temp.close() | ||
os.system('rm '+lua_pth) | ||
os.rename('~/lua_temp.lua',lua_pth) | ||
|
||
#Run test and get likelihood | ||
print("Running "+model_list[i]+"__"+body_list[j]+"_test: SEED = "+seed_list[k]) | ||
check = False | ||
os.system("sh get_test_likelihoods.sh "+model_list[i]+" "+body_list[j]) | ||
tmp_file = open(tmp_pth, 'r') | ||
test_num = 0 | ||
for line in tmp_file: | ||
if (line.startswith('test ')): | ||
test_num = int(line.replace('test ','')) | ||
prefix = str(test_num)+": " | ||
if (line.startswith(prefix+"<search_likelihood>")): | ||
string = line.replace(prefix+"<search_likelihood>-",'') | ||
like_score = float(string.replace('</search_likelihood>','')) | ||
print("Likelihood = "+str(like_score)) | ||
likelihoods[i][j][k] = str(like_score) | ||
check = True | ||
if(not check): | ||
assert False #NO LIKELIHOOD FOUND! | ||
tmp_file.close() | ||
os.system('rm '+tmp_pth) | ||
|
||
|
||
#Write data | ||
results = open(result_pth,'w+') | ||
for i in range(len(model_list)): | ||
results.write(' ["'+model_list[i]+'"] = {\n') | ||
for j in range(len(body_list)): | ||
results.write(' ["'+body_list[j]+'"] = {\n') | ||
for k in range(len(seed_list)): | ||
if (k+1 == len(seed_list)): | ||
results.write(' ["'+seed_list[k]+'"] = '+str(likelihoods[i][j][k])+'\n') | ||
else: | ||
results.write(' ["'+seed_list[k]+'"] = '+str(likelihoods[i][j][k])+',\n') | ||
if (j+1 == len(body_list)): | ||
results.write(' }\n') | ||
else: | ||
results.write(' },\n\n') | ||
if (i+1 == len(model_list)): | ||
results.write(' }\n') | ||
else: | ||
results.write(' },\n\n') | ||
results.close() | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
cd test_env/ | ||
|
||
ctest -R $1__$2_test -VV > ~/likelitemp.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/bash | ||
#/* Copyright (c) 2016 Siddhartha Shelton */ | ||
|
||
rebuild=true | ||
run=true | ||
run_compare=false | ||
compare_only=false | ||
get_flag_list=false | ||
|
||
PathToMilkyWayAtHomeClientFolder='INSERT PATHWAY HERE' | ||
|
||
if $rebuild | ||
then | ||
rm -r build | ||
mkdir build | ||
cd build | ||
cmake -DCMAKE_BUILD_TYPE=Release -DNBODY_DEV_OPTIONS=ON -DNBODY_GL=OFF -DBOINC_APPLICATION=ON -DSEPARATION=OFF -DDOUBLEPREC=ON -DNBODY_OPENMP=ON -DNBODY_OPENCL=OFF -DAUTODIFF=OFF -DAUTODIFF_LOG=OFF $PathToMilkyWayAtHomeClientFolder/milkywayathome_client/ | ||
make -j | ||
fi | ||
|
||
cd $PathToMilkyWayAtHomeClientFolder/build/bin | ||
|
||
if $run | ||
then | ||
./milkyway_nbody \ | ||
-f $PathToMilkyWayAtHomeClientFolder/milkywayathome_client/nbody/sample_workunits/for_developers.lua \ | ||
-o $PathToMilkyWayAtHomeClientFolder/test.out \ | ||
-z $PathToMilkyWayAtHomeClientFolder/test.hist \ | ||
-n 8 -b -w 1 -P -e 54231651\ | ||
-i 4.0 1.0 0.2 0.2 12.0 0.2 \ | ||
|
||
fi | ||
|
||
if $run_compare | ||
then | ||
./milkyway_nbody \ | ||
-f $PathToMilkyWayAtHomeClientFolder/milkywayathome_client/nbody/sample_workunits/for_developers.lua \ | ||
-o $PathToMilkyWayAtHomeClientFolder/output.out \ | ||
-z $PathToMilkyWayAtHomeClientFolder/output.hist \ | ||
-h $PathToMilkyWayAtHomeClientFolder/test.hist \ | ||
-y $PathToMilkyWayAtHomeClientFolder/output.ad \ | ||
-n 8 -b -w 1 -P -e 54231651\ | ||
-p 4.0 1.0 0.2 0.2 12.0 0.2 \ | ||
|
||
fi | ||
|
||
#SMU = 222,288.47 SOLAR MASSES | ||
|
||
#OPTIONS: | ||
#-s -> compare using only emd and cost component | ||
#-S -> use emd, cost, beta dispersion | ||
#-V -> use emd, cost, velocity dispersion | ||
#-D -> use emd, cost, beta dispersion and velocity dispersion | ||
if $compare_only | ||
then | ||
./milkyway_nbody \ | ||
-h $PathToMilkyWayAtHomeClientFolder/test.hist \ | ||
-S $PathToMilkyWayAtHomeClientFolder/output.hist \ | ||
|
||
fi | ||
|
||
|
||
# if you run: | ||
|
||
if $get_flag_list | ||
then | ||
./milkyway_nbody --help | ||
# it will show you what all the flags mean | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.