Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
02e2655
1
Parent(s):
55f53cf
Make job spawn asynchronous
Browse files- julia/sr.jl +13 -11
julia/sr.jl
CHANGED
@@ -791,7 +791,7 @@ function fullRun(niterations::Integer;
|
|
791 |
|
792 |
# # 2. Start the cycle on every process:
|
793 |
@sync for i=1:npopulations
|
794 |
-
@async allPops[i] = @
|
795 |
end
|
796 |
println("Started!")
|
797 |
cycles_complete = npopulations * niterations
|
@@ -868,20 +868,22 @@ function fullRun(niterations::Integer;
|
|
868 |
end
|
869 |
end
|
870 |
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
|
|
|
|
879 |
end
|
880 |
end
|
|
|
881 |
end
|
882 |
-
|
883 |
end
|
884 |
-
@async put!(channels[i], fetch(allPops[i]))
|
885 |
|
886 |
cycles_complete -= 1
|
887 |
num_equations += ncyclesperiteration * npop / 10.0
|
|
|
791 |
|
792 |
# # 2. Start the cycle on every process:
|
793 |
@sync for i=1:npopulations
|
794 |
+
@async allPops[i] = @spawn run(fetch(allPops[i]), ncyclesperiteration, verbosity=verbosity)
|
795 |
end
|
796 |
println("Started!")
|
797 |
cycles_complete = npopulations * niterations
|
|
|
868 |
end
|
869 |
end
|
870 |
|
871 |
+
@async begin
|
872 |
+
allPops[i] = @spawn let
|
873 |
+
tmp_pop = run(cur_pop, ncyclesperiteration, verbosity=verbosity)
|
874 |
+
for j=1:tmp_pop.n
|
875 |
+
if rand() < 0.1
|
876 |
+
tmp_pop.members[j].tree = simplifyTree(tmp_pop.members[j].tree)
|
877 |
+
tmp_pop.members[j].tree = combineOperators(tmp_pop.members[j].tree)
|
878 |
+
if shouldOptimizeConstants
|
879 |
+
tmp_pop.members[j] = optimizeConstants(tmp_pop.members[j])
|
880 |
+
end
|
881 |
end
|
882 |
end
|
883 |
+
tmp_pop
|
884 |
end
|
885 |
+
put!(channels[i], fetch(allPops[i]))
|
886 |
end
|
|
|
887 |
|
888 |
cycles_complete -= 1
|
889 |
num_equations += ncyclesperiteration * npop / 10.0
|