{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Large-Scale Population Synthesis on HPC Facilities 🚀\n", "\n", "\n", "This tutorial will cover how to set up and run a large, multi-metallicity population run on an HPC with slurm.\n", "We will dive deeper into the `population_params.ini` file and how the `Population` class works for multi-metallicity populations." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Initialization File for multi-metallicity runs" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's copy the default population synthesis `ini` file to your working directory.\n", "Make sure you're on a cluster to be able to run and submit the jobs!\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import os\n", "import shutil\n", "from posydon.config import PATH_TO_POSYDON\n", "\n", "path_to_params = os.path.join(PATH_TO_POSYDON, \"posydon/popsyn/population_params_default.ini\")\n", "shutil.copyfile(path_to_params, './population_params.ini')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Open the `population_params.ini` file and you should see that the metallicity is currently set to solar (represented by a value of ``1.``), but in the comment, you can see all 8 currently supported metallicities. \n", "\n", "```\n", "metallicity = [1.] #[2., 1., 0.45, 0.2, 0.1, 0.01, 0.001, 0.0001]\n", "```\n", "\n", "For our test run, we do not require a large population, so set the number of binaries to 1000. \n", "You can also leave the metallicity at just solar for now, but for multi-metallicity runs, \n", "you would simply add whatever available metallicities you desire to the list.\n", "You might also want to make sure the `dump_rate` is set to 100 binaries for this example. What\n", "a `dump_rate = x` says is basically every time the POSYDON runs `x` binaries, dump their \n", "data into a file and remove them from RAM to free up some space. So, in this example, after \n", "each batch of 100 binaries is run we are going to save their data to a file and combine them \n", "all in the end. (If you are curious about guidelines on memory usage when running larger \n", "populations, please have a look at our [Code Usage FAQ](../../troubleshooting-faqs/code-questions.rst).)\n", "\n", "\n", "```\n", "dump_rate = 100\n", "...\n", "number_of_binaries = 1000\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Setup the Population Synthesis Run" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "POSYDON provides `posydon-popsyn setup` as a command line script that you can use to set up a (multi-metallicity) population run on an HPC facility.\n", "This will split each metallicity into a separate slurm job array and a dependent job which will automatically merge the output of the separate jobs.\n", "This removes the need to manually set up each slurm job.\n", "Below are two examples, but you might need to adjust the inputs for your email, cluster and available partitions.\n", "\n", "