|
25 | 25 | "# @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", |
26 | 26 | "# @markdown #### ℹ️ This notebook uses both our GpuOwl and MPrime [Bash install scripts](https://github.com/tdulcet/Distributed-Computing-Scripts#organizations) and [AutoPrimeNet](https://github.com/tdulcet/AutoPrimeNet).\n", |
27 | 27 | "# @markdown #### 📜 Please see the [documentation](https://github.com/tdulcet/Distributed-Computing-Scripts/tree/master/google-colab) for more information and to ❤️ support us.\n", |
28 | | - "# @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", |
| 28 | + "# @markdown #### 🤷 Optionally, create a [GIMPS/PrimeNet account](https://www.mersenne.org/update/).\n", |
29 | 29 | "\n", |
30 | 30 | "prime_ID = 'Default' # @param ['Default'] {allow-input: true}\n", |
31 | 31 | "computer_name = 'Default' # @param ['Default'] {allow-input: true}\n", |
32 | | - "GPU_type_of_work = '150 - First time PRP tests' # @param ['4 - P-1 factoring', '100 - First time LL tests', '101 - Double-check LL tests', '102 - World record LL tests', '104 - 100 million digit LL tests', '150 - First time PRP tests', '151 - Double-check PRP tests', '152 - World record PRP tests', '153 - 100 million digit PRP tests', '154 - First time PRP tests that need P-1 factoring', '155 - Double-check tests using PRP with proof']\n", |
| 32 | + "GPU_type_of_work = '150 - First time PRP tests' # @param ['4 - P-1 factoring', '100 - First time LL tests', '101 - Double-check LL tests', '102 - World record LL tests', '104 - 100 million digit LL tests', '106 - Double-check LL tests with zero shift count', '150 - First time PRP tests', '151 - Double-check PRP tests', '152 - World record PRP tests', '153 - 100 million digit PRP tests', '154 - First time PRP tests that need P-1 factoring', '155 - Double-check tests using PRP with proof']\n", |
33 | 33 | "GPU_prp_proof_power = '5' # @param ['4', '5', '6', '7', '8', '9', '10', '11', '12']\n", |
34 | 34 | "CPU_type_of_work = '150 - First time PRP tests' # @param ['0 - Whatever makes the most sense', '1 - Trial factoring to low limits', '2 - Trial factoring', '4 - P-1 factoring', '5 - ECM for first factors of Mersenne numbers', '6 - ECM on Fermat numbers', '8 - ECM on Mersenne cofactors', '100 - First time LL tests', '101 - Double-check LL tests', '102 - World record LL tests', '104 - 100 million digit LL tests', '150 - First time PRP tests', '151 - Double-check PRP tests', '152 - World record PRP tests', '153 - 100 million digit PRP tests', '154 - First time PRP tests that need P-1 factoring', '155 - Double-check tests using PRP with proof', '160 - First time PRP on Mersenne cofactors', '161 - Double-check PRP on Mersenne cofactors']\n", |
35 | 35 | "CPU_prp_proof_power = '5' # @param ['Default', '5', '6', '7', '8', '9', '10', '11', '12']\n", |
|
54 | 54 | "gpuowl_prp = 'Latest' # @param ['Latest', 'v7.2-112', 'v6']\n", |
55 | 55 | "gpuowl_ll = 'v6' # @param ['v6']\n", |
56 | 56 | "gpuowl_pm1 = 'v6' # @param ['Latest', 'v6']\n", |
57 | | - "local_time = 'Pacific' # @param ['Pacific', 'Mountain', 'Central', 'Eastern', 'Alaska', 'Hawaii']\n", |
| 57 | + "local_time = 'UTC' # @param ['UTC', 'Pacific', 'Mountain', 'Central', 'Eastern', 'Alaska', 'Hawaii']\n", |
58 | 58 | "debug = 'False' # @param ['False', 'GPU (GpuOwl)', 'CPU (MPrime)']\n", |
59 | 59 | "\n", |
60 | 60 | "# @markdown #### 🐛 The *debug* option outputs GPU (GpuOwl) or CPU (Prime95/MPrime) progress and status, then exits.\n", |
|
71 | 71 | " '''Run GpuOwl and MPrime.'''\n", |
72 | 72 | " print('\\nStarting AutoPrimeNet\\n')\n", |
73 | 73 | " adir = f'gpuowl/{computer_number}'\n", |
| 74 | + " work_file = f'{adir}/worktodo.ini'\n", |
| 75 | + " !rm -f '{work_file + '.lck'}'\n", |
74 | 76 | " !cd '{adir}'; nohup python3 -OO ../autoprimenet.py -T {GPU_type_of_work} >> autoprimenet.out &\n", |
75 | 77 | " !sleep 1\n", |
76 | | - " while not os.path.exists(f'{adir}/worktodo.ini'):\n", |
77 | | - " print(\"Waiting for 'worktodo.ini' access...\")\n", |
| 78 | + " while not os.path.exists(work_file):\n", |
| 79 | + " print('Waiting for {work_file!r} access...')\n", |
78 | 80 | " !sleep 1\n", |
79 | 81 | "\n", |
80 | 82 | " os.chmod('mprime_gpu/mprime', 0o777)\n", |
|
94 | 96 | " !cd mprime_gpu; nohup ./mprime -A{computer_number} -d >> '{'cpu' + computer_number + '.out'}' &\n", |
95 | 97 | " print('\\nStarting GpuOwl\\n')\n", |
96 | 98 | " !cd '{adir}'; nohup stdbuf -oL ./gpuowl > gpu.out &\n", |
97 | | - " ![[ -e '{adir + '/gpuowl.log'}' ]] && tail '{adir + '/gpuowl.log'}'\n", |
| 99 | + " if os.path.exists(f'{adir}/gpuowl.log'):\n", |
| 100 | + " !tail '{adir + '/gpuowl.log'}'\n", |
98 | 101 | " !tail -f '{'mprime_gpu/cpu' + computer_number + '.out'}' '{adir + '/autoprimenet.out'}' '{adir + '/gpu.out'}'\n", |
99 | 102 | " elif output_type.startswith('GPU'):\n", |
100 | 103 | " print('\\nStarting MPrime\\n')\n", |
101 | 104 | " !cd mprime_gpu; nohup ./mprime -A{computer_number} -d >> '{'cpu' + computer_number + '.out'}' &\n", |
102 | 105 | " print('\\nStarting GpuOwl\\n')\n", |
103 | 106 | " !cd '{adir}'; nohup stdbuf -oL ./gpuowl > gpu.out &\n", |
104 | | - " ![[ -e '{adir + '/gpuowl.log'}' ]] && tail '{adir + '/gpuowl.log'}'\n", |
| 107 | + " if os.path.exists(f'{adir}/gpuowl.log'):\n", |
| 108 | + " !tail '{adir + '/gpuowl.log'}'\n", |
105 | 109 | " !cd '{adir}' && tail -f autoprimenet.out gpu.out\n", |
106 | 110 | " elif output_type.startswith('CPU'):\n", |
107 | 111 | " print('\\nStarting GpuOwl\\n')\n", |
|
157 | 161 | "\n", |
158 | 162 | "def debug_exit():\n", |
159 | 163 | " '''Output GPU and output of MPrime or GpuOwl output.'''\n", |
160 | | - " if debug.startswith('GPU') and os.path.exists(f'gpuowl/{computer_number}/gpu.out'):\n", |
| 164 | + " adir = f'gpuowl/{computer_number}'\n", |
| 165 | + " if debug.startswith('GPU') and os.path.exists(f'{adir}/gpu.out'):\n", |
161 | 166 | " print(f'\\nOutput for computer number {computer_number}:\\n')\n", |
162 | 167 | " print('\\nAutoPrimeNet output:\\n')\n", |
163 | | - " !tail -n 100 '{'gpuowl/' + computer_number + '/autoprimenet.out'}' # view AutoPrimeNet output\n", |
| 168 | + " !tail -n 100 '{adir + '/autoprimenet.out'}' # view AutoPrimeNet output\n", |
164 | 169 | " print('\\nGPU (GpuOwl) output: ')\n", |
165 | | - " !tail -n 100 '{'gpuowl/' + computer_number + '/gpu.out'}' # view GpuOwl progress\n", |
166 | | - " !cd '{'gpuowl/' + computer_number}' && python3 -OO ../autoprimenet.py -s\n", |
| 170 | + " !tail -n 100 '{adir + '/gpu.out'}' # view GpuOwl progress\n", |
| 171 | + " !cd '{adir}' && python3 -OO ../autoprimenet.py -s\n", |
167 | 172 | " print()\n", |
168 | 173 | " elif debug.startswith('CPU') and os.path.exists(f'mprime_gpu/cpu{computer_number}.out'):\n", |
169 | 174 | " print('\\nCPU (MPrime) output:\\n')\n", |
|
213 | 218 | "load_drive()\n", |
214 | 219 | "\n", |
215 | 220 | "# set local time\n", |
216 | | - "!rm -f /etc/localtime\n", |
217 | | - "!ln -s {'/usr/share/zoneinfo/US/' + local_time} /etc/localtime\n", |
| 221 | + "if local_time != 'UTC':\n", |
| 222 | + " !rm -f /etc/localtime\n", |
| 223 | + " !ln -s {'/usr/share/zoneinfo/US/' + local_time} /etc/localtime\n", |
218 | 224 | "\n", |
219 | 225 | "# use/cleanup input from user\n", |
220 | 226 | "prime_ID = 'psu' if prime_ID.lower() == 'default' else prime_ID\n", |
|
0 commit comments