Skip to content

Commit

Permalink
update notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
chiang-yuan committed Dec 22, 2024
1 parent 7bd9e51 commit 5fe4786
Showing 1 changed file with 284 additions and 10 deletions.
294 changes: 284 additions & 10 deletions examples/mof/widom-insertion.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"\u001b[32m2024-12-22 01:08:13.317\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mmlip_arena.tasks.mof\u001b[0m:\u001b[36m<module>\u001b[0m:\u001b[36m6\u001b[0m - \u001b[1m\n",
"\u001b[32m2024-12-22 11:40:02.836\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mmlip_arena.tasks.mof\u001b[0m:\u001b[36m<module>\u001b[0m:\u001b[36m6\u001b[0m - \u001b[1m\n",
"The module 'mlip_arena.tasks.mof' is adapted from the repository: https://github.com/hspark1212/DAC-SIM. \n",
"By using this module, you agree to the terms and conditions specified in the following license: \n",
"\n",
Expand All @@ -47,7 +47,7 @@
"text": [
"/pscratch/sd/c/cyrusyc/.conda/mlip-arena/lib/python3.11/site-packages/ase/io/cif.py:408: UserWarning: crystal system 'triclinic' is not interpreted for space group Spacegroup(1, setting=1). This may result in wrong setting!\n",
" warnings.warn(\n",
"\u001b[32m2024-12-22 01:08:15.893\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mmlip_arena.tasks.mof.input\u001b[0m:\u001b[36msave_to_db\u001b[0m:\u001b[36m45\u001b[0m - \u001b[1mmofs.db uploaded to atomind/mlip-arena/mof\u001b[0m\n"
"\u001b[32m2024-12-22 11:40:22.686\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mmlip_arena.tasks.mof.input\u001b[0m:\u001b[36msave_to_db\u001b[0m:\u001b[36m45\u001b[0m - \u001b[1mmofs.db uploaded to atomind/mlip-arena/mof\u001b[0m\n"
]
},
{
Expand Down Expand Up @@ -94,7 +94,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -121,7 +121,8 @@
"source": [
"from ase.build import molecule\n",
"from mlip_arena.models import MLIPEnum\n",
"from mlip_arena.tasks.mof.flow import run as MOF\n",
"from mlip_arena.tasks.mof.input import get_atoms_from_db\n",
"from mlip_arena.tasks.mof.flow import widom_insertion\n",
"\n",
"@flow\n",
"def benchmark_one():\n",
Expand Down Expand Up @@ -174,25 +175,298 @@
"metadata": {
"tags": []
},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">11:40:36.644 | <span style=\"color: #d7d700; text-decoration-color: #d7d700\">WARNING</span> | MDAnalysis.coordinates.AMBER - netCDF4 is not available. Writing AMBER ncdf files will be slow.\n",
"</pre>\n"
],
"text/plain": [
"11:40:36.644 | \u001b[38;5;184mWARNING\u001b[0m | MDAnalysis.coordinates.AMBER - netCDF4 is not available. Writing AMBER ncdf files will be slow.\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">11:40:44.431 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | distributed.http.proxy - To route to workers diagnostics web server please install jupyter-server-proxy: python -m pip install jupyter-server-proxy\n",
"</pre>\n"
],
"text/plain": [
"11:40:44.431 | \u001b[36mINFO\u001b[0m | distributed.http.proxy - To route to workers diagnostics web server please install jupyter-server-proxy: python -m pip install jupyter-server-proxy\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">11:40:44.445 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | distributed.scheduler - State start\n",
"</pre>\n"
],
"text/plain": [
"11:40:44.445 | \u001b[36mINFO\u001b[0m | distributed.scheduler - State start\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">11:40:44.503 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | distributed.scheduler - Scheduler at: tcp://128.55.64.42:36351\n",
"</pre>\n"
],
"text/plain": [
"11:40:44.503 | \u001b[36mINFO\u001b[0m | distributed.scheduler - Scheduler at: tcp://128.55.64.42:36351\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">11:40:44.505 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | distributed.scheduler - dashboard at: <span style=\"color: #0000ff; text-decoration-color: #0000ff\">http://128.55.64.42:8787/status</span>\n",
"</pre>\n"
],
"text/plain": [
"11:40:44.505 | \u001b[36mINFO\u001b[0m | distributed.scheduler - dashboard at: \u001b[94mhttp://128.55.64.42:8787/status\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">11:40:44.506 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | distributed.scheduler - Registering Worker plugin shuffle\n",
"</pre>\n"
],
"text/plain": [
"11:40:44.506 | \u001b[36mINFO\u001b[0m | distributed.scheduler - Registering Worker plugin shuffle\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"#!/bin/bash\n",
"\n",
"#SBATCH -A matgen\n",
"#SBATCH --mem=0\n",
"#SBATCH -t 00:30:00\n",
"#SBATCH -J mof\n",
"#SBATCH -q regular\n",
"#SBATCH -N 1\n",
"#SBATCH -C gpu\n",
"#SBATCH -G 4\n",
"source ~/.bashrc\n",
"module load python\n",
"source activate /pscratch/sd/c/cyrusyc/.conda/mlip-arena\n",
"/pscratch/sd/c/cyrusyc/.conda/mlip-arena/bin/python -m distributed.cli.dask_worker tcp://128.55.64.42:36351 --name dummy-name --nthreads 1 --memory-limit 59.60GiB --nanny --death-timeout 60\n",
"\n"
]
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">11:40:44.514 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | distributed.deploy.adaptive - Adaptive scaling started: minimum=10 maximum=20\n",
"</pre>\n"
],
"text/plain": [
"11:40:44.514 | \u001b[36mINFO\u001b[0m | distributed.deploy.adaptive - Adaptive scaling started: minimum=10 maximum=20\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">11:40:44.522 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | distributed.scheduler - Receive client connection: Client-a27a9a6e-c09c-11ef-8318-c77ccf4f19b4\n",
"</pre>\n"
],
"text/plain": [
"11:40:44.522 | \u001b[36mINFO\u001b[0m | distributed.scheduler - Receive client connection: Client-a27a9a6e-c09c-11ef-8318-c77ccf4f19b4\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">11:40:44.523 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | distributed.core - Starting established connection to tcp://128.55.64.42:48148\n",
"</pre>\n"
],
"text/plain": [
"11:40:44.523 | \u001b[36mINFO\u001b[0m | distributed.core - Starting established connection to tcp://128.55.64.42:48148\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">11:40:45.046 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | prefect.engine - Created flow run<span style=\"color: #800080; text-decoration-color: #800080\"> 'enormous-hog'</span> for flow<span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\"> 'run'</span>\n",
"</pre>\n"
],
"text/plain": [
"11:40:45.046 | \u001b[36mINFO\u001b[0m | prefect.engine - Created flow run\u001b[35m 'enormous-hog'\u001b[0m for flow\u001b[1;35m 'run'\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">11:40:45.048 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | prefect.engine - View at <span style=\"color: #0000ff; text-decoration-color: #0000ff\">https://app.prefect.cloud/account/f7d40474-9362-4bfa-8950-ee6a43ec00f3/workspace/d4bb0913-5f5e-49f7-bfc5-06509088baeb/runs/flow-run/c0c7a3f2-d8d0-4f17-9789-4e070f17bf3b</span>\n",
"</pre>\n"
],
"text/plain": [
"11:40:45.048 | \u001b[36mINFO\u001b[0m | prefect.engine - View at \u001b[94mhttps://app.prefect.cloud/account/f7d40474-9362-4bfa-8950-ee6a43ec00f3/workspace/d4bb0913-5f5e-49f7-bfc5-06509088baeb/runs/flow-run/c0c7a3f2-d8d0-4f17-9789-4e070f17bf3b\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">11:40:45.366 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | prefect.task_runner.dask - Connecting to existing Dask cluster SLURMCluster(00ac1d39, 'tcp://128.55.64.42:36351', workers=0, threads=0, memory=0 B)\n",
"</pre>\n"
],
"text/plain": [
"11:40:45.366 | \u001b[36mINFO\u001b[0m | prefect.task_runner.dask - Connecting to existing Dask cluster SLURMCluster(00ac1d39, 'tcp://128.55.64.42:36351', workers=0, threads=0, memory=0 B)\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">11:40:45.395 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | distributed.scheduler - Receive client connection: PrefectDaskClient-a2fe06b3-c09c-11ef-8318-c77ccf4f19b4\n",
"</pre>\n"
],
"text/plain": [
"11:40:45.395 | \u001b[36mINFO\u001b[0m | distributed.scheduler - Receive client connection: PrefectDaskClient-a2fe06b3-c09c-11ef-8318-c77ccf4f19b4\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">11:40:45.401 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | distributed.core - Starting established connection to tcp://128.55.64.42:48168\n",
"</pre>\n"
],
"text/plain": [
"11:40:45.401 | \u001b[36mINFO\u001b[0m | distributed.core - Starting established connection to tcp://128.55.64.42:48168\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "c88bb75bf9b84285bfd6d524e7d73650",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"0it [00:00, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">11:40:45.501 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | Task run 'get_atoms_from_db-6be' - Created task run 'get_atoms_from_db-6be' for task 'get_atoms_from_db'\n",
"</pre>\n"
],
"text/plain": [
"11:40:45.501 | \u001b[36mINFO\u001b[0m | Task run 'get_atoms_from_db-6be' - Created task run 'get_atoms_from_db-6be' for task 'get_atoms_from_db'\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from dask.distributed import Client\n",
"from dask_jobqueue import SLURMCluster\n",
"from prefect_dask import DaskTaskRunner\n",
"\n",
"from ase.build import molecule\n",
"from mlip_arena.models import MLIPEnum\n",
"from mlip_arena.tasks.mof.flow import run as MOF\n",
"\n",
"MOF()"
"# Orchestrate your awesome dask workflow runner\n",
"\n",
"nodes_per_alloc = 1\n",
"gpus_per_alloc = 4\n",
"ntasks = 1\n",
"\n",
"cluster_kwargs = dict(\n",
" cores=1,\n",
" memory=\"64 GB\",\n",
" shebang=\"#!/bin/bash\",\n",
" account=\"matgen\",\n",
" walltime=\"00:30:00\",\n",
" job_mem=\"0\",\n",
" job_script_prologue=[\n",
" \"source ~/.bashrc\",\n",
" \"module load python\",\n",
" \"source activate /pscratch/sd/c/cyrusyc/.conda/mlip-arena\",\n",
" ],\n",
" job_directives_skip=[\"-n\", \"--cpus-per-task\", \"-J\"],\n",
" job_extra_directives=[\n",
" \"-J mof\",\n",
" \"-q regular\",\n",
" f\"-N {nodes_per_alloc}\",\n",
" \"-C gpu\",\n",
" f\"-G {gpus_per_alloc}\",\n",
" ],\n",
")\n",
"\n",
"cluster = SLURMCluster(**cluster_kwargs)\n",
"print(cluster.job_script())\n",
"cluster.adapt(minimum_jobs=10, maximum_jobs=20)\n",
"client = Client(cluster)\n",
"\n",
"# Run the workflow on HPC cluster in parallel\n",
"\n",
"results = MOF.with_options(\n",
" task_runner=DaskTaskRunner(address=client.scheduler.address),\n",
" # log_prints=True,\n",
")()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "mlip-arena",
"language": "python",
"name": "mlip-arena"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand Down

0 comments on commit 5fe4786

Please sign in to comment.