-
Notifications
You must be signed in to change notification settings - Fork 59
Closed
Labels
bugA bug or regressionA bug or regression
Description
Trying to run a GST reconstruction with mpi and numpy > 1.15 seems to cause issues with the ProtectedArray class.
Based on similarity with:
Seems like downgrading to numpy 1.15.0 should fix this issues. I'm still testing that.
To Reproduce
import pygsti
from pygsti.construction import std2Q_XYZICNOT
#Create a data set
target_model = std2Q_XYZICNOT.target_model()
fiducials = std2Q_XYZICNOT.fiducials
germs = std2Q_XYZICNOT.germs
maxLengths = [1,2,4,8,16]
mdl_datagen = target_model.depolarize(op_noise=0.1, spam_noise=0.001)
listOfExperiments = pygsti.construction.make_lsgst_experiment_list(target_model.operations.keys(), fiducials, fiducials, germs, maxLengths)
ds = pygsti.construction.generate_fake_data(mdl_datagen, listOfExperiments, nSamples=1000,
sampleError="multinomial", seed=1234)
pygsti.io.write_dataset("example_files/mpi_example_dataset.txt", ds)
"""
import time
import pygsti
from pygsti.construction import std2Q_XYZICNOT
#get MPI comm
from mpi4py import MPI
comm = MPI.COMM_WORLD
print("Rank %d started" % comm.Get_rank())
#define target model, fiducials, and germs as before
target_model = std2Q_XYZICNOT.target_model()
fiducials = std2Q_XYZICNOT.fiducials
germs = std2Q_XYZICNOT.germs
maxLengths = [1,2,4,8,16]
#tell gauge optimization to weight the operation matrix
# elements 100x more heavily than the SPAM vector elements, and
# to specifically weight the Gx gate twice as heavily as the other
# gates.
goParams = {'itemWeights':{'spam': 0.01, 'gates': 1.0, 'Gx': 2.0} }
#Specify a per-core memory limit (useful for larger GST calculations)
memLim = 2.1*(1024)**3 # 2.1 GB
#Perform TP-constrained GST
target_model.set_all_parameterizations("TP")
#load the dataset
ds = pygsti.io.load_dataset("example_files/mpi_example_dataset.txt")
start = time.time()
results = pygsti.do_long_sequence_gst(ds, target_model, fiducials, fiducials,
germs, maxLengths,memLimit=memLim,
gaugeOptParams=goParams, comm=comm,
verbosity=2)
end = time.time()
print("Rank %d finished in %.1fs" % (comm.Get_rank(), end-start))
if comm.Get_rank() == 0:
import pickle
pickle.dump(results, open("example_files/mpi_example_results.pkl","wb"))
"""
with open("example_files/mpi_example_script.py","w") as f:
f.write(mpiScript)
mpiexec -n 3 python3 "example_files/mpi_example_script.py"
Expected behavior
A GST reconstruction using mpi
Environment (please complete the following information):
- pyGSTi version v0.9.8.3
- python version: 3.7
- numpy version: 1.18.1
Metadata
Metadata
Assignees
Labels
bugA bug or regressionA bug or regression