pi-apps icon indicating copy to clipboard operation
pi-apps copied to clipboard

Add GIMPS (Great Internet Mersenne Prime Search)

Open MrBrain295 opened this issue 2 years ago • 40 comments

What is the name of the app?

GIMPS (Great Internet Mersenne Prime Search)

(Optional) Where is the app hosted?

https://www.mersenne.org/

About the app

It searches for large prime numbers. At one point I got it to run on the PI4, it was slow but it worked.

Confirmations

  • [X] I have confirmed that this app is legal and not piracy.
  • [X] I have confirmed that this app has never been discussed in https://github.com/Botspot/pi-apps/issues and https://github.com/Botspot/pi-apps/pulls, and it is not in the Pi Apps app list.
  • [X] I have confirmed that this app can run on Raspberry Pi.

MrBrain295 avatar Apr 15 '22 13:04 MrBrain295

Their [GIMPS's] Linux (32) build works for me on armhf.. This would probably be pretty easy to make a script for.

Crilum avatar Apr 15 '22 19:04 Crilum

Here's some output:


[Comm thread Apr 15 19:41] == Info: Connection #0 to host v5.mersenne.org left intact
[Comm thread Apr 15 19:41] RESPONSE:
[Comm thread Apr 15 19:41] pnErrorResult=0
[Comm thread Apr 15 19:41] pnErrorDetail=SUCCESS
[Comm thread Apr 15 19:41] ==END==
[Comm thread Apr 15 19:41] 
[Comm thread Apr 15 19:41] Done communicating with server.
[Work thread Apr 15 19:41] M664597 curve 1 stage 1 at prime 337 [0.13%]. Time: 16.267 sec.
[Work thread Apr 15 19:41] M664597 curve 1 stage 1 at prime 877 [0.35%]. Time: 14.393 sec.
[Work thread Apr 15 19:41] M664597 curve 1 stage 1 at prime 1571 [0.62%]. Time: 16.484 sec.
[Work thread Apr 15 19:42] M664597 curve 1 stage 1 at prime 2281 [0.91%]. Time: 29.011 sec.
[Work thread Apr 15 19:42] M664597 curve 1 stage 1 at prime 2957 [1.18%]. Time: 16.613 sec.
[Work thread Apr 15 19:43] M664597 curve 1 stage 1 at prime 3659 [1.46%]. Time: 17.600 sec.
[Work thread Apr 15 19:43] M664597 curve 1 stage 1 at prime 4349 [1.73%]. Time: 16.411 sec.
[Work thread Apr 15 19:43] M664597 curve 1 stage 1 at prime 5039 [2.01%]. Time: 19.643 sec.
[Work thread Apr 15 19:43] M664597 curve 1 stage 1 at prime 5737 [2.29%]. Time: 14.547 sec.
[Work thread Apr 15 19:44] M664597 curve 1 stage 1 at prime 6389 [2.55%]. Time: 20.730 sec.
[Work thread Apr 15 19:44] M664597 curve 1 stage 1 at prime 7109 [2.84%]. Time: 17.938 sec.
[Work thread Apr 15 19:44] M664597 curve 1 stage 1 at prime 7817 [3.12%]. Time: 13.713 sec.
[Work thread Apr 15 19:45] M664597 curve 1 stage 1 at prime 8537 [3.41%]. Time: 15.510 sec.

Crilum avatar Apr 15 '22 19:04 Crilum

@Crilum are you working on the script or should I try to make a script for it?

MrBrain295 avatar Apr 18 '22 16:04 MrBrain295

@MrBrain295 Here you go:

~~GIMPS.zip~~ Don't use this, it will install x86 and x64 versions...

You might want to edit the description, it's not very descriptive..

Crilum avatar Apr 18 '22 18:04 Crilum

@Crilum I tried to run both install-64 and install-32 but the both gave me this error

install-32: 11: status_green: not found
install-32: 15: status: not found
install-32: 18: status_green: not found

. Edit: replacing status_green and status with echo works.

MrBrain295 avatar Apr 18 '22 23:04 MrBrain295

It says when I go to /usr/local/bin and run sudo ./mprime it says that /root/gimps/mprime dosen't exist.

MrBrain295 avatar Apr 18 '22 23:04 MrBrain295

@Crilum I got it to work but now it says ./mprime was marked as an executable but cannot be ran by the OS.

MrBrain295 avatar Apr 19 '22 00:04 MrBrain295

@MrBrain295

@Crilum I tried to run both install-64 and install-32 but the both gave me this error install-32: 11: status_green: not found install-32: 15: status: not found install-32: 18: status_green: not found . Edit: replacing status_green and status with echo works.

Did you import the app into Pi-Apps and install from there? status and status_green are Pi-Apps' functions.

It says when I go to /usr/local/bin and run sudo ./mprime it says that /root/gimps/mprime dosen't exist.

Don't run mprime as root. You should also just be able to run mprime without going into /usr/local/bin. /usr/local/bin/mprime is a symbolic link to $HOME/gimps/mprime with $HOME being your home dir, in my case /home/pi/. If you run it as root, I guess it thinks your home dir is /root/..

When I run as sudo, it works:

$ sudo mprime

Welcome to GIMPS, the hunt for huge prime numbers.  You will be asked a
few simple questions and then the program will contact the primenet server
to get some work for your computer.  Good luck!

Attention OVERCLOCKERS!!  Mprime has gained a reputation as a useful
stress testing tool for people that enjoy pushing their hardware to the
limit.  You are more than welcome to use this software for that purpose. 
Please select the stress testing choice below to avoid interfering with
the PrimeNet server.  Use the Options/Torture Test menu choice for your
stress tests.  Also, read the stress.txt file.

If you want to both join GIMPS and run stress tests, then Join GIMPS and
answer the questions.  After the server gets some work for you, stop
mprime, then run mprime -m and choose Options/Torture Test.

Join Gimps? (Y=Yes, N=Just stress testing) (Y):

Crilum avatar Apr 19 '22 15:04 Crilum

@Crilum I got it to work but now it says ./mprime was marked as an executable but cannot be ran by the OS.

Which install script did you use? (It sounds like you just ran one) install-32 is for 32 bit systems, install-64 is for 64 bit systems. If you use the App Importer in Pi-Apps Settings, you can import the app into Pi-Apps, and install from Pi-Apps, which should fix installing the wrong program arch, as well as the bash: status: command not found problem.

Crilum avatar Apr 19 '22 15:04 Crilum

@Crilum I followed your instructions but when I run sudo mprime it says:

/usr/local/bin/mprime: 1: Syntax error: "(" unexpected

.

MrBrain295 avatar Apr 19 '22 17:04 MrBrain295

What arch are you using? You can get it with this command: arch

Crilum avatar Apr 20 '22 01:04 Crilum

I am new to shell so I’m confused what an “arch” is. Is it the cpu architecture?

MrBrain295 avatar Apr 20 '22 02:04 MrBrain295

Yeah, sorry. arch is short for (cpu) architecture.

If you're on a RPi, you'll probably get something like this: armhf (32-bit):

$ arch
armv7l

or arm64 (64-bit):

$ arch
aarch64

Crilum avatar Apr 20 '22 02:04 Crilum

When I run arch it returns aarch64.

MrBrain295 avatar Apr 21 '22 14:04 MrBrain295

Ok, so if you've imported the app into Pi-Apps like this (or manually with the GUI (Graphical User Interface)):

~/pi-apps/etc/import-app https://github.com/Botspot/pi-apps/files/8507509/GIMPS.zip

Uninstall it (from Pi-Apps) and then install it again. Pi-Apps should install the right program architecture for you.

Can you also send the output of dpkg --print-architecture? (I assume you're on Debian, or a derivative, since you're using Pi-Apps..)

Crilum avatar Apr 21 '22 16:04 Crilum

I have installed it through pi apps and removed it through pi apps a few times already without success.

MrBrain295 avatar Apr 21 '22 16:04 MrBrain295

Same error that you posted above?

Crilum avatar Apr 21 '22 16:04 Crilum

yes

MrBrain295 avatar Apr 21 '22 16:04 MrBrain295

Can you post the output of dpkg --print-architecture?

Crilum avatar Apr 21 '22 16:04 Crilum

That command outputted arm64.

MrBrain295 avatar Apr 21 '22 21:04 MrBrain295

sorry for asking for so many commands, but can you also post the output of file $HOME/gimps/mprime? This gives us the type and arch of the exectable.

Crilum avatar Apr 21 '22 22:04 Crilum

ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=6d053e3f9b870f31508045b9f0af5a4c6c9d9a55, with debug_info, not stripped

MrBrain295 avatar Apr 21 '22 22:04 MrBrain295

Oh, I think I know what the problem is!! I have exagear installed, and I think it was just taking over, emulating an x86 system..

If you have box64 installed, try running it with that.

Crilum avatar Apr 21 '22 22:04 Crilum

It looks as though the program that's being downloaded is for x86.

MrBrain295 avatar Apr 21 '22 22:04 MrBrain295

Yep, it is.. See my above comment

Crilum avatar Apr 21 '22 22:04 Crilum

Someone will have to build it..

Crilum avatar Apr 21 '22 22:04 Crilum

Yeah sorry I commented but my internet was too slow and your comment appeared first.

MrBrain295 avatar Apr 21 '22 22:04 MrBrain295

With box64 installed it runs perfectly!!!

MrBrain295 avatar Apr 21 '22 22:04 MrBrain295

We can try building gimps, or we can just make the install scripts use box86 or box64 for running it. We should at least try building gimps first though...

Crilum avatar Apr 21 '22 23:04 Crilum

How should we go about building gimps?

MrBrain295 avatar Apr 21 '22 23:04 MrBrain295

They have building instructions on their website, I think...

I'm downloading the source now..

Crilum avatar Apr 21 '22 23:04 Crilum

Oh

MrBrain295 avatar Apr 21 '22 23:04 MrBrain295

This might be worth taking a look at...

Crilum avatar Apr 21 '22 23:04 Crilum

I think it would be better to add box64/box86 as a dependency so it doesn’t need to be recompiled whenever an update comes out and recompiling for 64 and 32 bit.

MrBrain295 avatar Apr 22 '22 02:04 MrBrain295

Ok, but:

  • Using Box86/64 will make the efficiency lower, because box86/64 is translating the x86/x64 program into arm code
  • We don't need to build it every time (unless we need it to be up to date all the time), we just need to build a couple debs, and then we can install the debs.

Crilum avatar Apr 22 '22 05:04 Crilum

Here is a version that uses box86/64: GIMPSv2.zip

Crilum avatar Apr 22 '22 17:04 Crilum

I probably won't be able to try building GIMPS today or tomorrow, so if you want to try it, go ahead!

Crilum avatar Apr 22 '22 17:04 Crilum

This might be worth taking a look at...

I suggested this before in the discord, yes this should be used. Prime95 (GIMPS) through box86/64 is the wrong way to go. You should be using the open source multiplatform version from that link. Unfortunately this isn't the same as prime95, there is no GUI to see progress and select settings, and the test takes hours to run by default

theofficialgman avatar May 03 '22 22:05 theofficialgman

What is the current status of this issue?

Botspot avatar May 19 '22 20:05 Botspot

I haven’t had the time to work on this but I will in about 2 weeks.

MrBrain295 avatar May 19 '22 23:05 MrBrain295