Created
September 26, 2018 16:06
-
-
Save annawoodard/96e6ecc919391cd9725618a33bebfe32 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 parsl | |
from parsl.providers import SlurmProvider | |
from parsl.config import Config | |
from parsl.executors.ipp import IPyParallelExecutor | |
from parsl.app.app import python_app | |
config = Config( | |
executors=[ | |
IPyParallelExecutor( | |
provider=SlurmProvider( | |
'broadwl', | |
walltime="01:00:00", | |
init_blocks=1, | |
max_blocks=64, | |
nodes_per_block=1, | |
tasks_per_node=32, | |
), | |
) | |
] | |
) | |
parsl.set_stream_logger() | |
parsl.load(config) | |
@python_app | |
def child(parent, count): | |
import psutil | |
import os | |
template = 'parent {:3d}, child {:3d}: running on {}, cpu utilization is {}%' | |
return template.format(parent, count, os.environ['HOSTNAME'], psutil.cpu_percent()) | |
@python_app | |
def parent(count): | |
return count | |
children = [] | |
for i in range(0, 100): | |
p = parent(i) | |
for j in range(0, 64): | |
children.append(child(p, j)) | |
with open('results.txt', 'w') as f: | |
for c in children: | |
print(c.result(), file=f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment