Skip to content

Commit

Permalink
rename option, since is binary presence of petsc, also include necess…
Browse files Browse the repository at this point in the history
…ary line in other petsc tests
  • Loading branch information
jlnav committed Aug 15, 2023
1 parent f1d80f0 commit d0b9009
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
14 changes: 7 additions & 7 deletions libensemble/gen_funcs/aposmm_localopt_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@

class _GlobalConfig:
def __init__(self):
self._global_opt_method = None
self._global_petsc_init = False

@property
def global_opt_method(self):
return self._global_opt_method
def global_petsc_init(self):
return self._global_petsc_init

@global_opt_method.setter
def global_opt_method(self, value):
self._global_opt_method = value
if self._global_opt_method == "petsc":
@global_petsc_init.setter
def global_petsc_init(self, value):
self._global_petsc_init = value
if self._global_petsc_init:
from petsc4py import PETSc

globals()["PETSc"] = PETSc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from libensemble.sim_funcs.chwirut1 import chwirut_eval as sim_f
from libensemble.tools import add_unique_random_streams, parse_args, save_libE_output

config.global_opt_method = "petsc" # only needed for petsc now!
config.global_petsc_init = True # only needed for petsc now!


def combine_component(x):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@

import numpy as np

from libensemble.gen_funcs.aposmm_localopt_support import config

config.global_petsc_init = True
from libensemble.alloc_funcs.persistent_aposmm_alloc import persistent_aposmm_alloc as alloc_f
from libensemble.gen_funcs.persistent_aposmm import aposmm as gen_f

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@
import numpy as np

from libensemble.alloc_funcs.persistent_aposmm_alloc import persistent_aposmm_alloc as alloc_f
from libensemble.gen_funcs.aposmm_localopt_support import config
from libensemble.gen_funcs.persistent_aposmm import aposmm as gen_f

config.global_petsc_init = True

# Import libEnsemble items for this test
from libensemble.libE import libE
from libensemble.sim_funcs.six_hump_camel import six_hump_camel as sim_f
Expand Down

0 comments on commit d0b9009

Please sign in to comment.