Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental/warp x #425

Merged
merged 98 commits into from
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
f4cc233
Starting a branch for warpX+libE work
jmlarson1 Dec 17, 2019
dee275a
Add preliminary input script for WarpX
RemiLehe Dec 17, 2019
cc20e63
Making a warpX directory
jmlarson1 Feb 4, 2020
836e133
Merge pull request #347 from Libensemble/develop
jmlarson1 Feb 4, 2020
adad2aa
Merge branch 'develop' into experimental/warpX
jmlarson1 Apr 1, 2020
f50a7ec
Adding example calling script
jmlarson1 Apr 1, 2020
69335f6
Updating calling script
jmlarson1 Apr 1, 2020
8b84987
Updating example
jmlarson1 Apr 1, 2020
edcb8c6
Move warpx calling script and sim func
shuds13 Apr 1, 2020
8676f46
Remove warpX dir in sim_funcs
shuds13 Apr 1, 2020
da46ab2
Update warpx inputs to new problem
shuds13 Apr 1, 2020
a2f81d7
Update calling script and sim func for warpx
shuds13 Apr 1, 2020
1e8eeb3
Add extra_args option to mpi_executor
shuds13 Apr 2, 2020
79dbdf7
Add randsample variant and fix sim dir name
shuds13 Apr 2, 2020
cfc1503
Testing use of extra_args to specify jsrun line
shuds13 Apr 2, 2020
621ac28
Add summit submission script for WarpX
shuds13 Apr 2, 2020
a5b8440
Slight edit to scripts
jmlarson1 Apr 2, 2020
436a327
Renaming a calling script
jmlarson1 Apr 2, 2020
e75a09b
Using field 'input_filename'
jmlarson1 Apr 2, 2020
a1439bf
Clarifying which outputs are libE and which are warpX; also setting u…
jmlarson1 Apr 2, 2020
a52616e
Change to store history every 100 evaluations
shuds13 Apr 2, 2020
4a75562
Change example run lines so both using 3 workers
shuds13 Apr 2, 2020
49dfa94
tune run script to run locally or on Summit
MaxThevenet Apr 3, 2020
bca26d9
need to pass the input file as app_args
MaxThevenet Apr 3, 2020
881fd66
run locally with random gen_f
MaxThevenet Apr 4, 2020
28522b1
add Summit machine-specific parameter files
MaxThevenet Apr 4, 2020
b864895
files to clean and analyse sim result
MaxThevenet Apr 4, 2020
10e191d
plotting script
MaxThevenet Apr 4, 2020
29e8ad8
minor plotting option
MaxThevenet Apr 4, 2020
1a5e129
start changes on aposmm calling script
MaxThevenet Apr 6, 2020
8c26849
Method to prevent unnecessary imports in persistent_aposmm
shuds13 Apr 6, 2020
f102034
Add nlopt as aposmm_optimizer to run_libE_on_warpX_aposmm.py
shuds13 Apr 6, 2020
840cccf
Add scipy and external optimizer rc options
shuds13 Apr 6, 2020
2dbb722
better clean
MaxThevenet Apr 6, 2020
71b1573
Merge pull request #420 from Libensemble/experimental/aposmm_rc
MaxThevenet Apr 6, 2020
d21c21b
use f in in sim_specs['out']
MaxThevenet Apr 6, 2020
3bdbab3
Merge branch 'experimental/warpX' of https://github.com/Libensemble/l…
MaxThevenet Apr 6, 2020
6196052
WarpX runs with APOSMM, optimize energy spread
MaxThevenet Apr 6, 2020
6c8e1f3
Merge branch 'develop' into experimental/warpX
jmlarson1 Apr 6, 2020
31af2dd
minor changes in plotting script
MaxThevenet Apr 6, 2020
818b69c
Merge branch 'experimental/warpX' of https://github.com/Libensemble/l…
MaxThevenet Apr 6, 2020
5a21640
Fix rc initialisation error
shuds13 Apr 6, 2020
86fcfc5
Update optimizer rc options
shuds13 Apr 6, 2020
e81de3f
update scripts so that both APOSMM and random work locally
MaxThevenet Apr 6, 2020
51d67f5
minor fixes to run on Summit
MaxThevenet Apr 7, 2020
cd51180
4 input parameters to optimize on emittance
MaxThevenet Apr 8, 2020
d8c118f
Recommending telling APOSMM the number of workers, so that it always …
jmlarson1 Apr 8, 2020
7c8be17
minor changes for production run on Summit
MaxThevenet Apr 8, 2020
d96e8b9
Merge branch 'experimental/warpX' of https://github.com/Libensemble/l…
MaxThevenet Apr 8, 2020
c34aa64
fix typos and get more output
MaxThevenet Apr 9, 2020
7420479
delete output files, and other minor changes
MaxThevenet Apr 9, 2020
291c9a1
Adding a comment showing how to load previously evaluated points
jmlarson1 Apr 9, 2020
8251098
set timeout
MaxThevenet Apr 9, 2020
b527d6e
better plotting capabilities
MaxThevenet Apr 9, 2020
92127c7
Merge branch 'experimental/warpX' of https://github.com/Libensemble/l…
MaxThevenet Apr 9, 2020
6572ea7
make sure random generation works well too
MaxThevenet Apr 9, 2020
a88cc9b
Merge branch 'experimental/warpX' of https://github.com/Libensemble/l…
MaxThevenet Apr 9, 2020
7a6d43c
plotting script also works with random sampling
MaxThevenet Apr 9, 2020
7633c40
Merge branch 'experimental/warpX' of https://github.com/Libensemble/l…
MaxThevenet Apr 9, 2020
b0d4930
flake8 changes
jmlarson1 Apr 13, 2020
571296c
flake8 allowing of imports for new approach for persistent_aposmm loc…
jmlarson1 Apr 14, 2020
3a13f45
Whitespace
jmlarson1 Apr 14, 2020
46c5336
Syntax error
jmlarson1 Apr 15, 2020
54b00b1
flake8
jmlarson1 Apr 15, 2020
073b3b2
Allowing imports after commands for persistent_aposmm files
jmlarson1 Apr 15, 2020
a8d5d10
Using new functionality in all-but-one test
jmlarson1 Apr 15, 2020
3f189ac
Resolving conflict in flake8 file
jmlarson1 Apr 15, 2020
80a3c10
New version of LibEnsemble/WarpX scripts, consistent with WarpX maste…
MaxThevenet Apr 15, 2020
e8293ed
Make aposmm_optimizer take a list
shuds13 Apr 15, 2020
d3d96e1
flake8 fix to periodic test
shuds13 Apr 15, 2020
51037fb
Fixing nonpersistent aposmm calls to use new imports
jmlarson1 Apr 15, 2020
b11ffdb
Renaming files using aposmm
jmlarson1 Apr 15, 2020
6cd7181
Resolving conflict
jmlarson1 Apr 15, 2020
a8b00c9
Merge new test into aposmm_rc branch
shuds13 Apr 16, 2020
397dab5
Remove old files
shuds13 Apr 16, 2020
cd4146c
Document aposmm_optimizer configuration options
shuds13 Apr 16, 2020
a6dbe98
Fixing persistent_aposmm autodoc
jmlarson1 Apr 16, 2020
c24b626
Adding gen_funcs and some documentation
jmlarson1 Apr 16, 2020
75133f4
Flake8 changes
jmlarson1 Apr 16, 2020
0bd20b6
Minor fixes
shuds13 Apr 16, 2020
756eab1
Rename aposmm_optimizer to aposmm_optimizers
shuds13 Apr 16, 2020
4022db9
Merge branch 'experimental/aposmm_rc' of github.com:Libensemble/liben…
shuds13 Apr 16, 2020
5bbddf0
Fixing broken regression test
jmlarson1 Apr 16, 2020
b8d30ce
Fixing broken regression test
jmlarson1 Apr 16, 2020
ab652ea
Merge changes in test_aposmm_sim_dirs.py
shuds13 Apr 16, 2020
1fbd6f6
Fixing regression test calling petsc for the second run
jmlarson1 Apr 16, 2020
0f14171
Merge branch 'experimental/aposmm_rc' into docs/more_gens
jmlarson1 Apr 17, 2020
1377972
Merge pull request #426 from Libensemble/experimental/aposmm_rc
shuds13 Apr 17, 2020
119dcb8
Working on APOSMM docs
jmlarson1 Apr 17, 2020
bdc2be1
Documenting new localoptinterfacer file
jmlarson1 Apr 17, 2020
ff9fe26
Merge branch 'develop' into docs/more_gens
jmlarson1 Apr 17, 2020
b58c58e
Merge branch 'develop' into experimental/warpX
jmlarson1 Apr 17, 2020
5fd84e5
Merge pull request #428 from Libensemble/docs/more_gens
jmlarson1 Apr 17, 2020
57ca8c7
Merge branch 'experimental/warpX' into experimental/aposmm_rc
jmlarson1 Apr 17, 2020
64612b8
Merge pull request #431 from Libensemble/experimental/aposmm_rc
shuds13 Apr 17, 2020
acec898
Resolving aposmm merge
jmlarson1 Apr 17, 2020
1e7c6de
Merge branch 'develop' into experimental/warpX
jmlarson1 Apr 17, 2020
3183bae
Fixing init for new opt_flag arg
jmlarson1 Apr 17, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,22 @@ per-file-ignores =
# init needs to import the logger.
libensemble/__init__.py:F401
libensemble/libensemble/__init__.py:F401

# Need to turn of matching probes (before other imports) on some
# systems/versions of MPI:
libensemble/tests/standalone_tests/mpi_launch_test/create_mpi_jobs.py:E402
libensemble/libensemble/tests/standalone_tests/mpi_launch_test/create_mpi_jobs.py:E402
libensemble/tests/regression_tests/test_uniform_sampling_with_different_resources.py:E402

# Matplotlib needs something set before import
postproc_scripts/*:E402

# Ignoring linelength in APOSMM
libensemble/gen_funcs/*aposmm.py:E501
examples/gen_funcs/*aposmm.py:E501

# Need to set something before the APOSMM import
libensemble/tests/scaling_tests/warpx/run_libensemble_on_warpx.py:E402
libensemble/gen_funcs/persistent_aposmm.py:E402, E501
libensemble/tests/regression_tests/test_persistent_aposmm*:E402
libensemble/tests/regression_tests/test_aposmm*:E402
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Mock(MagicMock):
def __getattr__(cls, name):
return MagicMock()

MOCK_MODULES = ['argparse', 'numpy', 'mpi4py' , 'scipy', 'numpy.lib', 'numpy.lib.recfunctions', 'math', 'petsc4py', 'PETSc', 'nlopt', 'scipy.spatial', 'scipy.spatial.distance']
MOCK_MODULES = ['argparse', 'numpy', 'mpi4py' , 'dfols', 'scipy', 'numpy.lib', 'numpy.lib.recfunctions', 'math', 'petsc4py', 'PETSc', 'nlopt', 'scipy.spatial', 'scipy.spatial.distance']
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)

#from libensemble import *
Expand Down
2 changes: 1 addition & 1 deletion docs/data_structures/exit_criteria.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Exit criteria for libEnsemble::
.. seealso::
From `test_branin_aposmm_nlopt_and_then_scipy.py`_.

.. literalinclude:: ../../libensemble/tests/regression_tests/test_sim_dirs.py
.. literalinclude:: ../../libensemble/tests/regression_tests/test_aposmm_sim_dirs.py
:start-at: exit_criteria
:end-before: end_exit_criteria_rst_tag

Expand Down
44 changes: 42 additions & 2 deletions docs/examples/gen_funcs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,36 @@ sampling
:undoc-members:

APOSMM
------
.. automodule:: aposmm
-----------------

Asynchronously Parallel Optimization Solver for finding Multiple Minima
(APOSMM) coordinates concurrent local optimization runs in order to identifying
many local minima.

Configuring APOSMM
^^^^^^^^^^^^^^^^^^

By default, APOSMM will import several optimizers which require
external packages and MPI. To import only the optimizers you are using,
add the following lines in that calling script, before importing APOSMM::

import libensemble.gen_funcs
libensemble.gen_funcs.rc.aposmm_optimizers = <optimizers>

Where ``optimizer`` is a string (or list of strings) from the available options:

``'petsc'``, ``'nlopt'``, ``'dfols'``, ``'scipy'``, ``'external'``

Persistent APOSMM
^^^^^^^^^^^^^^^^^

.. automodule:: persistent_aposmm
:members:
:undoc-members:

LocalOptInterfacer
^^^^^^^^^^^^^^^^^^
.. automodule:: aposmm_localopt_support
:members:
:undoc-members:

Expand All @@ -24,6 +52,18 @@ uniform_or_localopt
:members:
:undoc-members:

persistent_deap_nsga2
---------------------------
.. automodule:: persistent_deap_nsga2
:members:
:undoc-members:

persistent_tasmanian
---------------------------
.. automodule:: persistent_tasmanian
:members:
:undoc-members:

persistent_uniform_sampling
---------------------------
.. automodule:: persistent_uniform_sampling
Expand Down
15 changes: 9 additions & 6 deletions libensemble/executors/mpi_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,18 @@ def __init__(self, auto_resources=True,
mpi_commands = {
'mpich': ['mpirun', '--env {env}', '-machinefile {machinefile}',
'-hosts {hostlist}', '-np {num_procs}',
'--ppn {ranks_per_node}'],
'--ppn {ranks_per_node}', '{extra_args}'],
'openmpi': ['mpirun', '-x {env}', '-machinefile {machinefile}',
'-host {hostlist}', '-np {num_procs}',
'-npernode {ranks_per_node}'],
'-npernode {ranks_per_node}', '{extra_args}'],
'aprun': ['aprun', '-e {env}',
'-L {hostlist}', '-n {num_procs}',
'-N {ranks_per_node}'],
'jsrun': ['jsrun', '--np {num_procs}'], # Need to add more
'-N {ranks_per_node}', '{extra_args}'],
'jsrun': ['jsrun', '{extra_args}'], # Relies on extra_args
'srun': ['srun', '-w {hostlist}', '-n {num_procs}',
'--nodes {num_nodes}',
'--ntasks-per-node {ranks_per_node}']
'--ntasks-per-node {ranks_per_node}',
'{extra_args}']
}
self.mpi_launch_type = MPIResources.get_MPI_variant()
self.mpi_command = mpi_commands[self.mpi_launch_type]
Expand Down Expand Up @@ -212,7 +213,8 @@ def _launch_with_retries(self, task, runline, wait_on_run):
def submit(self, calc_type, num_procs=None, num_nodes=None,
ranks_per_node=None, machinefile=None, app_args=None,
stdout=None, stderr=None, stage_inout=None,
hyperthreads=False, test=False, wait_on_run=False):
hyperthreads=False, test=False, wait_on_run=False,
extra_args=None):
"""Creates a new task, and either executes or schedules execution.

The created task object is returned.
Expand Down Expand Up @@ -285,6 +287,7 @@ def submit(self, calc_type, num_procs=None, num_nodes=None,
mpi_specs = self._get_mpi_specs(task, num_procs, num_nodes,
ranks_per_node, machinefile,
hyperthreads)
mpi_specs['extra_args'] = extra_args
runline = launcher.form_command(self.mpi_command, mpi_specs)
runline.extend(task.app.full_path.split())
if task.app_args is not None:
Expand Down
19 changes: 19 additions & 0 deletions libensemble/gen_funcs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
def rc(**kargs):
"""Runtime configuration options.

Parameters
----------
aposmm_optimizers : string or list of strings
Select the aposmm optimizer/s (to prevent all options being imported).


"""
for key in kargs:
if not hasattr(rc, key):
raise TypeError("unexpected argument '{0}'".format(key))
for key, value in kargs.items():
setattr(rc, key, value)


rc.aposmm_optimizers = None
__import__('sys').modules[__name__ + '.rc'] = rc
30 changes: 23 additions & 7 deletions libensemble/gen_funcs/aposmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,32 @@
import traceback
import numpy as np
from scipy.spatial.distance import cdist, pdist, squareform
from scipy import optimize as scipy_optimize

from mpi4py import MPI
from petsc4py import PETSc

from numpy.lib.recfunctions import merge_arrays

from math import log, gamma, pi, sqrt

import nlopt
import libensemble.gen_funcs
optimizer_list = ['petsc', 'nlopt', 'scipy']
optimizers = libensemble.gen_funcs.rc.aposmm_optimizers

if optimizers is None:
from mpi4py import MPI
from petsc4py import PETSc
import nlopt
from scipy import optimize as scipy_optimize
else:
if not isinstance(optimizers, list):
optimizers = [optimizers]
unrec = set(optimizers) - set(optimizer_list)
if unrec:
print('APOSMM Warning: unrecognized optimizers {}'.format(unrec))

if 'petsc' in optimizers:
from mpi4py import MPI
from petsc4py import PETSc
if 'nlopt' in optimizers:
import nlopt
if 'scipy' in optimizers:
from scipy import optimize as scipy_optimize


class APOSMMException(Exception):
Expand Down