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
import openmdao.api as om | |
import numpy as np | |
import time | |
from mpi4py import MPI | |
class SumComp(om.ExplicitComponent): | |
def __init__(self, size): | |
super(SumComp, self).__init__() | |
self.size = size |
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
import numpy as np | |
import openmdao.api as om | |
import time | |
class DelayComp(om.ExplicitComponent): | |
def initialize(self): | |
self.options.declare('time', default=3.0) | |
self.options.declare('size', default=1) |
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
import openmdao.api as om | |
import numpy as np | |
from openmdao.utils.array_utils import evenly_distrib_idxs | |
import mpi4py.MPI as MPI | |
N = 3 | |
class DistribComp(om.ExplicitComponent): |
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
import openmdao.api as om | |
import numpy as np | |
from openmdao.utils.array_utils import evenly_distrib_idxs | |
import mpi4py.MPI as MPI | |
N = 3 | |
class DistribComp(om.ExplicitComponent): |
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
import openmdao.api as om | |
import numpy as np | |
import mpi4py.MPI as MPI | |
# The system will catch that 21 is out of bounds if specified as a list of tuples | |
# SRC_INDICES = [(1,),(21,)] | |
# The system will catch that 21 is out of bounds if it is first in the flat list | |
# It interprets this the same way as a list of 1D tuples | |
# SRC_INDICES = [21, 1] | |
# The system will NOT catch that 21 is out of bounds if it is not first in the flat list |
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
import openmdao.api as om | |
import numpy as np | |
import mpi4py.MPI as MPI | |
SRC_INDICES = [1,2] | |
FORCE_PETSCTRANSFER = False | |
class TestCompDist(om.ExplicitComponent): | |
def initialize(self): |
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
import openmdao.api as om | |
import mpi4py.MPI as MPI | |
SRC_INDICES = 1 | |
class TestComp(om.ExplicitComponent): | |
def initialize(self): | |
self.options['distributed'] = False |
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
import openmdao.api as om | |
import mpi4py.MPI as MPI | |
class TestComp(om.ExplicitComponent): | |
def initialize(self): | |
self.options['distributed'] = False | |
def setup(self): | |
self.add_input('x', shape=1) |
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
import openmdao.api as om | |
import numpy as np | |
from openmdao.utils.array_utils import evenly_distrib_idxs | |
N = 3 | |
class DistribCompNoWork(om.ExplicitComponent): | |
def initialize(self): |
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
import openmdao.api as om | |
prob = om.Problem() | |
model = prob.model | |
model.add_subsystem('p1', om.IndepVarComp('x', 1.0)) | |
model.add_subsystem('p2', om.IndepVarComp('x', 1.0)) | |
parallel = model.add_subsystem('parallel', om.ParallelGroup()) | |
parallel.add_subsystem('c1', om.ExecComp(['y=-2.0*x'])) |