Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
4e87d51
File flake8 errors.
jmohdyusof Dec 2, 2021
8b590ed
updated booster env
Jan 27, 2022
06cbe22
new ExaBooster env
Jan 27, 2022
d33303d
adding new model
Jan 27, 2022
1502a0e
Continuous ExaBooster env support
Feb 1, 2022
f4aad2b
modular version of rma learner
Feb 8, 2022
cef5859
Adding TD3 agent
Feb 9, 2022
ad1cb13
cleaning up some code
Feb 9, 2022
4405788
Create keras_td3.py
schr476 Feb 10, 2022
c8143f5
Merge pull request #201 from schr476/patch-2
Feb 10, 2022
1ccfc1e
fixing style errors
Feb 10, 2022
93b1098
adding new agents and revamping workflows
Feb 11, 2022
8206840
debugging async learner
Feb 11, 2022
4ec5844
Merge branch 'develop' into develop_init_cleaning
Jodasue Feb 12, 2022
c184344
Added ExaBooster Training Data
himscipy-pnnl Feb 15, 2022
709b412
Adding tests for:
Jodasue Feb 22, 2022
f0a6a63
Minor name change.
Jodasue Feb 22, 2022
76a700a
Putting candle driver opts in agent test.
Jodasue Feb 22, 2022
ac1fd53
Got agent unit test set up and cleaned up some comments.
Jodasue Feb 22, 2022
f2260eb
Add code to read CONFIG_DIR if set to allow flexible launch options.
jmohdyusof Feb 28, 2022
1480db1
Merge branch 'develop' of github.com:exalearn/ExaRL into develop
jmohdyusof Feb 28, 2022
b434be8
Some progress on agent testing
Jodasue Mar 1, 2022
aa43143
adding summit_environment.yml file for building a conda env on summit
Mar 2, 2022
ba14650
updating summit_environment.yml file
Mar 2, 2022
c82f053
1. Restructure to avoid circular dependencies in candleDriver
Mar 4, 2022
ed5212a
updating pytest learner_cfg.json
Mar 4, 2022
8531959
adding try catches around run_params in init
Mar 7, 2022
2da3cb1
specifying gym version in setup.py:
Mar 7, 2022
e90abdb
hadrec
thomasflynn918 Mar 8, 2022
c27d5ee
powergrid
thomasflynn918 Mar 8, 2022
c4fce7b
Custom paths for hadrec
thomasflynn918 Mar 8, 2022
415cc55
added the config for HADREC Env
himscipy-pnnl Mar 9, 2022
37c5e76
Update agent_doc.rst
Mar 10, 2022
c6e2e1e
Making env registry compatible with the latest gym>0.22
Mar 10, 2022
df2fce4
fixing style issues with HadrecWrapper
Mar 10, 2022
2a45b76
setting log level in candle driver using relative import and gParameters
Mar 10, 2022
4c04d3a
switching to absolute import of logger in candleDriver to avoid issue…
Mar 10, 2022
b4bad29
Allow extra command line arguments without crashing, but report the e…
jmohdyusof Mar 11, 2022
cf8e522
Not sure if returning None for agents and envs will break something, …
Mar 11, 2022
9f815fc
Finished the agent unit tests.
Jodasue Mar 11, 2022
0645b0a
fix style errors
Mar 11, 2022
b57b652
Adding workflow unit tests.
Jodasue Mar 14, 2022
847a634
fixed HadrecWrapper Xml File
himscipy-pnnl Mar 14, 2022
fb3872f
async_learner bug fix
Mar 15, 2022
d42aefb
Merge branch 'develop' of https://github.com/exalearn/EXARL into develop
Mar 15, 2022
9d23dfd
fixing dimensions of action array in replay_buffer
Mar 15, 2022
632167d
Update read_data to interpret time in seconds
thomasflynn918 Mar 15, 2022
61fb15a
adding docstrings to _replay_buffer
Mar 17, 2022
a9e7407
Merge branch 'develop' of https://github.com/exalearn/EXARL into develop
Mar 17, 2022
d55224c
adding codecov integration
Mar 21, 2022
f6ff20f
Some ptest cleanup.
Jodasue Mar 21, 2022
50f3ef0
Fixed hasattribute test for agent in unit tests.
Jodasue Mar 21, 2022
208b773
Add parameters for (most) TD3-v1 options
thomasflynn918 Mar 22, 2022
f7d59cd
Reverting back codecov upload until I figure things out
Mar 23, 2022
b8f409e
Added ability to change where weights are loaded/stored under
Jodasue Mar 29, 2022
e20190e
updating codecov upload in CI
Mar 29, 2022
77bbb38
1. Fixed communicators (simple and MPI) and updated utests to reflect
Jodasue Mar 30, 2022
009a7cb
Update .travis.yml
Mar 31, 2022
f06a2c1
fix flake8 errors in setup.py
Mar 31, 2022
3da0f0b
Merge branch 'develop' of https://github.com/exalearn/EXARL into develop
Mar 31, 2022
6c191f2
Update README.md
Mar 31, 2022
0cd8f96
Update README.md
Mar 31, 2022
e4bc8bb
Update .travis.yml
Mar 31, 2022
f3d1824
Temp workflow commit.
Jodasue Apr 1, 2022
69bdf56
First pass at new env.
Jodasue Apr 2, 2022
6ff7a5a
This is a first pass at merging bsuite branch and develop. (#210)
Jodasue Apr 2, 2022
3d9e430
Adding new utests with env for testing.
Jodasue Apr 2, 2022
3b25cad
These are bug fixes.
Jodasue Apr 2, 2022
94fe0c9
1. Added refactored workflows simple and simple_async
Jodasue Apr 3, 2022
010e1a9
Minor fix for bsuite and some spelling.
Jodasue Apr 3, 2022
3347286
Adding the workflow config json files.
Jodasue Apr 4, 2022
43a613a
updating CI and coverage config files
Apr 5, 2022
3b7b88e
Broken for Vinay to look at.
Jodasue Apr 6, 2022
56770f4
Partial fix.
Jodasue Apr 7, 2022
ab10979
1. Fixed epsilon in async and simple learners
Jodasue Apr 7, 2022
3937a9d
This is an attempt to address candleDriver issues with run_params.
Jodasue Apr 9, 2022
583881d
Forgot to add the globals
Jodasue Apr 12, 2022
9f1aba3
Merge branch 'utest_to_merge' into cenate
Jodasue Apr 12, 2022
05ff6a7
Added some parts of the script env.
Jodasue Apr 14, 2022
f64b04f
fixing missing partition variable
jmohdyusof Apr 15, 2022
592a64f
Merging introspector with profile and updating driver.
Jodasue Apr 20, 2022
88b3531
1. Updated utests with new changes to comms and globals
Jodasue Apr 21, 2022
1cec34a
1. Fixed order of done in simple learner for logging
Jodasue Apr 21, 2022
4125acb
1. Replacing sync and async with simple and simple_async
Jodasue Apr 21, 2022
00f7faa
Merge branch 'develop' into utest_to_merge
Apr 21, 2022
71d0bb5
Fixed default to conftest for mpi4py flag.
Jodasue Apr 22, 2022
41b6478
Merge branch 'utest_to_merge' of https://github.com/exalearn/ExaRL in…
Jodasue Apr 22, 2022
df88a2a
Merge pull request #213 from exalearn/utest_to_merge
Apr 22, 2022
5eee4f2
1. Fix to bsuite tracing
Jodasue Apr 22, 2022
3360530
Removing the partion in the sbatch command since nersc doesn't like
Jodasue Apr 22, 2022
b50c822
Putting back the learner_cfg so it passes CI/CD.
Jodasue Apr 22, 2022
3e3f460
Have to check exarlearn.env.env due to ExaEnv wrapper.
Jodasue Apr 22, 2022
788f2b4
Turn off debug print.
Jodasue Apr 22, 2022
c8bf22d
Adding workflow_episode and workflow_steps to the env base class
Apr 26, 2022
37e5079
adding funcs to keep track of episode and step count to env base class
Apr 27, 2022
8a5be69
Updating sync learner to use methods to update episodes and steps in …
Apr 27, 2022
c1faa27
Change busite wrapper to overwrite results so that it doesn't error o…
Apr 27, 2022
64d09f8
resolving flake8 error
Apr 27, 2022
43aaafe
Merge pull request #216 from exalearn/bsuite_scripting_fix
Apr 28, 2022
4824c89
Included target network updates as a hyperparameter, and logarithmic …
tcfuji May 9, 2022
d58870d
changed target_train method name to update_target for clarity
tcfuji May 11, 2022
823e313
included method name 'update_target' replacements in tests and other …
tcfuji May 11, 2022
fae4ba0
included update_target name change in rma_learning.py, will need to r…
tcfuji May 11, 2022
a666c34
set update_target_every config to 1
tcfuji May 19, 2022
b884286
deleted whitespace
tcfuji Jun 2, 2022
1004a6f
deleted whitespace
tcfuji Jun 2, 2022
fddaff1
Merge pull request #217 from exalearn/develop_tf
Jun 9, 2022
79e155a
improvments to bellman equation using TF
Jun 9, 2022
b1b7659
cleaning up code for PR
Jun 9, 2022
a2f5617
Merge pull request #222 from exalearn/bellman_opt
Jun 10, 2022
23ef0b4
add logging frequency
Jun 15, 2022
70165f5
changing update_target_every to update_target_frequency
Jun 15, 2022
bbc3a1d
Merge pull request #226 from exalearn/logfreq
Jun 16, 2022
bcfa53d
Predict on batch_end instead of each sample
jmohdyusof Jun 21, 2022
b99a80f
More granularity for run options
jmohdyusof Jun 21, 2022
920d0ca
sync learner bug fix for nepisodes
Jul 5, 2022
e147b1c
Merge pull request #229 from exalearn/develop_async_bugfix
Jul 5, 2022
49b323f
casting all variables in calc_target_f to float32
Jul 6, 2022
960114c
Merge pull request #231 from exalearn/dqn_tfcast
Jul 7, 2022
11bf197
fix to config files params: model/model_type
Jul 20, 2022
ea1e03e
restoring learner_cfg for Cartpole/DQN
Jul 21, 2022
c4c4eeb
Merge pull request #233 from exalearn/config_fix
Jul 22, 2022
63f040c
Convergence cutoff, hyper-parameter tuning, and more... (#237)
Jodasue Nov 8, 2022
2c48242
Changes for Tom to review.
Jodasue Jun 2, 2023
38bc44d
Second attempt at patch.
Jodasue Jun 6, 2023
234d970
Adding .gitignore
Jodasue Jul 11, 2023
db1e707
Adding back the code to convert between continuous and discrete action
Jodasue Jul 11, 2023
57cd1d3
Adding fix in TD3-v1 and DDPG-v0 for the q_target to properly account…
mikegros Sep 11, 2023
380b001
Finished fixing TD3_v1 using keras_td3.py. Now both TD3-v1 and DDPG-v…
mikegros Sep 11, 2023
21a5fc2
Also need to address a bug in the replay buffer when the action space…
mikegros Sep 12, 2023
1a636c8
Nevermind. The right change is for TD3-v1s actor not to give back a l…
mikegros Sep 12, 2023
bd208d3
Forgot to commit the removal of the np.squeeze also. Now this version…
mikegros Sep 12, 2023
b5044c0
Committing the nStepBuffer that I believe is working, need to do more…
mikegros Sep 15, 2023
9434c04
Merge pull request #257 from exalearn/fix_done_bug
thomasflynn918 Sep 19, 2023
6f4d5f1
Update ddpg.py
mikegros Sep 25, 2023
83e6f35
Merge pull request #262 from exalearn/ddpg_OU_noise_patch
thomasflynn918 Sep 26, 2023
6d33cb8
Converting the nStep Buffer to using the buffer builder interface. Te…
mikegros Sep 26, 2023
357e4fb
Merge pull request #261 from exalearn/nStep_capability
thomasflynn918 Oct 12, 2023
947e833
Fixing a shape issue in TD3. In train_critic, next_actions is batch_s…
mikegros Nov 16, 2023
cba9139
Also committing the fix to tf_ac.py that I mentioned in Slack - that …
mikegros Nov 16, 2023
094cf64
Another fix for tf_ac.py is that the scaling to the upper/lower bound…
mikegros Nov 16, 2023
99fb00d
I think this should port the added Soft Actor-Critic capability to th…
mikegros Dec 8, 2023
eb56ef0
Adding the configuration files that I forgot to originally
mikegros Dec 13, 2023
bc9e89e
And add the parser argument to get it to work properly. Oops.
mikegros Dec 13, 2023
0df408b
Merge pull request #263 from exalearn/fix_td3_noise_shape
thomasflynn918 Dec 19, 2023
4c92810
Merge pull request #265 from exalearn/add_sac_fixBroken
thomasflynn918 Dec 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[run]
branch = True
omit =
tests/*
docs/*
docker/*
test_*
*_test*

[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain about missing debug-only code:
def __repr__
if self\.debug

# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError
raise FileNotFoundError

# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:

# Don't complain about abstract methods, they aren't run:
@(abc\.)?abstractmethod

ignore_errors = True
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,13 @@ venv.bak/

# mypy
.mypy_cache/

# VSCode
._*

# Directories
results_dir
bsuite_results*
.vscode
results

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "exarl/envs/env_vault/Hadrec_dir"]
path = exarl/envs/env_vault/Hadrec_dir
url = git@github.com:exalearn/powerGridEnv.git
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ before_install:
script:
- pip install -r setup/test-requirements.txt
- flake8 .
- pytest
- pytest --cov-config=.coveragerc --cov=./ --cov-report=xml --cov-report=term
- export PYTHONPATH=`pwd`:$PYTHONPATH
- python exarl/driver
- curl -Os https://uploader.codecov.io/latest/linux/codecov
- chmod +x codecov
- CODECOV_TOKEN=58f6254a-1517-4f4b-9e87-1348390deaf7
- ./codecov -t ${CODECOV_TOKEN}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ A scalable software framework for reinforcement learning environments and agents
[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
[![Build Status](https://travis-ci.com/exalearn/EXARL.svg?token=nVtzNrBfRo4qpVpEQP21&branch=develop)](https://travis-ci.com/exalearn/EXARL)
[![Documentation Status](https://readthedocs.org/projects/exarl/badge/?version=latest)](https://exarl.readthedocs.io/en/latest/?badge=latest)
[![codecov](https://codecov.io/gh/exalearn/EXARL/branch/develop/graph/badge.svg?token=VMHFSSZ7MJ)](https://codecov.io/gh/exalearn/EXARL)

[Complete documentation](https://exarl.readthedocs.io/en/latest/index.html) is available.

Expand Down
197 changes: 197 additions & 0 deletions bsuite/SingleRun.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
#!/usr/bin/perl
package SingleRun;
use strict;
use Time::HiRes qw(usleep);

my $user = "userName";
my $partition = "partitionName";
my $overSubFactor = 2;
my $defaultThreshold = 1;
my $threshold = $defaultThreshold;

sub setPartition
{
$partition = $_[0];
}

sub setUser
{
$user = $_[0];
}

sub runCommand
{
system($_[0]);
}

sub getCurrentAvailableNodes
{
my $command = "sinfo -p $partition -t idle -o %D -h";
my $output = `$command`;
chomp $output;
return $output
}

sub getCurrentTotalNodes
{
my $command = "sinfo -p $partition -t idle,alloc -o %D -h";
my $output = `$command`;
chomp $output;
return $output
}

sub getCurrentLoad
{
my $command = "squeue -h -p $partition -u $user | wc -l";
my $output = `$command`;
chomp $output;
return $output
}

sub getCurrentRunning
{
my $command = "squeue -h -p $partition -u $user -t R | wc -l";
my $output = `$command`;
chomp $output;
return $output
}

sub throttleCommand
{
my $command = $_[0];
my $total = getCurrentTotalNodes();
my $avail = getCurrentAvailableNodes();
my $load = getCurrentLoad();
if($threshold < $avail)
{
$threshold = int($avail*$overSubFactor);
}
else
{
my $max = $total * $overSubFactor;
if($max < $threshold)
{
$threshold = $max;
}
}
my $secs = 100;
while($load >= $threshold)
{
usleep($secs);
if($secs < 1000000)
{
$secs+=100;
}
$load = getCurrentLoad();
}
my $load = getCurrentLoad();
runCommand($command);
$total = getCurrentTotalNodes();
$avail = getCurrentAvailableNodes();
$load = getCurrentLoad();
my $running = getCurrentRunning();
my $percentage = 100 * $running / $total;
print("Nodes: $total Avail: $avail Load: $load Percent: $percentage Threshold: $threshold\n");
}

sub greedyThrottleCommand
{
$threshold = shift(@_);
my $command = shift(@_);
my $total = getCurrentTotalNodes();
my $avail = getCurrentAvailableNodes();
my $load = getCurrentLoad();


my $secs = 100;
while($load >= $threshold)
{
usleep($secs);
if($secs < 1000000)
{
$secs+=100;
}
$load = getCurrentLoad();
}
my $load = getCurrentLoad();
runCommand($command);
$total = getCurrentTotalNodes();
$avail = getCurrentAvailableNodes();
$load = getCurrentLoad();
my $running = getCurrentRunning();
my $percentage = 100 * $running / $total;
print("Nodes: $total Avail: $avail Load: $load Percent: $percentage Threshold: $threshold\n");
}

sub waitUntilFileExists
{
my $fileName = shift(@_);
my $flag = 0;
while(!$flag)
{
if(-e $fileName)
{
$flag = 1;
}
else
{
# print("Waiting for $fileName\n");
usleep(100);
}
}
}

sub waitUntilFileExistsTimeout
{
my $fileName = shift(@_);
my $waitTime = shift(@_) * 1000000;
my $flag = 0;
while(!$flag && $waitTime!=0)
{
if(-e $fileName)
{
$flag = 1;
}
else
{
usleep(100);
$waitTime -= 100;
}
}
}

sub waitUntilDirExists
{
my $dirName = shift(@_);
my $flag = 0;
while(!$flag)
{
if(-d $dirName)
{
$flag = 1;
}
else
{
# print("Waiting for $dirName\n");
usleep(100);
}
}
}

sub getDirsWithPrefix
{
my $root = shift(@_);
my $prefix = shift(@_);

opendir my $dh, $root
or die "$0: opendir: $!";
my @dirs = grep {-d "$root/$_" && ! /^\.{1,2}$/} readdir($dh);
return grep(/$prefix/, @dirs);
}

sub countDirsWithPrefix
{
return scalar(getDirsWithPrefix(shift(@_)));
}

1;
100 changes: 100 additions & 0 deletions bsuite/bsuite_all.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# This material was prepared as an account of work sponsored by an agency of the
# United States Government. Neither the United States Government nor the United
# States Department of Energy, nor Battelle, nor any of their employees, nor any
# jurisdiction or organization that has cooperated in the development of these
# materials, makes any warranty, express or implied, or assumes any legal
# liability or responsibility for the accuracy, completeness, or usefulness or
# any information, apparatus, product, software, or process disclosed, or
# represents that its use would not infringe privately owned rights. Reference
# herein to any specific commercial product, process, or service by trade name,
# trademark, manufacturer, or otherwise does not necessarily constitute or imply
# its endorsement, recommendation, or favoring by the United States Government
# or any agency thereof, or Battelle Memorial Institute. The views and opinions
# of authors expressed herein do not necessarily state or reflect those of the
# United States Government or any agency thereof.
# PACIFIC NORTHWEST NATIONAL LABORATORY
# operated by
# BATTELLE
# for the
# UNITED STATES DEPARTMENT OF ENERGY
# under Contract DE-AC05-76RL01830
import sys
from bsuite import sweep

subsets = {"all": ["bandit", "bandit_noise", "bandit_scale",
"cartpole", "cartpole_noise", "cartpole_scale", "cartpole_swingup",
"catch", "catch_noise", "catch_scale",
"deep_sea", "deep_sea_stochastic",
"discounting_chain",
"memory_len", "memory_size",
"mnist", "mnist_noise", "mnist_scale",
"mountain_car", "mountain_car_noise", "mountain_car_scale",
"umbrella_distract", "umbrella_length"],
"working": ["bandit", "bandit_noise", "bandit_scale",
"cartpole", "cartpole_noise", "cartpole_scale",
"catch", "catch_noise", "catch_scale",
"deep_sea", "deep_sea_stochastic",
"discounting_chain",
"memory_len", "memory_size",
"mnist", "mnist_noise", "mnist_scale",
"umbrella_distract", "umbrella_length"],
"developer": ["cartpole", "cartpole_noise", "bandit"],
"basic": ["bandit", "mnist", "catch", "mountain_car", "cartpole"],
"noise": ["bandit_noise", "mnist_noise", "catch_noise", "mountain_car_noise", "cartpole_noise"],
"scale": ["bandit_scale", "mnist_scale", "catch_scale", "mountain_car_scale", "cartpole_scale"],
"exploration": ["deep_sea", "deep_sea_stochastic", "cartpole_swingup"],
"credit_assignment": ["umbrella_length", "umbrella_distract", "discounting_chain"],
"memory": ["memory_len", "memory_size"],
"quick_basic": ["bandit", "catch", "discounting_chain"],
"dynamics_learning": ["cartpole_swingup", "deep_sea", "discounting_chain", "memory_len", "memory_size", "umbrella_length", "umbrella_distract"],
"cartpole": ["cartpole", "cartpole_noise", "cartpole_scale"],
"cartpole_only": ["cartpole"],
"cartpole_noise": ["cartpole_noise"],
"cartpole_scale": ["cartpole_scale"],
"cartpole_swingup": ["cartpole_swingup"],
"catch": ["catch", "catch_noise", "catch_scale"],
"catch_only": ["catch"],
"catch_noise": ["catch_noise"],
"catch_scale": ["catch_scale"],
"mountain_car_only": ["mountain_car"],
"mountain_car_noise": ["mountain_car_noise"],
"mountain_car_scale": ["mountain_car_scale"],
"deep": ["deep_sea", "deep_sea_stochastic"],
"umbrella": ["umbrella_length"],
"umb_dist": ["umbrella_distract"],
"discount": ["discounting_chain"],
"empty": []}


def parse_entry(entry):
temp = entry.split("/")
return temp[0], int(temp[1]) + 1

def get_all(filter):
ret = {}
for entry in sweep.SWEEP:
name, seed = parse_entry(entry)
reps = sweep.EPISODES[entry]
if filter is None or name in subsets[filter]:
if name in ret:
seed = max([ret[name][0], seed])
reps = max([ret[name][1], reps])
ret[name] = (seed, reps)
return ret


if __name__ == "__main__":
filter = "all"
if len(sys.argv) == 2:
filter = str(sys.argv[1])

if filter == "display":
for sub in subsets:
if sub != "empty":
print(sub)
else:
if filter not in subsets:
filter = "empty"
envs = get_all(filter)
for i in envs:
print(i, envs[i][0], envs[i][1])
Loading