![]() Gets the number of digits from the command line argument and uses it to set the decimal precision.Imports the necessary Python libraries, which Anaconda provides for us.If you’re curious, here’s what it does, line by line: This is a Python script that calculates the value of pi using the mpmath library, which is included in the Anaconda module. Print("Done, seconds".format(digits, seconds)) You will then be asked if you want to save the file or discard changes.Ĭreate a file in your home directory called pi.py which includes the following: import sys To close nano, press Control-X or Command-X. To start creating the file below with nano, type in nano pi.py. We will use nano for this tutorial, but much documentation on vim and emacs is available online. Other text editors available are vim, which is more powerful but has a steeper learning curve, and emacs, which is extensible and customizable. For new users we recommend nano, which is simple and easy to use. There are many text editors available for Linux. While Anaconda is fine for this tutorial, if you end up using Python for your computational research projects, we strongly recommend using the ACCRE-optimized Python builds on the cluster instead of Anaconda. Lmod commands are case sensitive make sure you capitalize the A in Anaconda3. In your terminal, type in the following: module load Anaconda3 We will be loading the Anaconda3 module, which allows us to use many Python libraries that would otherwise be unavailable. Lmod is a tool for sharing modules within a high-performance computing environment (e.g. If you haven’t done so already, log in to ACCRE using a terminal. However, you will need an ACCRE account and should be familiar with Linux commands. Although we will be using Python code, you don’t need to know Python for this tutorial. In this tutorial we will be using a Python script to calculate the first million digits of PI using the ACCRE cluster. Submitting Your First Job: One Million Digits of Pi ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |