It's alive!

This commit is contained in:
MoonGem 2018-03-26 20:28:45 -05:00 committed by GitHub
parent 9fc7bc9c17
commit 01f4850647
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,16 +5,17 @@ from io import StringIO
ppservers = ()
#ppservers = ("10.0.0.1",)
#note threads are automatically detected for performance
#number of jobs to append each round
# Number of jobs to run
parts = 1280000
#number of times to loop jobs
rounds = 1280000
jobs = []
current = 0
def backtesting(ind):
er1 = str(ind)
ou1 = str(ind * 1024)
@ -37,23 +38,19 @@ def backtesting(ind):
if len(sys.argv) > 1:
ncpus = int(sys.argv[1])
# Creates jobserver with ncpus workers
job_server = pp.Server(ncpus, ppservers=ppservers, restart=True)
job_server = pp.Server(150, ppservers=ppservers, restart=True)
else:
# Creates jobserver with automatically detected number of workers
job_server = pp.Server(ppservers=ppservers, restart=True)
job_server = pp.Server(150, ppservers=ppservers, restart=True)
print("Starting pp with", job_server.get_ncpus(), "workers")
start_time = time.time()
# Since jobs are not equal in the execution time, division of the problem
# into a 100 of small subproblems leads to a better load balancing
for index in range(rounds):
print('Please wait... it takes a few minutes to hit the while loop after all jobs are appended for the round.')
for index in range(parts):
jobs.append(job_server.submit(backtesting, (index,)))
# print(index)
while True:
for job in jobs:
try: