system call works. The following code can run on multi-core CPU for model selection. The random seed and other hyperparameters can be passed as arguments to the script TrainSingleEdwardModel.py. ed.set_seed() is called in TrainSingleEdwardModel.py
import os
from multiprocessing import Pool
def MyCommand(hyperparameters):
command="python TrainSingleEdwardModel.py "
command+=str(hyperparameters)
os.system(command)
if name == ‘main’:
hyperparameters=list(range(32))
#for ic in range(len(hyperparameters)):
# MyCommand(hyperparameters[ic])
cores=16
with Pool(cores) as p:
p.map(MyCommand, hyperparameters)
MyCommand(hyperparameters[4])