From bc74311f4466e9292a3265d48147a55bbcb08761 Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Mon, 21 May 2018 15:15:33 -0600 Subject: [PATCH 01/21] Adds experimental modification for when data probabilities add up to less than 0. Currently only needed for GST profiling --- .../construction/datasetconstruction.py | 53 ++++++++++++------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/packages/pygsti/construction/datasetconstruction.py b/packages/pygsti/construction/datasetconstruction.py index 30c070187..de2163571 100644 --- a/packages/pygsti/construction/datasetconstruction.py +++ b/packages/pygsti/construction/datasetconstruction.py @@ -67,7 +67,7 @@ def generate_fake_data(gatesetOrDataset, gatestring_list, nSamples, manually incrementing seeds between those calls. aliasDict : dict, optional - A dictionary mapping single gate labels into tuples of one or more + A dictionary mapping single gate labels into tuples of one or more other gate labels which translate the given gate strings before values are computed using `gatesetOrDataset`. The resulting Dataset, however, contains the *un-translated* gate strings as keys. @@ -78,7 +78,7 @@ def generate_fake_data(gatesetOrDataset, gatestring_list, nSamples, comm : mpi4py.MPI.Comm, optional When not ``None``, an MPI communicator for distributing the computation - across multiple processors and ensuring that the *same* dataset is + across multiple processors and ensuring that the *same* dataset is generated on each processor. @@ -89,7 +89,7 @@ def generate_fake_data(gatesetOrDataset, gatestring_list, nSamples, """ TOL = 1e-10 - + if isinstance(gatesetOrDataset, _ds.DataSet): dsGen = gatesetOrDataset gsGen = None @@ -111,27 +111,27 @@ def generate_fake_data(gatesetOrDataset, gatestring_list, nSamples, for s in gatestring_list ] all_probs = gsGen.bulk_probs(trans_gatestring_list) #all_dprobs = gsGen.bulk_dprobs(gatestring_list) #DEBUG - not needed here!!! - + for k,s in enumerate(gatestring_list): #print("DB GEN %d of %d (len %d)" % (k,len(gatestring_list),len(s))) trans_s = _gstrc.translate_gatestring(s, aliasDict) if gsGen: ps = all_probs[trans_s] - + if sampleError in ("binomial","multinomial"): #Adjust to probabilities if needed (and warn if not close to in-bounds) - for ol in ps: + for ol in ps: if ps[ol] < 0: if ps[ol] < -TOL: _warnings.warn("Clipping probs < 0 to 0") ps[ol] = 0.0 - elif ps[ol] > 1: + elif ps[ol] > 1: if ps[ol] > (1+TOL): _warnings.warn("Clipping probs > 1 to 1") ps[ol] = 1.0 else: ps = _collections.OrderedDict([ (ol,frac) for ol,frac in dsGen[trans_s].fractions.items()]) - + if gsGen and sampleError in ("binomial","multinomial"): #Check that sum ~= 1 (and nudge if needed) since binomial and # multinomial random calls assume this. @@ -144,9 +144,22 @@ def generate_fake_data(gatesetOrDataset, gatestring_list, nSamples, x = min(ps[lbl],extra_p) ps[lbl] -= x; extra_p -= x else: break + elif psum < 1: + if psum < 1-TOL: _warnings.warn("Adjusting sum(probs) < 1 to 1") + needed_p = (psum-1.0) * (1.000000001) # to sum < 1+eps (numerical prec insurance) + # needed_p is NEGATIVE after the previous line + # now is is positive: + needed_p = abs(needed_p) + for lbl in ps: + if needed_p > 0: + x = min(ps[lbl], needed_p) + ps[lbl] += x # ADD here rather than subtract + needed_p -= x + else: break + #TODO: add adjustment if psum < 1? - assert(1.-TOL <= sum(ps.values()) <= 1.+TOL) - + assert(1.-TOL <= sum(ps.values()) <= 1.+TOL, 'psum={}'.format(psum)) + if nSamples is None and dsGen is not None: N = dsGen[trans_s].total #use the number of samples from the generating dataset #Note: total() accounts for other intermediate-measurment branches automatically @@ -155,13 +168,13 @@ def generate_fake_data(gatesetOrDataset, gatestring_list, nSamples, N = nSamples[k] #try to treat nSamples as a list except: N = nSamples #if not indexable, nSamples should be a single number - + #Weight the number of samples according to a WeightedGateString if isinstance(s, _gs.WeightedGateString): nWeightedSamples = int(round(s.weight * N)) else: nWeightedSamples = N - + counts = {} #don't use an ordered dict here - add_count_dict will sort keys labels = sorted(list(ps.keys())) # "outcome labels" - sort for consistent generation if sampleError == "binomial": @@ -169,13 +182,13 @@ def generate_fake_data(gatesetOrDataset, gatestring_list, nSamples, ol0,ol1 = labels[0], labels[1] counts[ol0] = rndm.binomial(nWeightedSamples, ps[ol0]) counts[ol1] = nWeightedSamples - counts[ol0] - + elif sampleError == "multinomial": countsArray = rndm.multinomial(nWeightedSamples, [ps[ol] for ol in labels], size=1) # well-ordered list of probs for i,ol in enumerate(labels): counts[ol] = countsArray[0,i] - + else: for outcomeLabel,p in ps.items(): pc = _np.clip(p,0,1) @@ -184,13 +197,13 @@ def generate_fake_data(gatesetOrDataset, gatestring_list, nSamples, elif sampleError == "round": counts[outcomeLabel] = int(round(nWeightedSamples*pc)) else: raise ValueError("Invalid sample error parameter: '%s' Valid options are 'none', 'round', 'binomial', or 'multinomial'" % sampleError) - + dataset.add_count_dict(s, counts) dataset.done_adding_data() if comm is not None: # broadcast to non-root procs dataset = comm.bcast(dataset if (comm.Get_rank() == 0) else None,root=0) - + return dataset @@ -199,20 +212,20 @@ def merge_outcomes(dataset,label_merge_dict): Creates a DataSet which merges certain outcomes in input DataSet; used, for example, to aggregate a 2-qubit 4-outcome DataSet into a 1-qubit 2-outcome DataSet. - + Parameters ---------- dataset : DataSet object - The input DataSet whose results will be compiled according to the rules + The input DataSet whose results will be compiled according to the rules set forth in label_merge_dict label_merge_dict : dictionary - The dictionary whose keys define the new DataSet outcomes, and whose items + The dictionary whose keys define the new DataSet outcomes, and whose items are lists of input DataSet outcomes that are to be summed together. For example, if a two-qubit DataSet has outcome labels "00", "01", "10", and "11", and we want to ''trace out'' the second qubit, we could use label_merge_dict = {'0':['00','01'],'1':['10','11']}. - + Returns ------- merged_dataset : DataSet object From 1a6b3d37d4a4fecbc85aee50dde98f9ff435c83e Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Mon, 21 May 2018 15:19:24 -0600 Subject: [PATCH 02/21] Updates assertion syntax --- packages/pygsti/construction/datasetconstruction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pygsti/construction/datasetconstruction.py b/packages/pygsti/construction/datasetconstruction.py index de2163571..6b336bcc3 100644 --- a/packages/pygsti/construction/datasetconstruction.py +++ b/packages/pygsti/construction/datasetconstruction.py @@ -158,7 +158,7 @@ def generate_fake_data(gatesetOrDataset, gatestring_list, nSamples, else: break #TODO: add adjustment if psum < 1? - assert(1.-TOL <= sum(ps.values()) <= 1.+TOL, 'psum={}'.format(psum)) + assert 1.-TOL <= sum(ps.values()) <= 1.+TOL, 'psum={}'.format(psum) if nSamples is None and dsGen is not None: N = dsGen[trans_s].total #use the number of samples from the generating dataset From 6d0e59e5a1afab2f809aa937e30ed5387e09e06a Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Tue, 22 May 2018 08:18:34 -0600 Subject: [PATCH 03/21] Adds iterative probability fixes for really bad datagen correction --- .../construction/datasetconstruction.py | 55 +++++++++++-------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/packages/pygsti/construction/datasetconstruction.py b/packages/pygsti/construction/datasetconstruction.py index 6b336bcc3..c98cad0f3 100644 --- a/packages/pygsti/construction/datasetconstruction.py +++ b/packages/pygsti/construction/datasetconstruction.py @@ -136,29 +136,38 @@ def generate_fake_data(gatesetOrDataset, gatestring_list, nSamples, #Check that sum ~= 1 (and nudge if needed) since binomial and # multinomial random calls assume this. psum = sum(ps.values()) - if psum > 1: - if psum > 1+TOL: _warnings.warn("Adjusting sum(probs) > 1 to 1") - extra_p = (psum-1.0) * (1.000000001) # to sum < 1+eps (numerical prec insurance) - for lbl in ps: - if extra_p > 0: - x = min(ps[lbl],extra_p) - ps[lbl] -= x; extra_p -= x - else: break - elif psum < 1: - if psum < 1-TOL: _warnings.warn("Adjusting sum(probs) < 1 to 1") - needed_p = (psum-1.0) * (1.000000001) # to sum < 1+eps (numerical prec insurance) - # needed_p is NEGATIVE after the previous line - # now is is positive: - needed_p = abs(needed_p) - for lbl in ps: - if needed_p > 0: - x = min(ps[lbl], needed_p) - ps[lbl] += x # ADD here rather than subtract - needed_p -= x - else: break - - #TODO: add adjustment if psum < 1? - assert 1.-TOL <= sum(ps.values()) <= 1.+TOL, 'psum={}'.format(psum) + adjusted = False + if psum > 1+TOL: + adjusted = True + _warnings.warn("Adjusting sum(probs) > 1 to 1") + if psum < 1-TOL: + adjusted = True + _warnings.warn("Adjusting sum(probs) < 1 to 1") + # The following while loop is needed if the data generating gateset + # is bad enough that one loop over the probabilities is not enough + OVERTOL = 1.0 + TOL + UNDERTOL = 1.0 - TOL + normalized = lambda : UNDERTOL <= sum(ps.values()) <= OVERTOL + while not normalized(): + if psum > 1: + extra_p = (psum-1.0) * OVERTOL + for lbl in ps: + if extra_p > 0: + x = min(ps[lbl],extra_p) + ps[lbl] -= x; extra_p -= x + else: break + elif psum < 1: + needed_p = abs((psum-1.0) * UNDERTOL) + for lbl in ps: + if needed_p > 0: + x = min(ps[lbl], needed_p) + ps[lbl] += x # ADD here rather than subtract + needed_p -= x + else: break + psum = sum(ps.values()) + assert normalized(), 'psum={}'.format(psum) + if adjusted: + _warnings.warn('Adjustment finished') if nSamples is None and dsGen is not None: N = dsGen[trans_s].total #use the number of samples from the generating dataset From 3704c127cf6b0204c04190fab4d0d431410635f5 Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Tue, 22 May 2018 14:01:51 -0600 Subject: [PATCH 04/21] Adds cprofile decorator --- packages/pygsti/tools/profile.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 packages/pygsti/tools/profile.py diff --git a/packages/pygsti/tools/profile.py b/packages/pygsti/tools/profile.py new file mode 100644 index 000000000..0666f3ecf --- /dev/null +++ b/packages/pygsti/tools/profile.py @@ -0,0 +1,21 @@ +import cProfile + +@profile(filename="profile_out") +def profile(filename=None, comm=MPI.COMM_WORLD): + def prof_decorator(f): + def wrap_f(*args, **kwargs): + pr = cProfile.Profile() + pr.enable() + result = f(*args, **kwargs) + pr.disable() + + if filename is None: + pr.print_stats() + else: + filename_r = filename + ".{}".format(comm.rank) + pr.dump_stats(filename_r) + + return result + return wrap_f + return prof_decorator + From 585f04d91c16ae31fe430866cc8a0c8062cd179e Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Wed, 23 May 2018 06:21:23 -0600 Subject: [PATCH 05/21] Adds cprofile decorator for remote profiling --- packages/pygsti/tools/profile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pygsti/tools/profile.py b/packages/pygsti/tools/profile.py index 0666f3ecf..fa5275865 100644 --- a/packages/pygsti/tools/profile.py +++ b/packages/pygsti/tools/profile.py @@ -1,6 +1,6 @@ import cProfile +from mpi4py import MPI -@profile(filename="profile_out") def profile(filename=None, comm=MPI.COMM_WORLD): def prof_decorator(f): def wrap_f(*args, **kwargs): From c93bca93cc8c4e75cd5fb772c9ff9de2cbe50f4b Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Thu, 24 May 2018 09:59:02 -0600 Subject: [PATCH 06/21] Adds a few tweaks to doc-checking --- test/checkDocs.py | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/test/checkDocs.py b/test/checkDocs.py index a5346e685..aa8ff6cf2 100755 --- a/test/checkDocs.py +++ b/test/checkDocs.py @@ -2,31 +2,47 @@ import os.path, importlib, pkgutil, sys import pygsti +from pprint import pprint + from inspect import * +import inspect + +missing = [] + +def check_args_in_docstring(item): + args, _, kwargs, _ = getargspec(item) + if kwargs is None: + kwargs = [] + for arg in args + [k for k, v in kwargs]: + if item.__doc__ is None or arg not in item.__doc__: + missing.append(item) def check_function(f): - pass + print('Checking function') + check_args_in_docstring(f) def check_class(c): - pass + check(c) def check_method(m): - pass + check_args_in_docstring(m) -def check_module(module): +def check(module): for member in getmembers(module): - if isfunction(member): - pass - if ismethod(member): - pass - if isclass(member): - pass - if ismodule(member): - check_module(member) - print(member) + if 'pygsti' in str(member[1]): + name, member = member + if isfunction(member): + check_function(member) + if ismethod(member): + check_method(member) + if isclass(member): + check_class(member) + if ismodule(member): + check(member) def main(args): - check_module(pygsti) + check(pygsti) + pprint(missing) return 0 if __name__ == '__main__': From 7f2fd50e960a515ed7eb6a23bdf30470d1f9a7e8 Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Thu, 24 May 2018 12:58:38 -0600 Subject: [PATCH 07/21] Removes output redirect --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 142b01e01..c2a722a83 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,7 @@ before_install: install: - travis_retry travis_wait pip install -r requirements.txt - - pip install --global-option=build_ext --global-option="-I/usr/include/suitesparse" cvxpy cvxopt >/dev/null + - pip install --global-option=build_ext --global-option="-I/usr/include/suitesparse" cvxpy cvxopt - pip install ipython mpi4py zmq coverage msgpack-python cython psutil >/dev/null - pip install -e . >/dev/null From 1bb0a0e578d90c93da6a22a40db56cc62e8ce119 Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Thu, 24 May 2018 13:20:19 -0600 Subject: [PATCH 08/21] Adds attempt to fix CI tests to install.sh --- CI/install.sh | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/CI/install.sh b/CI/install.sh index 17adcb9dc..7291fef73 100755 --- a/CI/install.sh +++ b/CI/install.sh @@ -45,20 +45,24 @@ cp /usr/lib/liblapack.so /usr/lib/libsuitesparseconfig.so # wget http://mirrors.ctan.org/install/macros/latex/contrib/oberdiek.tds.zip # wget http://mirrors.ctan.org/install/macros/generic/ifxetex.tds.zip # wget http://mirrors.ctan.org/install/macros/latex/contrib/standalone.tds.zip -# unzip -o etoolbox.tds.zip -# unzip -o adjustbox.tds.zip -# unzip -o collectbox.tds.zip -# unzip -o pdfcomment.tds.zip -# unzip -o datetime2.tds.zip -# unzip -o tracklang.tds.zip -# unzip -o bezos.tds.zip -# unzip -o hyperref.tds.zip -# unzip -o oberdiek.tds.zip -# unzip -o ifxetex.tds.zip -# unzip -o standalone.tds.zip -# texhash +# unzip -o etoolbox.tds.zip +# unzip -o adjustbox.tds.zip +# unzip -o collectbox.tds.zip +# unzip -o pdfcomment.tds.zip +# unzip -o datetime2.tds.zip +# unzip -o tracklang.tds.zip +# unzip -o bezos.tds.zip +# unzip -o hyperref.tds.zip +# unzip -o oberdiek.tds.zip +# unzip -o ifxetex.tds.zip +# unzip -o standalone.tds.zip +# texhash # popd #else # echo "pdflatex is not required for these tests (ReportA is not set to \"True\")" #fi +sudo apt remove cmake +sudo -E add-apt-repository -y ppa:george-edison55/cmake-3.x +sudo -E apt-get update +sudo apt-get install cmake From b1037a4064a1c970a4b51e3731e7ff45c52c53b7 Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Thu, 24 May 2018 13:53:51 -0600 Subject: [PATCH 09/21] Adds manual CMAKE install --- CI/install.sh | 61 ++++++++++++--------------------------------------- 1 file changed, 14 insertions(+), 47 deletions(-) diff --git a/CI/install.sh b/CI/install.sh index 7291fef73..1004a6006 100755 --- a/CI/install.sh +++ b/CI/install.sh @@ -19,50 +19,17 @@ apt-get install libsuitesparse-dev cp /usr/lib/liblapack.so /usr/lib/libsuitesparseconfig.so - -#Latex is no longer needed! -#echo "Checking if pdflatex install is needed" -# -#if [ "$ReportA" == "True" ]; then -# apt-get -qq install texlive-full -#fi -# -#if [ "$Drivers" == "True" ]; then -# apt-get -qq install texlive-latex-base -#fi -# -#if [ "$ReportA" == "True" ] || [ "$Drivers" == "True" ]; then -# echo "Installing pdflatex requirements" -# pushd /usr/share/texmf-texlive/ -# wget http://mirrors.ctan.org/install/macros/latex/contrib/etoolbox.tds.zip -# wget http://mirrors.ctan.org/install/macros/latex/contrib/adjustbox.tds.zip -# wget http://mirrors.ctan.org/install/macros/latex/contrib/collectbox.tds.zip -# wget http://mirrors.ctan.org/install/macros/latex/contrib/pdfcomment.tds.zip -# wget http://mirrors.ctan.org/install/macros/latex/contrib/datetime2.tds.zip -# wget http://mirrors.ctan.org/install/macros/generic/tracklang.tds.zip -# wget http://mirrors.ctan.org/install/macros/latex/contrib/bezos.tds.zip -# wget http://mirrors.ctan.org/install/macros/latex/contrib/hyperref.tds.zip -# wget http://mirrors.ctan.org/install/macros/latex/contrib/oberdiek.tds.zip -# wget http://mirrors.ctan.org/install/macros/generic/ifxetex.tds.zip -# wget http://mirrors.ctan.org/install/macros/latex/contrib/standalone.tds.zip -# unzip -o etoolbox.tds.zip -# unzip -o adjustbox.tds.zip -# unzip -o collectbox.tds.zip -# unzip -o pdfcomment.tds.zip -# unzip -o datetime2.tds.zip -# unzip -o tracklang.tds.zip -# unzip -o bezos.tds.zip -# unzip -o hyperref.tds.zip -# unzip -o oberdiek.tds.zip -# unzip -o ifxetex.tds.zip -# unzip -o standalone.tds.zip -# texhash -# popd -#else -# echo "pdflatex is not required for these tests (ReportA is not set to \"True\")" -#fi - -sudo apt remove cmake -sudo -E add-apt-repository -y ppa:george-edison55/cmake-3.x -sudo -E apt-get update -sudo apt-get install cmake +# Install the following version of CMAKE +version=3.11 +build=1 +mkdir ~/temp +cd ~/temp +wget https://cmake.org/files/v$version/cmake-$version.$build.tar.gz +tar -xzvf cmake-$version.$build.tar.gz +cd cmake-$version.$build/ +./bootstrap +make -j4 +sudo make install +cd .. +rm -r temp +cmake --version From a4779265b3c3e8260cb66d9d562e6b74d164ea9f Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Fri, 25 May 2018 07:21:17 -0700 Subject: [PATCH 10/21] Updates install script --- CI/install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/CI/install.sh b/CI/install.sh index 1004a6006..d764b2943 100755 --- a/CI/install.sh +++ b/CI/install.sh @@ -19,6 +19,7 @@ apt-get install libsuitesparse-dev cp /usr/lib/liblapack.so /usr/lib/libsuitesparseconfig.so +sudo apt remove cmake # Install the following version of CMAKE version=3.11 build=1 From 7e96f5bc126f3087dbebf2de1a1ef31c03eae718 Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Fri, 25 May 2018 07:41:53 -0700 Subject: [PATCH 11/21] Adds install of g++ --- CI/install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CI/install.sh b/CI/install.sh index d764b2943..cd369b196 100755 --- a/CI/install.sh +++ b/CI/install.sh @@ -20,6 +20,8 @@ apt-get install libsuitesparse-dev cp /usr/lib/liblapack.so /usr/lib/libsuitesparseconfig.so sudo apt remove cmake +sudo apt-get install g++ + # Install the following version of CMAKE version=3.11 build=1 From d7ddd67a142a240b4a973bc05b74abc5034e3aaa Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Tue, 29 May 2018 07:33:21 -0600 Subject: [PATCH 12/21] Adds another tweak for CI --- CI/install.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CI/install.sh b/CI/install.sh index 1004a6006..ba239773f 100755 --- a/CI/install.sh +++ b/CI/install.sh @@ -1,5 +1,7 @@ #!/bin/bash # This script needs to be run as admin +sudo apt-get update +sudo apt-get install g++ ##An example of how to search for a file in apt packages ## (useful for debugging TravisCI build errors) @@ -33,3 +35,4 @@ sudo make install cd .. rm -r temp cmake --version +export CXX=g++ From d118178da78951ba69a062572ef503fbc7c4eba8 Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Tue, 29 May 2018 10:06:45 -0600 Subject: [PATCH 13/21] Fixes profile.py filename --- packages/pygsti/tools/profile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pygsti/tools/profile.py b/packages/pygsti/tools/profile.py index fa5275865..f87166b45 100644 --- a/packages/pygsti/tools/profile.py +++ b/packages/pygsti/tools/profile.py @@ -12,7 +12,7 @@ def wrap_f(*args, **kwargs): if filename is None: pr.print_stats() else: - filename_r = filename + ".{}".format(comm.rank) + filename_r = filename #+ ".{}".format(comm.rank) pr.dump_stats(filename_r) return result From bf414ced8b5b2c57fe01175c521e8be5ed597f93 Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Tue, 29 May 2018 10:08:35 -0600 Subject: [PATCH 14/21] Reorders export... ................ --- CI/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/install.sh b/CI/install.sh index efc1c679c..cce2abb44 100755 --- a/CI/install.sh +++ b/CI/install.sh @@ -23,6 +23,7 @@ cp /usr/lib/liblapack.so /usr/lib/libsuitesparseconfig.so sudo apt remove cmake sudo apt-get install g++ +export CXX=g++ # Install the following version of CMAKE version=3.11 @@ -38,4 +39,3 @@ sudo make install cd .. rm -r temp cmake --version -export CXX=g++ From 363e94b1c8e66f0bc441c4eafa494cbb75422215 Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Tue, 29 May 2018 11:45:06 -0600 Subject: [PATCH 15/21] Updates CI for C++11 (again..) TravisCI is.... picky... --- CI/install.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/CI/install.sh b/CI/install.sh index cce2abb44..96ded76a6 100755 --- a/CI/install.sh +++ b/CI/install.sh @@ -1,7 +1,6 @@ #!/bin/bash # This script needs to be run as admin sudo apt-get update -sudo apt-get install g++ ##An example of how to search for a file in apt packages ## (useful for debugging TravisCI build errors) @@ -21,10 +20,25 @@ sudo apt-get install g++ apt-get install libsuitesparse-dev cp /usr/lib/liblapack.so /usr/lib/libsuitesparseconfig.so -sudo apt remove cmake -sudo apt-get install g++ +sudo add-apt-repository ppa:ubuntu-toolchain-r/test +sudo apt-get update + +sudo update-alternatives --remove-all gcc +sudo update-alternatives --remove-all g++ +sudo apt-get install gcc-4.8 +sudo apt-get install g++-4.8 +sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20 +sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20 +sudo update-alternatives --config gcc +sudo update-alternatives --config g++ +sudo apt-get update +sudo apt-get upgrade -y +sudo apt-get dist-upgrade + export CXX=g++ +sudo apt remove cmake + # Install the following version of CMAKE version=3.11 build=1 From e0b96aa242b6f70eaa70be97813ef644d6214a1c Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Tue, 29 May 2018 12:57:44 -0600 Subject: [PATCH 16/21] Extends wait time --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c2a722a83..b1a91aa82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ before_install: - sudo apt-get -qq update - sudo apt-get -qq install gfortran libblas-dev liblapack-dev - sudo apt-get -qq install openmpi-bin openmpi-common openssh-client openssh-server libopenmpi1.3 libopenmpi-dbg libopenmpi-dev >/dev/null - - sudo bash CI/install.sh # Only install texlive and extensions if we need them + - travis_wait 30 sudo bash CI/install.sh # Only install texlive and extensions if we need them - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" #some tests require a display - sleep 3 # give xvfb some time to start From 08ecfd071f22c22f7be2b0d9eaed83d74d7e5894 Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Wed, 30 May 2018 17:24:40 -0600 Subject: [PATCH 17/21] Updates pip requirements --- optional-requirements.txt | 1 - requirements.txt | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/optional-requirements.txt b/optional-requirements.txt index 0cd0e824d..36149271d 100644 --- a/optional-requirements.txt +++ b/optional-requirements.txt @@ -1,5 +1,4 @@ ### Optional Requirements ### -cvxpy mpi4py deap psutil diff --git a/requirements.txt b/requirements.txt index 04c5b6cf6..73c4823ec 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,6 @@ plotly ply nose msgpack # For IO specifically.. make optional? +# Since this is needed to complete unit tests, I'm making it fully required - LSaldyt +cvxopt +cvxpy~=0.2.28 From 15779d600dd7875ff126aea46cd685554ac53cf3 Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Wed, 30 May 2018 17:25:56 -0600 Subject: [PATCH 18/21] Cleans travis yml --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b1a91aa82..b83f0b0b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,9 +29,10 @@ before_install: - "sh -e /etc/init.d/xvfb start" #some tests require a display - sleep 3 # give xvfb some time to start +# I'm attempting to remove this..? +#- pip install --global-option=build_ext --global-option="-I/usr/include/suitesparse" cvxpy cvxopt install: - travis_retry travis_wait pip install -r requirements.txt - - pip install --global-option=build_ext --global-option="-I/usr/include/suitesparse" cvxpy cvxopt - pip install ipython mpi4py zmq coverage msgpack-python cython psutil >/dev/null - pip install -e . >/dev/null From aa25ce6a1db6c1c4161e5c54a80031b02d0afefd Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Thu, 31 May 2018 07:12:07 -0600 Subject: [PATCH 19/21] Adds dill to pip install --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b83f0b0b8..307cb5bf4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ before_install: - sudo apt-get -qq update - sudo apt-get -qq install gfortran libblas-dev liblapack-dev - sudo apt-get -qq install openmpi-bin openmpi-common openssh-client openssh-server libopenmpi1.3 libopenmpi-dbg libopenmpi-dev >/dev/null - - travis_wait 30 sudo bash CI/install.sh # Only install texlive and extensions if we need them + - travis_wait 30 sudo bash CI/install.sh >/dev/null - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" #some tests require a display - sleep 3 # give xvfb some time to start @@ -33,7 +33,7 @@ before_install: #- pip install --global-option=build_ext --global-option="-I/usr/include/suitesparse" cvxpy cvxopt install: - travis_retry travis_wait pip install -r requirements.txt - - pip install ipython mpi4py zmq coverage msgpack-python cython psutil >/dev/null + - pip install ipython mpi4py zmq coverage msgpack-python cython dill psutil >/dev/null - pip install -e . >/dev/null cache: From f2a9167d07abdd36ef9db91087afdbc882140506 Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Thu, 31 May 2018 09:49:35 -0600 Subject: [PATCH 20/21] Another happy change to .travis.yml :) --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 307cb5bf4..f5481e6a1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ before_install: - sudo apt-get -qq update - sudo apt-get -qq install gfortran libblas-dev liblapack-dev - sudo apt-get -qq install openmpi-bin openmpi-common openssh-client openssh-server libopenmpi1.3 libopenmpi-dbg libopenmpi-dev >/dev/null - - travis_wait 30 sudo bash CI/install.sh >/dev/null + - travis_wait 30 "sudo bash CI/install.sh >/dev/null" - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" #some tests require a display - sleep 3 # give xvfb some time to start From ca80837bf592eb0c7e65991e61a48670e87f842f Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Thu, 31 May 2018 10:46:59 -0600 Subject: [PATCH 21/21] Sorts probabilities before generating multinomial random --- packages/pygsti/construction/datasetconstruction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pygsti/construction/datasetconstruction.py b/packages/pygsti/construction/datasetconstruction.py index c98cad0f3..c43628006 100644 --- a/packages/pygsti/construction/datasetconstruction.py +++ b/packages/pygsti/construction/datasetconstruction.py @@ -194,7 +194,7 @@ def generate_fake_data(gatesetOrDataset, gatestring_list, nSamples, elif sampleError == "multinomial": countsArray = rndm.multinomial(nWeightedSamples, - [ps[ol] for ol in labels], size=1) # well-ordered list of probs + sorted([ps[ol] for ol in labels]), size=1) # well-ordered list of probs for i,ol in enumerate(labels): counts[ol] = countsArray[0,i]