From a692a7e05fa38fafcfd56d47e733903ef18751bf Mon Sep 17 00:00:00 2001 From: Teal Dulcet Date: Tue, 9 Jul 2024 08:46:35 -0700 Subject: [PATCH] Updated GpuOwl notebook to install the old Nvidia drivers. --- .github/workflows/ci.yml | 3 +- README.md | 7 ++-- cudalucas.sh | 7 ++-- cudalucas2.sh | 7 ++-- google-colab/Colab CPU MPrime.ipynb | 26 +++++++------- google-colab/Colab GPU CUDALucas.ipynb | 40 ++++++++++----------- google-colab/Colab GPU GpuOwl.ipynb | 48 ++++++++++++++------------ google-colab/README.md | 15 ++++---- gpuowl-wrapper.sh | 2 +- mlucas.sh | 2 +- mprime-python-port/mprime.py | 19 +++++----- mprime.sh | 10 +++--- mprime2.sh | 10 +++--- 13 files changed, 99 insertions(+), 97 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad86d4d..4963ea0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,7 @@ jobs: - name: Before script run: | sed -i '/^GPU=/,/^fi/ s/^/# /' gpuowl.sh - [[ $CXX =~ ^clang ]] && sed -i 's/-O3 -flto/-O3/' gpuowl.sh + [[ $CXX == clang* ]] && sed -i 's/-O3 -flto/-O3/' gpuowl.sh sed -i '/^nohup / s/^/# /' gpuowl.sh sed -i '/^python3 -OO / s/^/# /' gpuowl.sh $CXX --version @@ -186,6 +186,7 @@ jobs: sysctl -n hw.physicalcpu_max hw.logicalcpu_max sysctl -n hw.cpufrequency hw.cpufrequency_max hw.tbfrequency kern.clockrate sysctl -n hw.memsize + sysctl -n hw.l1dcachesize hw.l2cachesize hw.l3cachesize python3 -X dev -c 'import platform; print(platform.mac_ver())' python3 -X dev primenet.py --help diff --git a/README.md b/README.md index 02a9b83..0a6d6e4 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,13 @@ Copyright © 2018 Teal Dulcet and Daniel Connelly ### Prime95/MPrime -Downloads, sets up and runs [Prime95](https://www.mersenne.org/download/#download). Supports only x86 CPUs. +Downloads, sets up and runs [Prime95/MPrime](https://www.mersenne.org/download/#download). Supports only x86 CPUs. ``` wget -qO - https://raw.github.com/tdulcet/Distributed-Computing-Scripts/master/mprime.sh | bash -s -- [PrimeNet User ID] [Computer name] [Type of work] [Idle time to run (mins)] ``` -To run Prime95 for Stress/Torture Testing, see the [Testing and Benchmarking](https://github.com/tdulcet/Testing-and-Benchmarking-Scripts) scripts. +To run MPrime for Stress/Torture Testing, see the [Testing and Benchmarking](https://github.com/tdulcet/Testing-and-Benchmarking-Scripts) scripts. ### CUDALucas @@ -325,6 +325,7 @@ PrimeNet program/script: * Support reporting interim residues. * Calculate the rolling average. * Support downloading certification assignments. + Requires support from one of more of the GIMPS programs. * Localize the output into other languages (see [here](https://mersenneforum.org/showthread.php?t=27046)). * Adapt Loïc Le Loarer's [test suite](https://github.com/llloic11/primenet/tree/main/tests). * Add an optional GUI using [Tk](https://en.wikipedia.org/wiki/Tk_(software)) and the [tkinter library](https://docs.python.org/3/library/tkinter.html) @@ -343,7 +344,7 @@ General: The scripts are all MIT licensed, except the PrimeNet program which is GPLv2. -Thanks to [Daniel Connelly](https://github.com/Danc2050) for updating the PrimeNet Python script from Mlucas to eliminate the password requirement by getting assignments using the [PrimeNet API](http://v5.mersenne.org/v5design/v5webAPI_0.97.html) and to support reporting the assignment results and progress for CUDALucas using the PrimeNet API, for porting the Prime95 script to Python and for helping create and test the Google Colab Jupyter Notebooks! +Thanks to [Daniel Connelly](https://github.com/Danc2050) for updating the PrimeNet Python script from Mlucas to eliminate the password requirement by getting assignments using the [PrimeNet API](http://v5.mersenne.org/v5design/v5webAPI_0.97.html) and to support reporting the assignment results and progress for CUDALucas using the PrimeNet API, for porting the MPrime script to Python and for helping create and test the Google Colab Jupyter Notebooks! Thanks to Ernst W. Mayer for helping test and for providing feedback on the Mlucas install script. diff --git a/cudalucas.sh b/cudalucas.sh index a162169..6f6e9ee 100644 --- a/cudalucas.sh +++ b/cudalucas.sh @@ -98,7 +98,7 @@ sed -i 's/\r//g' Makefile sed -i 's/^OptLevel = 1/OptLevel = 3/' Makefile CUDA=$(command -v nvcc | sed 's/\/bin\/nvcc$//') sed -i "s/^CUDA = \/usr\/local\/cuda/CUDA = ${CUDA//\//\\/}/" Makefile -sed -i 's/--compiler-options=-Wall/--compiler-options="-O$(OptLevel) -flto -Wall"/' Makefile +sed -i 's/--compiler-options=-Wall/-use_fast_math --compiler-options="-O$(OptLevel) -flto -Wall"/' Makefile CC=$(command -v "${CC:-gcc}") # sed -i "/^CUFLAGS / s/\$/ -ccbin ${CC//\//\\/}/" Makefile # -dlto sed -i '/^CFLAGS / s/$/ -flto/' Makefile @@ -109,10 +109,11 @@ cat </tmp/cudaComputeVersion.cu #include int main() { + const int device = $DEVICE; cudaDeviceProp prop; - cudaError_t status = cudaGetDeviceProperties(&prop, $DEVICE); + cudaError_t status = cudaGetDeviceProperties(&prop, device); if (status != cudaSuccess) { - fprintf(stderr, "cudaGetDeviceProperties() for device $DEVICE failed: %s\n", cudaGetErrorString(status)); + fprintf(stderr, "cudaGetDeviceProperties() for device %d failed: %s\n", device, cudaGetErrorString(status)); return 1; } const int v = prop.major * 10 + prop.minor; diff --git a/cudalucas2.sh b/cudalucas2.sh index 6806823..9a53592 100644 --- a/cudalucas2.sh +++ b/cudalucas2.sh @@ -85,7 +85,7 @@ else sed -i 's/^OptLevel = 1/OptLevel = 3/' Makefile CUDA=$(command -v nvcc | sed 's/\/bin\/nvcc$//') sed -i "s/^CUDA = \/usr\/local\/cuda/CUDA = ${CUDA//\//\\/}/" Makefile - sed -i 's/--compiler-options=-Wall/--compiler-options="-O$(OptLevel) -flto -Wall"/' Makefile + sed -i 's/--compiler-options=-Wall/-use_fast_math --compiler-options="-O$(OptLevel) -flto -Wall"/' Makefile CC=$(command -v "${CC:-gcc}") # sed -i "/^CUFLAGS / s/\$/ -ccbin ${CC//\//\\/}/" Makefile # -dlto sed -i '/^CFLAGS / s/$/ -flto/' Makefile @@ -95,10 +95,11 @@ else #include int main() { + const int device = $DEVICE; cudaDeviceProp prop; - cudaError_t status = cudaGetDeviceProperties(&prop, $DEVICE); + cudaError_t status = cudaGetDeviceProperties(&prop, device); if (status != cudaSuccess) { - fprintf(stderr, "cudaGetDeviceProperties() for device $DEVICE failed: %s\n", cudaGetErrorString(status)); + fprintf(stderr, "cudaGetDeviceProperties() for device %d failed: %s\n", device, cudaGetErrorString(status)); return 1; } const int v = prop.major * 10 + prop.minor; diff --git a/google-colab/Colab CPU MPrime.ipynb b/google-colab/Colab CPU MPrime.ipynb index a547599..770b8f9 100644 --- a/google-colab/Colab CPU MPrime.ipynb +++ b/google-colab/Colab CPU MPrime.ipynb @@ -22,7 +22,7 @@ "\n", "# @markdown #### ↖️ Click the ▶️ button after deciding on the options below.\n", "# @markdown #### 💡 Keep each notebook **open** in the browser to prevent disconnection. 📌 [the tab](https://support.mozilla.org/kb/pinned-tabs-keep-favorite-websites-open) or move them to a dedicated window for easy access.\n", - "# @markdown #### ℹ️ This notebook uses our Prime95 [Bash install script](https://github.com/tdulcet/Distributed-Computing-Scripts#organizations).\n", + "# @markdown #### ℹ️ This notebook uses our MPrime [Bash install script](https://github.com/tdulcet/Distributed-Computing-Scripts#organizations).\n", "# @markdown #### 📜 Please see the [documentation](https://github.com/tdulcet/Distributed-Computing-Scripts/tree/master/google-colab) for more information and to ❤️ support us.\n", "# @markdown #### 🤷 Optionally, create a GIMPS/PrimeNet account [here](https://www.mersenne.org/update/) and [join](https://www.mersenne.org/jteam/) the “Portland State University” team!\n", "\n", @@ -46,7 +46,7 @@ "proof_certification_work = True # @param {type:\"boolean\"}\n", "computer_number = 'Default (1)' # @param ['Default (1)', '2', '3', '4']{allow-input: true}\n", "local_time = 'Pacific' # @param ['Pacific', 'Mountain', 'Central', 'Eastern', 'Alaska', 'Hawaii']\n", - "debug = 'False' # @param ['False', 'CPU (Prime95)']\n", + "debug = 'False' # @param ['False', 'CPU (MPrime)']\n", "\n", "# @markdown #### 🐛 The *debug* option outputs CPU (Prime95/MPrime) progress and status, then exits.\n", "\n", @@ -63,7 +63,7 @@ " else: # use our notebook\n", " print('Warning: Google Drive is not mounted')\n", " print(\n", - " 'If you were not expecting this, on the far left click the folder icon, the \"Mount Drive\" folder button, select \"CONNECT TO GOOGLE DRIVE\" '\n", + " 'If you were not expecting this, on the far left click the folder icon, the \"Mount Drive\" folder button, select \"Connect to Google Drive\" '\n", " )\n", " print('and then re-execute this cell.')\n", " from google.colab import drive\n", @@ -79,31 +79,31 @@ "def run():\n", " '''Run MPrime.'''\n", " os.chmod('mprime_cpu/mprime', 0o777)\n", - " print('\\nStarting Prime95\\n')\n", + " print('\\nStarting MPrime\\n')\n", " !cd mprime_cpu && ./mprime -A{computer_number} -d | tee -ia '{'cpu' + computer_number + '.out'}'\n", "\n", "\n", "def debug_exit():\n", - " '''Output of Prime95 CPU outputs.'''\n", - " if debug == 'CPU (Prime95)' and os.path.exists(f'mprime_cpu/cpu{computer_number}.out'):\n", - " print('\\nCPU (Prime95) output:\\n')\n", + " '''Output of MPrime CPU outputs.'''\n", + " if debug.startswith('CPU') and os.path.exists(f'mprime_cpu/cpu{computer_number}.out'):\n", + " print('\\nCPU (MPrime) output:\\n')\n", " !tail -n 100 '{'mprime_cpu/cpu' + computer_number + '.out'}' # view MPrime progress\n", " os.chmod('mprime_cpu/mprime', 0o777)\n", " !cd mprime_cpu && ./mprime -s -A{computer_number}\n", " print()\n", " else:\n", - " print(f'No `{debug!r}` output file found for debug option and computer number `{computer_number!r}`.\\n')\n", + " print(f'No {debug!r} output file found for debug option and computer number {computer_number!r}.\\n')\n", "\n", "\n", "def install():\n", - " '''Download/Install/Configure Prime95.'''\n", + " '''Download/Install/Configure MPrime.'''\n", " !wget -nv -O master.zip https://github.com/tdulcet/Distributed-Computing-Scripts/archive/master.zip\n", " !unzip -o master.zip\n", - " print('\\nDownloading and setting up Prime95\\n')\n", + " print('\\nDownloading and setting up MPrime\\n')\n", " !cp Distributed-Computing-Scripts-master/{mprime2.sh,mprime2.exp,idletime.sh} .\n", " !sed -i 's/\"mprime\"/\"mprime_cpu\"/' mprime2.sh # Name the folder specific to the runtime type\n", - " !sed -i '/^\\.\\/mprime / s/^/echo \"Skipped\" # /' mprime2.sh # Do not start Prime95\n", - " !sed -i '/^nohup / s/^/echo \"Skipped\" # /' mprime2.sh # Do not start Prime95\n", + " !sed -i '/^\\.\\/mprime / s/^/echo \"Skipped\" # /' mprime2.sh # Do not start MPrime\n", + " !sed -i '/^nohup / s/^/echo \"Skipped\" # /' mprime2.sh # Do not start MPrime\n", " !sed -i '/^expect {/a \\\\t\"Max emergency memory in GiB/worker (*):\" { sleep 1; send -- \"3\\\\r\"; exp_continue }\\n\\t\"Get occasional proof certification work (*):\" { sleep 1; send -- \"PROOF_CERTIFICATION_WORK\\\\r\"; exp_continue }\\n\\t\"Minutes between disk writes (*):\" { sleep 1; send -- \"10\\\\r\"; exp_continue }\\n\\t\"Days of work to queue up (*):\" { sleep 1; send -- \"1\\\\r\"; exp_continue }' mprime2.exp\n", " !sed -i 's/PROOF_CERTIFICATION_WORK/'$proof_certification_work'/' mprime2.exp\n", " !sed -i 's/0.25/0.125/' mprime2.exp\n", @@ -137,7 +137,7 @@ "computer_name = '' if computer_name.lower() == 'default' else computer_name\n", "type_of_work = type_of_work.split('-', 1)[0].rstrip()\n", "proof_certification_work = 'y' if proof_certification_work else 'n'\n", - "computer_number = '1' if computer_number.lower() == 'default (1)' else computer_number.strip()\n", + "computer_number = '1' if computer_number.lower().startswith('default') else computer_number.strip()\n", "debug = False if debug == 'False' else debug\n", "\n", "\n", diff --git a/google-colab/Colab GPU CUDALucas.ipynb b/google-colab/Colab GPU CUDALucas.ipynb index 352b737..4593f82 100644 --- a/google-colab/Colab GPU CUDALucas.ipynb +++ b/google-colab/Colab GPU CUDALucas.ipynb @@ -23,7 +23,7 @@ "# @markdown #### ↖️ Click the ▶️ button after deciding on the options below.\n", "# @markdown #### 🔌 Make sure the GPU is enabled under *Runtime→Change runtime type*\n", "# @markdown #### 💡 Keep each notebook **open** in the browser to prevent disconnection. 📌 [the tab](https://support.mozilla.org/kb/pinned-tabs-keep-favorite-websites-open) or move them to a dedicated window for easy access.\n", - "# @markdown #### ℹ️ This notebook uses both our CUDALucas and Prime95 [Bash install scripts](https://github.com/tdulcet/Distributed-Computing-Scripts#organizations) and our [PrimeNet Python program](https://github.com/tdulcet/Distributed-Computing-Scripts#primenet).\n", + "# @markdown #### ℹ️ This notebook uses both our CUDALucas and MPrime [Bash install scripts](https://github.com/tdulcet/Distributed-Computing-Scripts#organizations) and our [PrimeNet Python program](https://github.com/tdulcet/Distributed-Computing-Scripts#primenet).\n", "# @markdown #### 📜 Please see the [documentation](https://github.com/tdulcet/Distributed-Computing-Scripts/tree/master/google-colab) for more information and to ❤️ support us.\n", "# @markdown #### 🤷 Optionally, create a GIMPS/PrimeNet account [here](https://www.mersenne.org/update/) and [join](https://www.mersenne.org/jteam/) the “Portland State University” team!\n", "\n", @@ -47,9 +47,9 @@ "# @markdown 12 | 23.84 | 47.68 | 71.52 | 95.36 | 119.2 | 143 | 158.4\n", "CPU_proof_certification_work = True # @param {type:\"boolean\"}\n", "computer_number = 'Default (1)' # @param ['Default (1)', '2', '3', '4'] {allow-input: true}\n", - "output_type = 'GPU (CUDALucas)' # @param ['GPU and CPU', 'GPU (CUDALucas)', 'CPU (Prime95)']\n", + "output_type = 'GPU (CUDALucas)' # @param ['GPU and CPU', 'GPU (CUDALucas)', 'CPU (MPrime)']\n", "local_time = 'Pacific' # @param ['Pacific', 'Mountain', 'Central', 'Eastern', 'Alaska', 'Hawaii']\n", - "debug = 'False' # @param ['False', 'GPU (CUDALucas)', 'CPU (Prime95)']\n", + "debug = 'False' # @param ['False', 'GPU (CUDALucas)', 'CPU (MPrime)']\n", "\n", "# @markdown #### 🐛 The *debug* option outputs GPU (CUDALucas) or CPU (Prime95/MPrime) progress and status, then exits.\n", "\n", @@ -84,26 +84,26 @@ "\n", " os.chmod('mprime_gpu/mprime', 0o777)\n", " if output_type == 'GPU and CPU':\n", - " print('\\nStarting Prime95\\n')\n", + " print('\\nStarting MPrime\\n')\n", " !cd mprime_gpu; nohup ./mprime -A{computer_number} -d >> '{'cpu' + computer_number + '.out'}' &\n", " print('\\nStarting CUDALucas\\n')\n", " !cd cudalucas; nohup ./CUDALucas -i '{'CUDALucas' + computer_number + '.ini'}' >> '{'gpu' + computer_number + '.out'}' &\n", " !tail -f '{'mprime_gpu/cpu' + computer_number + '.out'}' '{'cudalucas/primenet' + computer_number + '.out'}' '{'cudalucas/gpu' + computer_number + '.out'}'\n", - " elif output_type == 'GPU (CUDALucas)':\n", - " print('\\nStarting Prime95\\n')\n", + " elif output_type.startswith('GPU'):\n", + " print('\\nStarting MPrime\\n')\n", " !cd mprime_gpu; nohup ./mprime -A{computer_number} -d >> '{'cpu' + computer_number + '.out'}' &\n", " print('\\nStarting CUDALucas\\n')\n", " !cd cudalucas && tail '{'primenet' + computer_number + '.out'}' '{'gpu' + computer_number + '.out'}'\n", " !cd cudalucas && ./CUDALucas -k -i '{'CUDALucas' + computer_number + '.ini'}' | tee -ia '{'gpu' + computer_number + '.out'}'\n", - " elif output_type == 'CPU (Prime95)':\n", + " elif output_type.startswith('CPU'):\n", " print('\\nStarting CUDALucas\\n')\n", " !cd cudalucas; nohup ./CUDALucas -i '{'CUDALucas' + computer_number + '.ini'}' >> '{'gpu' + computer_number + '.out'}' &\n", - " print('\\nStarting Prime95\\n')\n", + " print('\\nStarting MPrime\\n')\n", " !cd mprime_gpu && ./mprime -A{computer_number} -d | tee -ia '{'cpu' + computer_number + '.out'}'\n", "\n", "\n", "def install():\n", - " '''Download/Install/Configure CUDALucas then Prime95.'''\n", + " '''Download/Install/Configure CUDALucas then MPrime.'''\n", " !wget -nv -O master.zip https://github.com/tdulcet/Distributed-Computing-Scripts/archive/master.zip\n", " !unzip -o master.zip\n", "\n", @@ -121,11 +121,11 @@ " !cd cudalucas && python3 -OO primenet.py -t 0 --checkin 1 -W 1 -T {GPU_type_of_work} -u '{prime_ID}' -i '{'worktodo' + computer_number + '.txt'}' -r '{'results' + computer_number + '.txt'}' -l '{'local' + computer_number + '.ini'}' --cudalucas '{'gpu' + computer_number + '.out'}' -H '{computer_name}'\n", " !cp -u Distributed-Computing-Scripts-master/google-colab/gpu_optimizations/* cudalucas/\n", "\n", - " print('\\nDownloading and setting up Prime95\\n')\n", + " print('\\nDownloading and setting up MPrime\\n')\n", " !cp Distributed-Computing-Scripts-master/{mprime2.sh,mprime2.exp} .\n", " !sed -i 's/\"mprime\"/\"mprime_gpu\"/' mprime2.sh # Name the folder specific to the runtime type\n", - " !sed -i '/^\\.\\/mprime / s/^/echo \"Skipped\" # /' mprime2.sh # Do not start Prime95\n", - " !sed -i '/^nohup / s/^/echo \"Skipped\" # /' mprime2.sh # Do not start Prime95\n", + " !sed -i '/^\\.\\/mprime / s/^/echo \"Skipped\" # /' mprime2.sh # Do not start MPrime\n", + " !sed -i '/^nohup / s/^/echo \"Skipped\" # /' mprime2.sh # Do not start MPrime\n", " !sed -i '/^expect {/a \\\\t\"Max emergency memory in GiB/worker (*):\" { sleep 1; send -- \"3\\\\r\"; exp_continue }\\n\\t\"Get occasional proof certification work (*):\" { sleep 1; send -- \"CPU_PROOF_CERTIFICATION_WORK\\\\r\"; exp_continue }\\n\\t\"Minutes between disk writes (*):\" { sleep 1; send -- \"10\\\\r\"; exp_continue }\\n\\t\"Days of work to queue up (*):\" { sleep 1; send -- \"1\\\\r\"; exp_continue }' mprime2.exp\n", " !sed -i 's/CPU_PROOF_CERTIFICATION_WORK/'$CPU_proof_certification_work'/' mprime2.exp\n", " !sed -i 's/0.25/0.125/' mprime2.exp\n", @@ -146,8 +146,8 @@ "\n", "\n", "def debug_exit():\n", - " '''Output GPU and output of Prime95 or CUDALucas output.'''\n", - " if debug == 'GPU (CUDALucas)' and os.path.exists(f'cudalucas/gpu{computer_number}.out'):\n", + " '''Output GPU and output of MPrime or CUDALucas output.'''\n", + " if debug.startswith('GPU') and os.path.exists(f'cudalucas/gpu{computer_number}.out'):\n", " print(f'\\nOutput for computer number {computer_number}:\\n')\n", " print('\\nPrimeNet output:\\n')\n", " !tail -n 100 '{'cudalucas/primenet' + computer_number + '.out'}' # view primenet output\n", @@ -155,14 +155,14 @@ " !tail -n 100 '{'cudalucas/gpu' + computer_number + '.out'}' # view CUDALucas progress\n", " !cd cudalucas && python3 -OO primenet.py -l '{'local' + computer_number + '.ini'}' -s\n", " print()\n", - " elif debug == 'CPU (Prime95)' and os.path.exists(f'mprime_gpu/cpu{computer_number}.out'):\n", - " print('\\nCPU (Prime95) output:\\n')\n", + " elif debug.startswith('CPU') and os.path.exists(f'mprime_gpu/cpu{computer_number}.out'):\n", + " print('\\nCPU (MPrime) output:\\n')\n", " !tail -n 100 '{'mprime_gpu/cpu' + computer_number + '.out'}' # view MPrime progress\n", " os.chmod('mprime_gpu/mprime', 0o777)\n", " !cd mprime_gpu && ./mprime -s -A{computer_number}\n", " print()\n", " else:\n", - " print(f'No `{debug!r}` output file found for debug option and computer number `{computer_number!r}`.\\n')\n", + " print(f'No {debug!r} output file found for debug option and computer number {computer_number!r}.\\n')\n", "\n", "\n", "def load_drive():\n", @@ -174,7 +174,7 @@ " else: # use our notebook\n", " print('Warning: Google Drive is not mounted')\n", " print(\n", - " 'If you were not expecting this, on the far left click the folder icon, the \"Mount Drive\" folder button, select \"CONNECT TO GOOGLE DRIVE\" '\n", + " 'If you were not expecting this, on the far left click the folder icon, the \"Mount Drive\" folder button, select \"Connect to Google Drive\" '\n", " )\n", " print('and then re-execute this cell.')\n", " from google.colab import drive\n", @@ -193,7 +193,7 @@ " global gpu_info\n", " gpu_info = '\\n'.join(gpu_info)\n", " if gpu_info.find('failed') >= 0:\n", - " print('Select the \"Runtime\" → \"Change runtime type\" → \"GPU\" → \"SAVE\" to enable a GPU accelerator, ')\n", + " print('Select the \"Runtime\" → \"Change runtime type\" → \"GPU\" → \"Save\" to enable a GPU accelerator, ')\n", " print('and then re-execute this cell.')\n", " raise StopExecution\n", " print(f'\\nGraphics Processor (GPU):\\t{gpu_info}\\n')\n", @@ -212,7 +212,7 @@ "# use/cleanup input from user\n", "prime_ID = 'psu' if prime_ID.lower() == 'default' else prime_ID\n", "computer_name = '' if computer_name.lower() == 'default' else computer_name\n", - "computer_number = '1' if computer_number.lower() == 'default (1)' else computer_number.strip()\n", + "computer_number = '1' if computer_number.lower().startswith('default') else computer_number.strip()\n", "CPU_type_of_work = CPU_type_of_work.split('-', 1)[0].rstrip()\n", "CPU_proof_certification_work = 'y' if CPU_proof_certification_work else 'n'\n", "GPU_type_of_work = GPU_type_of_work.split('-', 1)[0].rstrip()\n", diff --git a/google-colab/Colab GPU GpuOwl.ipynb b/google-colab/Colab GPU GpuOwl.ipynb index c21c08a..c590b2c 100644 --- a/google-colab/Colab GPU GpuOwl.ipynb +++ b/google-colab/Colab GPU GpuOwl.ipynb @@ -23,7 +23,7 @@ "# @markdown #### ↖️ Click the ▶️ button after deciding on the options below.\n", "# @markdown #### 🔌 Make sure the GPU is enabled under *Runtime→Change runtime type*\n", "# @markdown #### 💡 Keep each notebook **open** in the browser to prevent disconnection. 📌 [the tab](https://support.mozilla.org/kb/pinned-tabs-keep-favorite-websites-open) or move them to a dedicated window for easy access.\n", - "# @markdown #### ℹ️ This notebook uses both our GpuOwl and Prime95 [Bash install scripts](https://github.com/tdulcet/Distributed-Computing-Scripts#organizations) and our [PrimeNet Python program](https://github.com/tdulcet/Distributed-Computing-Scripts#primenet).\n", + "# @markdown #### ℹ️ This notebook uses both our GpuOwl and MPrime [Bash install scripts](https://github.com/tdulcet/Distributed-Computing-Scripts#organizations) and our [PrimeNet Python program](https://github.com/tdulcet/Distributed-Computing-Scripts#primenet).\n", "# @markdown #### 📜 Please see the [documentation](https://github.com/tdulcet/Distributed-Computing-Scripts/tree/master/google-colab) for more information and to ❤️ support us.\n", "# @markdown #### 🤷 Optionally, create a GIMPS/PrimeNet account [here](https://www.mersenne.org/update/) and [join](https://www.mersenne.org/jteam/) the “Portland State University” team!\n", "\n", @@ -48,14 +48,14 @@ "# @markdown 12 | 23.84 | 47.68 | 71.52 | 95.36 | 119.2 | 143 | 158.4\n", "CPU_proof_certification_work = True # @param {type:\"boolean\"}\n", "computer_number = 'Default (1)' # @param ['Default (1)', '2', '3', '4'] {allow-input: true}\n", - "output_type = 'GPU (GpuOwl)' # @param ['GPU and CPU', 'GPU (GpuOwl)', 'CPU (Prime95)']\n", + "output_type = 'GPU (GpuOwl)' # @param ['GPU and CPU', 'GPU (GpuOwl)', 'CPU (MPrime)']\n", "# @markdown #### 🦉 GpuOwl version to use for each worktype:\n", "gpuowl_prp_pm1 = 'v7.2-112' # @param ['v7.2-112', 'v6']\n", "gpuowl_prp = 'Latest' # @param ['Latest', 'v7.2-112', 'v6']\n", "gpuowl_ll = 'v6' # @param ['v6']\n", "gpuowl_pm1 = 'v6' # @param ['Latest', 'v6']\n", "local_time = 'Pacific' # @param ['Pacific', 'Mountain', 'Central', 'Eastern', 'Alaska', 'Hawaii']\n", - "debug = 'False' # @param ['False', 'GPU (GpuOwl)', 'CPU (Prime95)']\n", + "debug = 'False' # @param ['False', 'GPU (GpuOwl)', 'CPU (MPrime)']\n", "\n", "# @markdown #### 🐛 The *debug* option outputs GPU (GpuOwl) or CPU (Prime95/MPrime) progress and status, then exits.\n", "\n", @@ -90,28 +90,28 @@ " !sed -i '/^PROOF_POWER=/c\\PROOF_POWER={GPU_prp_proof_power}' '{file}'\n", "\n", " if output_type == 'GPU and CPU':\n", - " print('\\nStarting Prime95\\n')\n", + " print('\\nStarting MPrime\\n')\n", " !cd mprime_gpu; nohup ./mprime -A{computer_number} -d >> '{'cpu' + computer_number + '.out'}' &\n", " print('\\nStarting GpuOwl\\n')\n", - " !cd '{adir}'; nohup ./gpuowl > gpu.out &\n", + " !cd '{adir}'; nohup stdbuf -oL ./gpuowl > gpu.out &\n", " ![[ -e '{adir + '/gpuowl.log'}' ]] && tail '{adir + '/gpuowl.log'}'\n", " !tail -f '{'mprime_gpu/cpu' + computer_number + '.out'}' '{adir + '/primenet.out'}' '{adir + '/gpu.out'}'\n", - " elif output_type == 'GPU (GpuOwl)':\n", - " print('\\nStarting Prime95\\n')\n", + " elif output_type.startswith('GPU'):\n", + " print('\\nStarting MPrime\\n')\n", " !cd mprime_gpu; nohup ./mprime -A{computer_number} -d >> '{'cpu' + computer_number + '.out'}' &\n", " print('\\nStarting GpuOwl\\n')\n", - " !cd '{adir}'; nohup ./gpuowl > gpu.out &\n", + " !cd '{adir}'; nohup stdbuf -oL ./gpuowl > gpu.out &\n", " ![[ -e '{adir + '/gpuowl.log'}' ]] && tail '{adir + '/gpuowl.log'}'\n", " !cd '{adir}' && tail -f primenet.out gpu.out\n", - " elif output_type == 'CPU (Prime95)':\n", + " elif output_type.startswith('CPU'):\n", " print('\\nStarting GpuOwl\\n')\n", " !cd '{adir}'; nohup ./gpuowl > gpu.out &\n", - " print('\\nStarting Prime95\\n')\n", + " print('\\nStarting MPrime\\n')\n", " !cd mprime_gpu && ./mprime -A{computer_number} -d | tee -ia '{'cpu' + computer_number + '.out'}'\n", "\n", "\n", "def install():\n", - " '''Download/Install/Configure GpuOwl then Prime95.'''\n", + " '''Download/Install/Configure GpuOwl then MPrime.'''\n", " !wget -nv -O master.zip https://github.com/tdulcet/Distributed-Computing-Scripts/archive/master.zip\n", " !unzip -o master.zip\n", "\n", @@ -131,11 +131,11 @@ " print('\\nRegistering computer with PrimeNet\\n')\n", " !cd '{'gpuowl/' + computer_number}' && python3 -OO ../primenet.py -t 0 --checkin 1 -W 1 -T {GPU_type_of_work} -u '{prime_ID}' -i 'worktodo.ini' -r 'results.ini' -g -H '{computer_name}'\n", "\n", - " print('\\nDownloading and setting up Prime95\\n')\n", + " print('\\nDownloading and setting up MPrime\\n')\n", " !cp Distributed-Computing-Scripts-master/{mprime2.sh,mprime2.exp} .\n", " !sed -i 's/\"mprime\"/\"mprime_gpu\"/' mprime2.sh # Name the folder specific to the runtime type\n", - " !sed -i '/^\\.\\/mprime / s/^/echo \"Skipped\" # /' mprime2.sh # Do not start Prime95\n", - " !sed -i '/^nohup / s/^/echo \"Skipped\" # /' mprime2.sh # Do not start Prime95\n", + " !sed -i '/^\\.\\/mprime / s/^/echo \"Skipped\" # /' mprime2.sh # Do not start MPrime\n", + " !sed -i '/^nohup / s/^/echo \"Skipped\" # /' mprime2.sh # Do not start MPrime\n", " !sed -i '/^expect {/a \\\\t\"Max emergency memory in GiB/worker (*):\" { sleep 1; send -- \"3\\\\r\"; exp_continue }\\n\\t\"Get occasional proof certification work (*):\" { sleep 1; send -- \"CPU_PROOF_CERTIFICATION_WORK\\\\r\"; exp_continue }\\n\\t\"Minutes between disk writes (*):\" { sleep 1; send -- \"10\\\\r\"; exp_continue }\\n\\t\"Days of work to queue up (*):\" { sleep 1; send -- \"1\\\\r\"; exp_continue }' mprime2.exp\n", " !sed -i 's/CPU_PROOF_CERTIFICATION_WORK/'$CPU_proof_certification_work'/' mprime2.exp\n", " !sed -i 's/0.25/0.125/' mprime2.exp\n", @@ -156,8 +156,8 @@ "\n", "\n", "def debug_exit():\n", - " '''Output GPU and output of Prime95 or GpuOwl output.'''\n", - " if debug == 'GPU (GpuOwl)' and os.path.exists(f'gpuowl/{computer_number}/gpu.out'):\n", + " '''Output GPU and output of MPrime or GpuOwl output.'''\n", + " if debug.startswith('GPU') and os.path.exists(f'gpuowl/{computer_number}/gpu.out'):\n", " print(f'\\nOutput for computer number {computer_number}:\\n')\n", " print('\\nPrimeNet output:\\n')\n", " !tail -n 100 '{'gpuowl/' + computer_number + '/primenet.out'}' # view primenet output\n", @@ -165,14 +165,14 @@ " !tail -n 100 '{'gpuowl/' + computer_number + '/gpu.out'}' # view GpuOwl progress\n", " !cd '{'gpuowl/' + computer_number}' && python3 -OO ../primenet.py -s\n", " print()\n", - " elif debug == 'CPU (Prime95)' and os.path.exists(f'mprime_gpu/cpu{computer_number}.out'):\n", - " print('\\nCPU (Prime95) output:\\n')\n", + " elif debug.startswith('CPU') and os.path.exists(f'mprime_gpu/cpu{computer_number}.out'):\n", + " print('\\nCPU (MPrime) output:\\n')\n", " !tail -n 100 '{'mprime_gpu/cpu' + computer_number + '.out'}' # view MPrime progress\n", " os.chmod('mprime_gpu/mprime', 0o777)\n", " !cd mprime_gpu && ./mprime -s -A{computer_number}\n", " print()\n", " else:\n", - " print(f'No `{debug!r}` output file found for debug option and computer number `{computer_number!r}`.\\n')\n", + " print(f'No {debug!r} output file found for debug option and computer number {computer_number!r}.\\n')\n", "\n", "\n", "def load_drive():\n", @@ -182,7 +182,7 @@ " else: # use our notebook\n", " print('Warning: Google Drive is not mounted')\n", " print(\n", - " 'If you were not expecting this, on the far left click the folder icon, the \"Mount Drive\" folder button, select \"CONNECT TO GOOGLE DRIVE\" '\n", + " 'If you were not expecting this, on the far left click the folder icon, the \"Mount Drive\" folder button, select \"Connect to Google Drive\" '\n", " )\n", " print('and then re-execute this cell.')\n", " from google.colab import drive\n", @@ -200,13 +200,17 @@ " global gpu_info\n", " gpu_info = '\\n'.join(gpu_info)\n", " if gpu_info.find('failed') >= 0:\n", - " print('Select the \"Runtime\" → \"Change runtime type\" → \"GPU\" → \"SAVE\" to enable a GPU accelerator, ')\n", + " print('Select the \"Runtime\" → \"Change runtime type\" → \"GPU\" → \"Save\" to enable a GPU accelerator, ')\n", " print('and then re-execute this cell.')\n", " raise StopExecution\n", " print(f'\\nGraphics Processor (GPU):\\t{gpu_info}\\n')\n", "\n", "\n", "gpu_check()\n", + "print('\\nInstalling the old Nvidia Drivers with OpenCL support\\nThis may take a few minutes...\\n')\n", + "!sudo apt-get update -yqq\n", + "!sudo apt-get purge -yqq '*nvidia-driver*'\n", + "!DEBIAN_FRONTEND=noninteractive sudo -E apt-get install -yqq nvidia-driver-530\n", "!wget -qO - https://raw.github.com/tdulcet/Linux-System-Information/master/info.sh | bash -s # Check System Info\n", "!python3 -V\n", "print()\n", @@ -219,7 +223,7 @@ "# use/cleanup input from user\n", "prime_ID = 'psu' if prime_ID.lower() == 'default' else prime_ID\n", "computer_name = '' if computer_name.lower() == 'default' else computer_name\n", - "computer_number = '1' if computer_number.lower() == 'default (1)' else computer_number.strip()\n", + "computer_number = '1' if computer_number.lower().startswith('default') else computer_number.strip()\n", "CPU_type_of_work = CPU_type_of_work.split('-', 1)[0].rstrip()\n", "CPU_proof_certification_work = 'y' if CPU_proof_certification_work else 'n'\n", "GPU_type_of_work = GPU_type_of_work.split('-', 1)[0].rstrip()\n", diff --git a/google-colab/README.md b/google-colab/README.md index 686ad2b..576612c 100644 --- a/google-colab/README.md +++ b/google-colab/README.md @@ -1,24 +1,21 @@ # Google Colaboratory and GIMPS Google offers a service known as [Colaboratory](https://research.google.com/colaboratory/faq.html) (Colab), which allows anyone with an internet connection free access to high-performance TPU, GPU and CPU-powered [Jupyter Notebooks](https://en.wikipedia.org/wiki/Project_Jupyter#Jupyter_Notebook). This service can be used to run Distributed Computing projects such as the [Great Internet Mersenne Prime Search](https://www.mersenne.org/) (GIMPS) for free. -GIMPS can be run on some Nvidia, AMD and Intel GPUs using the [GpuOwl](https://github.com/preda/gpuowl) program or a CPU using the [Prime95](https://www.mersenne.org/download/) program. +GIMPS can be run on some Nvidia, AMD and Intel GPUs using the [GpuOwl](https://github.com/preda/gpuowl) program or a CPU using the [Prime95/MPrime](https://www.mersenne.org/download/) program. -This repository contains two Jupyter Notebooks, a “CPU” only notebook (`Colab CPU MPrime.ipynb`) and a “GPU and CPU” notebook (`Colab GPU GpuOwl.ipynb`). The “CPU” only notebook runs Prime95, while the “GPU and CPU” notebook runs both GpuOwl and Prime95 since they can run simultaneously to “crunch” more prime numbers. Previous versions of the GPU notebook ran CUDALucas. +This repository contains two Jupyter Notebooks, a “CPU” only notebook (`Colab CPU MPrime.ipynb`) and a “GPU and CPU” notebook (`Colab GPU GpuOwl.ipynb`). The “CPU” only notebook runs MPrime, while the “GPU and CPU” notebook runs both GpuOwl and MPrime since they can run simultaneously to “crunch” more prime numbers. Previous versions of the GPU notebook ran CUDALucas. Each notebook makes use of Google Drive storage, which is provided to all Google accounts. See here for a [“TPU” only notebook](https://github.com/TPU-Mersenne-Prime-Search/TensorPrime/wiki/Usage-and-Arguments) which runs TensorPrime. -> [!IMPORTANT] -> The “GPU and CPU” notebook does not currently work, as [OpenCL is broken on Colab](https://github.com/googlecolab/colabtools/issues/3592) and GpuOwl uses OpenCL. Users can temporarily switch back to the older version of the notebook [`Colab GPU CUDALucas.ipynb`](Colab%20GPU%20CUDALucas.ipynb), which runs CUDALucas. CUDALucas is slower than GpuOwl, but it uses CUDA, which still works on Colab. - ## How to Use **Please Note:** you must keep each notebook **OPEN** in your browser to prevent it from disconnecting due to being perceived as idle. [Pin the tab(s)](https://support.mozilla.org/en-US/kb/pinned-tabs-keep-favorite-websites-open) or move them to a dedicated window for easy access to your notebook(s). -1. **Choose a Persistent Storage Option** Recommend Method: Copy the source of our respective [“GPU and CPU” notebook](Colab%20GPU%20GpuOwl.ipynb) and/or [“CPU” notebook](Colab%20CPU%20MPrime.ipynb), pasting them into one or more [new notebooks](http://colab.research.google.com/#create=true) in Colab. Then, uniquely name and save the notebook(s) (Ctrl + s). Then, on the far left, click “📁”, the “Mount Drive” folder button and select “CONNECT TO GOOGLE DRIVE”. Your Drive storage should automatically remount each time you run the notebook(s). You may need to repeat this last part after a while. See the official [video](https://video.twimg.com/tweet_video/EQbtltjVAAA2qTs.mp4) for a walkthrough. +1. **Choose a Persistent Storage Option** Recommend Method: Copy the source of our respective [“GPU and CPU” notebook](Colab%20GPU%20GpuOwl.ipynb) and/or [“CPU” notebook](Colab%20CPU%20MPrime.ipynb), pasting them into one or more [new notebooks](http://colab.research.google.com/#create=true) in Colab. Then, uniquely name and save the notebook(s) (Ctrl + s). Then, on the far left, click “📁”, the “Mount Drive” folder button and select “Connect to Google Drive”. Your Drive storage should automatically remount each time you run the notebook(s). You may need to repeat this last part after a while. See the official [video](https://video.twimg.com/tweet_video/EQbtltjVAAA2qTs.mp4) for a walkthrough.
Alternative Method Open “GPU and CPU” notebook: GPU-CPU-Notebook and/or the “CPU” only notebook: CPU-Notebook in Colab. Then, uniquely name and save a copy to your Drive (Ctrl + s) to avoid a warning each time you run the notebook. *WARNINGS*: This method will continually require an authorization step each time you run the notebook(s). After step 4 below, follow the link Google provides to authorize the login to your Drive and copy-and-paste the authorization string into the textbox Google provides within the notebook's output box.
-2. **If Running the GPU** notebook, you must enable the GPU runtime. On the upper left, click “Runtime” → “Change runtime type”, under “Hardware accelerator” select “GPU” and click “SAVE”. +2. **If Running the GPU** notebook, you must enable the GPU runtime. On the upper left, click “Runtime” → “Change runtime type”, under “Hardware accelerator” select one of the GPUs and then click “Save”. 3. Leave the default options to run anonymously. Alternatively, fill in your GIMPS/PrimeNet account user ID and set any other desired options. Each instance of a notebook type needs to have a unique `computer_number` value. Note that the PRP worktypes can use several GiB of your Drive storage. Every lower value will halve Drive storage requirements for PRP tests, but double the certification cost. Set the highest `prp_proof_power` value that you have available Drive storage for (see below for the space needed for several proof powers and exponents). @@ -34,7 +31,7 @@ A user may optionally perform other steps to gain more insight into GIMPS and/or 1. Create a GIMPS/PrimeNet account [here](https://www.mersenne.org/update/) and [join](https://www.mersenne.org/jteam/) the “Portland State University” team! -2. Set the `debug` option to view the last 100 lines of output and the status from the respective GIMPS program. Alternatively, you may access the `cpu1.out`…`cpuN.out`, `1/gpu.out`…`N/gpu.out`, and `1/primenet.out`…`N/primenet.out` files, where `N` is the `computer_number` value, in your Google Drive under the `GIMPS` and `mprime_gpu`/`mprime_cpu` or `gpuowl` folders to see the full Prime95 and/or GpuOwl output respectively. +2. Set the `debug` option to view the last 100 lines of output and the status from the respective GIMPS program. Alternatively, you may access the `cpu1.out`…`cpuN.out`, `1/gpu.out`…`N/gpu.out`, and `1/primenet.out`…`N/primenet.out` files, where `N` is the `computer_number` value, in your Google Drive under the `GIMPS` and `mprime_gpu`/`mprime_cpu` or `gpuowl` folders to see the full MPrime and/or GpuOwl output respectively. ## Required Tools, Restrictions Anyone with an internet connection and a free Google/Gmail account with just [~50 MiB of free space](https://www.google.com/settings/storage) on Google Drive can use both our notebooks to “crunch” primes. @@ -83,7 +80,7 @@ Proof Power | Proof Power Multiplier | Certification Cost | Exp 50M | Exp 100M | \- | 2 | 1⁄4096 | 143 | 286.1 | 429.1 | 572.2 | 715.2 | 858.3 | 950.4 | 2861 12 | 1 | 1⁄4096 | 77.48 | 154.9 | 232.4 | 309.9 | 387.4 | 464.9 | 514.8 | 1549 -*Italic* - Prime95 default proof power and multiplier, uses a maximum of 6 GB (5.587 GiB) per exponent\ +*Italic* - Prime95/MPrime default proof power and multiplier, uses a maximum of 6 GiB per exponent\ **Bold** - Optimal proof power, 9 for exponents above 26.6M, 10 above 106.5M and 11 above 414.2M\ † GpuOwl default proof power, uses 8 or 9 for all exponents depending on version diff --git a/gpuowl-wrapper.sh b/gpuowl-wrapper.sh index e1896a6..3b085bb 100644 --- a/gpuowl-wrapper.sh +++ b/gpuowl-wrapper.sh @@ -283,7 +283,7 @@ while true; do fi args+=(-proof "$proof_power") fi - echo -e "with GpuOwl $(<${!dir}/version.inc).\n" + echo -e "with GpuOwl $(<"$(if [[ -d ${!dir}/src ]]; then echo ${!dir}/src/version.inc; else echo ${!dir}/version.inc; fi)").\n" gpuowl=(nice "./${!dir}/gpuowl" "${args[@]}") if [[ -z $RESTART ]]; then exec "${gpuowl[@]}" diff --git a/mlucas.sh b/mlucas.sh index df1312f..dac9b62 100644 --- a/mlucas.sh +++ b/mlucas.sh @@ -68,7 +68,7 @@ TIME=$(echo "$TIME" | awk '{ printf "%g", $1 * 60 }') # Adapted from: https://github.com/tdulcet/Linux-System-Information/blob/master/info.sh . /etc/os-release -echo -e "\nLinux Distribution:\t\t${PRETTY_NAME:-$ID-$VERSION_ID}" +echo -e "\nLinux Distribution:\t\t${PRETTY_NAME:-$NAME-$VERSION}" KERNEL=$(= Python3.6") -assert sys.version_info >= (3, 6) - try: import requests except ImportError: @@ -72,15 +69,15 @@ def sha256sum(filename): # ----------------------------# # ---Downloading/Directory Ops---# -misc_check(os.path.exists(DIR), "Error: Prime95 is already downloaded") -print("Making directory to house contents of Prime95") +misc_check(os.path.exists(DIR), "Error: MPrime is already downloaded") +print("Making directory to house contents of MPrime") os.mkdir(DIR) misc_check(not os.path.exists(DIR), f"Error: Failed to create directory: {DIR}") os.chdir(DIR) DIR = os.getcwd() -print("\nDownloading Prime95\n") +print("\nDownloading MPrime\n") with requests.get(f"https://www.mersenne.org/download/software/v30/30.19/{FILE}", stream=True) as r: r.raise_for_status() with open(FILE, "wb") as f: @@ -100,12 +97,12 @@ def sha256sum(filename): # ---Configuration---# -print("Setting up Prime95.") +print("Setting up MPrime.") subprocess.check_call([sys.executable, "../exp.py", USERID, COMPUTER, TYPE]) # ---------------------------------------# # ---Starting Program---# -print("Starting up Prime95.") +print("Starting up MPrime.") subprocess.Popen(["./mprime"]) # daemon process with open("mprime.sh", "w", encoding="utf-8") as f: diff --git a/mprime.sh b/mprime.sh index cab6be9..25ae042 100644 --- a/mprime.sh +++ b/mprime.sh @@ -39,7 +39,7 @@ else wget -qO - https://raw.github.com/tdulcet/Distributed-Computing-Scripts/master/idletime.sh | bash -s fi if [[ -d $DIR ]]; then - echo "Error: Prime95 is already downloaded" >&2 + echo "Error: MPrime is already downloaded" >&2 exit 1 fi if ! command -v expect >/dev/null; then @@ -70,7 +70,7 @@ if ! mkdir "$DIR"; then fi cd "$DIR" DIR=$PWD -echo -e "Downloading Prime95\n" +echo -e "Downloading MPrime\n" wget https://www.mersenne.org/download/software/v30/30.19/$FILE if [[ "$(sha256sum $FILE | head -c 64)" != "$SUM" ]]; then echo "Error: sha256sum does not match" >&2 @@ -80,9 +80,9 @@ if [[ "$(sha256sum $FILE | head -c 64)" != "$SUM" ]]; then fi echo -e "\nDecompressing the files\n" tar -xzvf $FILE -echo -e "\nOptimizing Prime95 for your computer\nThis may take a while…\n" +echo -e "\nOptimizing MPrime for your computer\nThis may take a while…\n" ./mprime -b -echo -e "\nSetting up Prime95\n" +echo -e "\nSetting up MPrime\n" if [[ -e ../mprime.exp ]]; then cp ../mprime.exp . else @@ -90,7 +90,7 @@ else fi sed -i '/^expect {/a \\t"stage 2 memory in GiB (*):" { sleep 1; send -- "'"$(echo "$TOTAL_PHYSICAL_MEM" | awk '{ printf "%g", ($1 * 0.8) / 1024 / 1024 }')"'\\r"; exp_continue }' mprime.exp expect mprime.exp -- "$USERID" "$COMPUTER" "$TYPE" -echo -e "\nStarting Prime95\n" +echo -e "\nStarting MPrime\n" nohup ./mprime -d >>"mprime.out" & #crontab -l | { cat; echo "@reboot cd ${DIR@Q} && nohup ./mprime -d >> 'mprime.out' &"; } | crontab - cat <mprime.sh diff --git a/mprime2.sh b/mprime2.sh index 00d03bc..9224c73 100644 --- a/mprime2.sh +++ b/mprime2.sh @@ -60,7 +60,7 @@ TOTAL_PHYSICAL_MEM=$(echo "$MEMINFO" | awk '/^MemTotal:/ { print $2 }') echo -e "Total memory (RAM):\t\t$(printf "%'d" $((TOTAL_PHYSICAL_MEM >> 10))) MiB ($(printf "%'d" $((((TOTAL_PHYSICAL_MEM << 10) / 1000) / 1000))) MB)\n" if [[ -d $DIR && -x "$DIR/mprime" ]]; then - echo -e "Prime95 is already downloaded\n" + echo -e "MPrime is already downloaded\n" cd "$DIR" DIR=$PWD else @@ -77,7 +77,7 @@ else fi cd "$DIR" DIR=$PWD - echo -e "Downloading Prime95\n" + echo -e "Downloading MPrime\n" wget https://www.mersenne.org/download/software/v30/30.19/$FILE if [[ "$(sha256sum $FILE | head -c 64)" != "$SUM" ]]; then echo "Error: sha256sum does not match" >&2 @@ -88,9 +88,9 @@ else echo -e "\nDecompressing the files\n" tar -xzvf $FILE fi -echo -e "\nOptimizing Prime95 for your computer\nThis may take a while…\n" +echo -e "\nOptimizing MPrime for your computer\nThis may take a while…\n" ./mprime -A"$N" -b -echo -e "\nSetting up Prime95\n" +echo -e "\nSetting up MPrime\n" if [[ -e ../mprime2.exp ]]; then cp ../mprime2.exp . else @@ -98,7 +98,7 @@ else fi sed -i '/^expect {/a \\t"stage 2 memory in GiB (*):" { sleep 1; send -- "'"$(echo "$TOTAL_PHYSICAL_MEM" | awk '{ printf "%g", ($1 * 0.8) / 1024 / 1024 }')"'\\r"; exp_continue }' mprime2.exp expect mprime2.exp -- "$USERID" "$COMPUTER" "$TYPE" "$N" -echo -e "\nStarting Prime95\n" +echo -e "\nStarting MPrime\n" nohup ./mprime -A"$N" -d >>"mprime$N.out" & #crontab -l | { cat; echo "@reboot cd ${DIR@Q} && nohup ./mprime -A$N -d >> 'mprime$N.out' &"; } | crontab - cat <mprime.sh