-
Notifications
You must be signed in to change notification settings - Fork 526
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'pynumero_sparse' into pynumero_mumps
- Loading branch information
Showing
18 changed files
with
8,893 additions
and
1,862 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: parallel_tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 1 | ||
matrix: | ||
python-version: [3.7] | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: setup conda | ||
uses: s-weigand/setup-conda@v1 | ||
with: | ||
update-conda: true | ||
python-version: ${{ matrix.python-version }} | ||
conda-channels: anaconda, conda-forge | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install numpy scipy nose | ||
pip install --quiet git+https://github.com/PyUtilib/pyutilib | ||
conda install mpi4py | ||
python setup.py develop | ||
- name: Test with nose | ||
run: | | ||
mpirun -np 3 nosetests -v pyomo.contrib.pynumero.sparse.tests.test_mpi_block_vector.py pyomo.contrib.pynumero.sparse.tests.test_mpi_block_matrix.py |
196 changes: 104 additions & 92 deletions
196
pyomo/contrib/pynumero/examples/structured/nlp_compositions.py
Large diffs are not rendered by default.
Oops, something went wrong.
555 changes: 280 additions & 275 deletions
555
pyomo/contrib/pynumero/examples/structured/tests/test_nlp_compositions.py
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
# ___________________________________________________________________________ | ||
# | ||
# Pyomo: Python Optimization Modeling Objects | ||
# Copyright 2017 National Technology and Engineering Solutions of Sandia, LLC | ||
# Under the terms of Contract DE-NA0003525 with National Technology and | ||
# Engineering Solutions of Sandia, LLC, the U.S. Government retains certain | ||
# rights in this software. | ||
# This software is distributed under the 3-clause BSD License. | ||
# ___________________________________________________________________________ | ||
|
||
import abc | ||
import six | ||
|
||
# These classes are for checking types consistently and raising errors | ||
|
||
|
||
class BaseBlockVector(object): | ||
"""Base class for block vectors""" | ||
|
||
def __init__(self): | ||
pass | ||
|
||
# We do not expect classes derived from BaseBlockVector to support | ||
# the methods below. | ||
def argpartition(self, kth, axis=-1, kind='introselect', order=None): | ||
msg = "argpartition not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def argsort(self, axis=-1, kind='quicksort', order=None): | ||
msg = "argsort not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def byteswap(self, inplace=False): | ||
msg = "byteswap not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def choose(self, choices, out=None, mode='raise'): | ||
msg = "choose not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def diagonal(self, offset=0, axis1=0, axis2=1): | ||
msg = "diagonal not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def getfield(self, dtype, offset=0): | ||
msg = "getfield not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def item(self, *args): | ||
msg = "item not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def itemset(self, *args): | ||
msg = "itemset not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def newbyteorder(self, new_order='S'): | ||
msg = "newbyteorder not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def put(self, indices, values, mode='raise'): | ||
msg = "put not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def partition(self, kth, axis=-1, kind='introselect', order=None): | ||
msg = "partition not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def repeat(self, repeats, axis=None): | ||
msg = "repeat not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def reshape(self, shape, order='C'): | ||
msg = "reshape not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def resize(self, new_shape, refcheck=True): | ||
msg = "resize not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def searchsorted(self, v, side='left', sorter=None): | ||
msg = "searchsorted not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def setfield(self, val, dtype, offset=0): | ||
msg = "setfield not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def setflags(self, write=None, align=None, uic=None): | ||
msg = "setflags not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def sort(self, axis=-1, kind='quicksort', order=None): | ||
msg = "sort not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def squeeze(self, axis=None): | ||
msg = "squeeze not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def swapaxes(self, axis1, axis2): | ||
msg = "swapaxes not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def trace(self, offset=0, axis1=0, axis2=1, dtype=None, out=None): | ||
msg = "trace not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def argmax(self, axis=None, out=None): | ||
msg = "argmax not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def argmin(self, axis=None, out=None): | ||
msg = "argmin not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def take(self, indices, axis=None, out=None, mode='raise'): | ||
msg = "take not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
# The following vectors are to be supported at some point | ||
def dump(self, file): | ||
msg = "dump not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def dumps(self): | ||
msg = "dumps not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def tobytes(self, order='C'): | ||
msg = "tobytes not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
|
||
class BaseBlockMatrix(object): | ||
"""Base class for block matrices""" | ||
|
||
def __init__(self): | ||
pass | ||
|
||
# We do not expect classes derived from BaseBlockVector to support | ||
# the methods below. | ||
def tolil(self, copy=False): | ||
msg = "tolil not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def todia(self, copy=False): | ||
msg = "todia not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def tobsr(self, blocksize=None, copy=False): | ||
msg = "tobsr not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def sum(self, axis=None, dtype=None, out=None): | ||
msg = "sum not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def mean(self, axis=None, dtype=None, out=None): | ||
msg = "mean not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def diagonal(self, k=0): | ||
msg = "diagonal not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def nonzero(self): | ||
msg = "nonzero not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def setdiag(self, values, k=0): | ||
msg = "setdiag not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def transpose(*axes): | ||
msg = "transpose not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) | ||
|
||
def tostring(order='C'): | ||
msg = "tostring not implemented for {}".format(self.__class__.__name__) | ||
raise NotImplementedError(msg) |
Oops, something went wrong.