-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into benc-test-bad-reg-interchange-exit
- Loading branch information
Showing
166 changed files
with
4,632 additions
and
4,456 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
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
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
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
File renamed without changes.
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,9 @@ | ||
"""Functions used as part of the workflow""" | ||
from typing import List, Tuple | ||
|
||
from .logic import convert_to_binary | ||
|
||
|
||
def convert_many_to_binary(xs: List[int]) -> List[Tuple[bool, ...]]: | ||
"""Convert a list of nonnegative integers to binary""" | ||
return [convert_to_binary(x) for x in xs] |
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,23 @@ | ||
from parsl.config import Config | ||
from parsl.executors import HighThroughputExecutor | ||
from parsl.providers import LocalProvider | ||
|
||
|
||
def make_local_config(cores_per_worker: int = 1) -> Config: | ||
"""Generate a configuration which runs all tasks on the local system | ||
Args: | ||
cores_per_worker: Number of cores to dedicate for each task | ||
Returns: | ||
Configuration object with the requested settings | ||
""" | ||
return Config( | ||
executors=[ | ||
HighThroughputExecutor( | ||
label="htex_local", | ||
cores_per_worker=cores_per_worker, | ||
cpu_affinity='block', | ||
provider=LocalProvider(), | ||
) | ||
], | ||
) |
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,15 @@ | ||
from typing import Tuple | ||
|
||
|
||
def convert_to_binary(x: int) -> Tuple[bool, ...]: | ||
"""Convert a nonnegative integer into a binary | ||
Args: | ||
x: Number to be converted | ||
Returns: | ||
The binary number represented as list of booleans | ||
""" | ||
if x < 0: | ||
raise ValueError('`x` must be nonnegative') | ||
bin_as_string = bin(x) | ||
return tuple(i == '1' for i in bin_as_string[2:]) |
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,7 @@ | ||
[project] | ||
name = "library" | ||
version = '0.0.0' | ||
description = 'Example library for Parsl documentation' | ||
|
||
[tool.setuptools.packages.find] | ||
include = ['library*'] |
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,35 @@ | ||
from argparse import ArgumentParser | ||
|
||
import parsl | ||
|
||
from library.config import make_local_config | ||
from library.app import convert_many_to_binary | ||
from parsl.app.python import PythonApp | ||
|
||
# Protect the script from running twice. | ||
# See "Safe importing of main module" in Python multiprocessing docs | ||
# https://docs.python.org/3/library/multiprocessing.html#multiprocessing-programming | ||
if __name__ == "__main__": | ||
# Get user instructions | ||
parser = ArgumentParser() | ||
parser.add_argument('--numbers-per-batch', default=8, type=int) | ||
parser.add_argument('numbers', nargs='+', type=int) | ||
args = parser.parse_args() | ||
|
||
# Prepare the workflow functions | ||
convert_app = PythonApp(convert_many_to_binary, cache=False) | ||
|
||
# Load the configuration | ||
# As a context manager so resources are shutdown on exit | ||
with parsl.load(make_local_config()): | ||
|
||
# Spawn tasks | ||
futures = [ | ||
convert_app(args.numbers[start:start + args.numbers_per_batch]) | ||
for start in range(0, len(args.numbers), args.numbers_per_batch) | ||
] | ||
|
||
# Retrieve task results | ||
for future in futures: | ||
for x, b in zip(future.task_record['args'][0], future.result()): | ||
print(f'{x} -> {"".join("1" if i else "0" for i in b)}') |
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,13 @@ | ||
Advanced Topics | ||
=============== | ||
|
||
More to learn about Parsl after starting a project. | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
modularizing | ||
usage_tracking | ||
monitoring | ||
parsl_perf | ||
plugins |
Oops, something went wrong.