Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.