From 587446a3b652f6b8e3b732966a095039e0e56c56 Mon Sep 17 00:00:00 2001 From: Ryoichi Ando Date: Tue, 24 Dec 2024 22:47:27 +0900 Subject: [PATCH] add aws readme --- README.md | 11 ++++++++++- articles/cloud.md | 2 +- examples/hang.ipynb | 48 +++++++++++++++++++++++++++++++++++++++++++-- src/backend.rs | 5 ++++- 4 files changed, 61 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index afa7765..4543062 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ Published in [ACM Transactions on Graphics (TOG)](https://dl.acm.org/doi/abs/10. - [πŸ“¦ Deploying on vast.ai](#-deploying-on-vastai) - [πŸ“¦ Deploying on RunPod](#-deploying-on-runpod) - [πŸ“¦ Deploying on Scaleway](#-deploying-on-scaleway) + - [πŸ“¦ Deploying on Amazon Web Services](#-deploying-on-amazon-web-services) - [πŸ“¦ Deploying on Google Compute Engine](#-deploying-on-google-compute-engine) - [πŸ§‘β€πŸ’» Setting Up Your Development Environment](#-setting-up-your-development-environment) - [πŸ“ƒ License](#-license) @@ -85,7 +86,7 @@ Our Python interface is designed with the following principles in mind: - **🚫 No Mesh Data**: Preparing mesh data using external tools can be cumbersome. Our frontend minimizes this effort by allowing meshes to be created on the fly or downloaded when needed. -- **πŸ”— Method Chaining**: We adopt the method chaining style from JavaScript, making the API intuitive and easy to use. +- **πŸ”— Method Chaining**: We adopt the method chaining style from JavaScript, making the API intuitive and easy to understand. - **πŸ“¦ Single Import for Everything**: All frontend features are accessible by simply importing with `from frontend import App`. @@ -399,9 +400,17 @@ You can deploy our solver on a RunPod instance. To do this, we need to select an - Select type `L4-1-24G` or `GPU-3070-S` - Choose `Ubuntu Jammy GPU OS 12` - *Do not skip* the Docker container creation in the installation process; it is required. +- This setup costs approximately €0.76 per hour. - CLI instructions are described in [[Markdown]](./articles/cloud.md#-scaleway). +### πŸ“¦ Deploying on [Amazon Web Services](https://aws.amazon.com/en/) + +- Amazon Machine Image (AMI): `Deep Learning Base OSS Nvidia Driver GPU AMI (Ubuntu 22.04)` +- Instance Type: `g6.2xlarge` (Recommended) +- This setup costs around $1 per hour. +- *Do not skip* the Docker container creation in the installation process; it is required. + ### πŸ“¦ Deploying on [Google Compute Engine](https://cloud.google.com/products/compute) - Select `GPUs`. We recommend the GPU type `NVIDIA L4` because it's affordable and accessible, as it does not require a high quota. You may select `T4` instead for testing purposes. diff --git a/articles/cloud.md b/articles/cloud.md index 2d08251..dccd2a4 100644 --- a/articles/cloud.md +++ b/articles/cloud.md @@ -225,7 +225,7 @@ rm -rf .runpod Set up your Scaleway CLI by following πŸ“š [this guide](https://www.scaleway.com/en/cli/). Also, register your public SSH key. Here’s how to create a GPU instance and SSH into the instance with port forwarding. -As of late 2024, this setup costs approximately €0.76 per hour. +This setup costs approximately €0.76 per hour. ```bash # set zone diff --git a/examples/hang.ipynb b/examples/hang.ipynb index ffc408f..6452d35 100644 --- a/examples/hang.ipynb +++ b/examples/hang.ipynb @@ -33,8 +33,16 @@ "param = app.session.param().set(\"dt\",0.001)\n", "param.set(\"strain-limit-eps\", 0.005).set(\"strain-limit-tau\", 0.005)\n", "param.set(\"frames\",200)\n", - "param.dyn(\"gravity\").time(1).hold().time(1.1).change(9.8).time(2.0).change(-9.8)\n", - "\n", + "param.dyn(\"gravity\").time(1).hold().time(1.1).change(9.8).time(2.0).change(-9.8);" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7284cf76-4110-41a0-88d2-6e028fe45aba", + "metadata": {}, + "outputs": [], + "source": [ "session = app.session.create(\"two-pins-hang\").init(fixed)\n", "session.start(param).preview();\n", "session.stream();" @@ -72,6 +80,42 @@ "# export all simulated frames\n", "session.export_animation(f\"export/{session.info.name}\")" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b318af59-58be-4ad4-ae4b-63af01e225fe", + "metadata": {}, + "outputs": [], + "source": [ + "param.set(\"dt\",0.1).set(\"enable-retry\",True)\n", + "\n", + "session = app.session.create(\"two-pins-hang-dt-01\").init(fixed)\n", + "session.start(param).preview();\n", + "session.stream();" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2887e9da-aa29-4468-9ace-62c93a7c25ef", + "metadata": {}, + "outputs": [], + "source": [ + "# run this cell after sufficnt frames are simulated\n", + "session.animate();" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9105a519-6aaa-4b59-9c5c-0bf96c081fc3", + "metadata": {}, + "outputs": [], + "source": [ + "# this is for CI\n", + "assert session.finished()" + ] } ], "metadata": { diff --git a/src/backend.rs b/src/backend.rs index 749faf3..ed14610 100644 --- a/src/backend.rs +++ b/src/backend.rs @@ -115,6 +115,10 @@ impl Backend { } pub fn run(&mut self, args: &Args, dataset: DataSet, mut param: ParamSet, scene: Scene) { + let finished_path = std::path::Path::new(args.output.as_str()).join("finished.txt"); + if finished_path.exists() { + std::fs::remove_file(finished_path.clone()).unwrap(); + } unsafe { initialize(&dataset, ¶m); } @@ -232,7 +236,6 @@ impl Backend { } } let _ = result_receiver.try_recv(); - let finished_path = std::path::Path::new(args.output.as_str()).join("finished.txt"); write_current_time_to_file(finished_path.to_str().unwrap()).unwrap(); } }