Skip to content

Commit

Permalink
replace notebooks with cpu and gpu variants
Browse files Browse the repository at this point in the history
  • Loading branch information
yasithdev committed Dec 18, 2024
1 parent a7a3d70 commit 25afabe
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,8 @@
" \"data/b4pull.restart.xsc\",\n",
" ],\n",
" parallelism=\"CPU\",\n",
" num_replicas=1,\n",
")\n",
"exp.add_replica(*ae.list_runtimes(cluster=\"login.expanse.sdsc.edu\", category=\"cpu\"))\n",
"exp.add_replica(*ae.list_runtimes(cluster=\"login.expanse.sdsc.edu\", category=\"cpu\", walltime=60))\n",
"ae.display(exp)"
]
},
Expand Down Expand Up @@ -360,8 +359,8 @@
"outputs": [],
"source": [
"plan.wait_for_completion() # wait for plan to complete\n",
"for task in plan.tasks:\n",
" task.download_all(f\"./results_{task.name}\") # download plan outputs"
"# for task in plan.tasks:\n",
"# task.download_all(f\"./results_{task.name}\") # download plan outputs"
]
},
{
Expand All @@ -386,17 +385,24 @@
" @task.context(packages=[\"numpy\", \"pandas\"])\n",
" def analyze() -> None:\n",
" import numpy as np\n",
" with open(\"pull.conf\", \"r\") as f:\n",
" with open(\"pull_cpu.conf\", \"r\") as f:\n",
" data = f.read()\n",
" print(\"pull.conf has\", len(data), \"chars\")\n",
" print(\"pull_cpu.conf has\", len(data), \"chars\")\n",
" print(np.arange(10))\n",
" analyze()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "airavata",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -410,9 +416,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.7"
"version": "3.11.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"metadata": {},
"outputs": [],
"source": [
"%cd dev-tools/deployment/jupyterhub/user-container/MD\n",
"import airavata_experiments as ae\n",
"from airavata_experiments import md"
]
Expand Down Expand Up @@ -145,8 +144,8 @@
"outputs": [],
"source": [
"exp = md.NAMD.initialize(\n",
" name=\"yasith_namd_experiment\",\n",
" config_file=\"data/pull_cpu.conf\",\n",
" name=\"SMD\",\n",
" config_file=\"data/pull_gpu.conf\",\n",
" pdb_file=\"data/structure.pdb\",\n",
" psf_file=\"data/structure.psf\",\n",
" ffp_files=[\n",
Expand All @@ -159,10 +158,9 @@
" \"data/b4pull.restart.vel\",\n",
" \"data/b4pull.restart.xsc\",\n",
" ],\n",
" parallelism=\"CPU\",\n",
" num_replicas=1,\n",
" parallelism=\"GPU\",\n",
")\n",
"exp.add_replica(*ae.list_runtimes(cluster=\"login.expanse.sdsc.edu\", category=\"cpu\"))\n",
"exp.add_replica(*ae.list_runtimes(cluster=\"login.expanse.sdsc.edu\", category=\"gpu\", walltime=180))\n",
"ae.display(exp)"
]
},
Expand Down Expand Up @@ -201,7 +199,7 @@
"outputs": [],
"source": [
"plan.save() # this will save the plan in DB\n",
"plan.save_json(\"plan.json\") # save the plan state locally"
"plan.save_json(\"plan_gpu.json\") # save the plan state locally"
]
},
{
Expand All @@ -222,7 +220,7 @@
"outputs": [],
"source": [
"plan.launch()\n",
"plan.save_json(\"plan.json\")"
"plan.save_json(\"plan_gpu.json\")"
]
},
{
Expand Down Expand Up @@ -257,7 +255,7 @@
"metadata": {},
"outputs": [],
"source": [
"plan = ae.plan.load_json(\"plan.json\")\n",
"plan = ae.plan.load_json(\"plan_gpu.json\")\n",
"plan = ae.plan.load(plan.id)\n",
"plan.status()\n",
"ae.display(plan)"
Expand Down Expand Up @@ -338,8 +336,8 @@
"outputs": [],
"source": [
"plan.wait_for_completion() # wait for plan to complete\n",
"for task in plan.tasks:\n",
" task.download_all(f\"./results_{task.name}\") # download plan outputs"
"# for task in plan.tasks:\n",
"# task.download_all(f\"./results_{task.name}\") # download plan outputs"
]
},
{
Expand All @@ -364,17 +362,24 @@
" @task.context(packages=[\"numpy\", \"pandas\"])\n",
" def analyze() -> None:\n",
" import numpy as np\n",
" with open(\"pull.conf\", \"r\") as f:\n",
" with open(\"pull_gpu.conf\", \"r\") as f:\n",
" data = f.read()\n",
" print(\"pull.conf has\", len(data), \"chars\")\n",
" print(\"pull_gpu.conf has\", len(data), \"chars\")\n",
" print(np.arange(10))\n",
" analyze()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "airavata",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -388,9 +393,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.7"
"version": "3.11.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}

0 comments on commit 25afabe

Please sign in to comment.