mersenneforum.org Pm1 stage 2 can't be done on my android phone
 Register FAQ Search Today's Posts Mark Forums Read

 2021-12-12, 12:08 #1 leonardyan96     "Arashi Chisato" May 2017 Northern China 458 Posts Pm1 stage 2 can't be done on my android phone I'm now running pm1 on my retired phone with 4GB ram, using userland as instructed. Mlucas says I only have 400+MB ram available so it won't perform stage 2, but my phone's multitasking screen says it still has more than 2GB of free ram which should be enough. Is this possibly because of android's memory management?
 2021-12-12, 12:12 #2 leonardyan96     "Arashi Chisato" May 2017 Northern China 37 Posts Also, mlucas reported the total amount of ram correctly (nearly 4GB), and said I only have 400+mb of FREE ram.
 2021-12-12, 22:26 #3 ewmayer ∂2ω=0     Sep 2002 República de California 13×29×31 Posts Android's memory-managment messes up Mlucas' stage 2 available-memory computation ... you can override it by forcing a specific (maximum) number of stage 2 buffers to be used, via the -pm1_s2_nbuf flag. (The stage 2 buffer-usage must be a multiple of 24 or 40, so the code picks whichever of those yields the largest count <= the one you specify.) If your multitasking screen shows 2GB, use that to figure out what value to supply to the aforementioned option - current-wavefront exponents needing a 6Mdoubles FFT need 48MB per buffer, so you should be able to use -pm1_s2_nbuf 40'. If that runs without any significant swapping occurring, you might be able to up it to 48, but there is very little efficiency gain for 48 vs 40, the next significant speedups to be had are at 72 and 80. Suggest you try one complete stage 2 run at 40, if that goes OK you could try getting more aggressive just to see what happens.
2021-12-21, 12:02   #4
leonardyan96

"Arashi Chisato"
May 2017
Northern China

37 Posts

Quote:
 Originally Posted by ewmayer Android's memory-managment messes up Mlucas' stage 2 available-memory computation ... you can override it by forcing a specific (maximum) number of stage 2 buffers to be used, via the -pm1_s2_nbuf flag. (The stage 2 buffer-usage must be a multiple of 24 or 40, so the code picks whichever of those yields the largest count <= the one you specify.) If your multitasking screen shows 2GB, use that to figure out what value to supply to the aforementioned option - current-wavefront exponents needing a 6Mdoubles FFT need 48MB per buffer, so you should be able to use -pm1_s2_nbuf 40'. If that runs without any significant swapping occurring, you might be able to up it to 48, but there is very little efficiency gain for 48 vs 40, the next significant speedups to be had are at 72 and 80. Suggest you try one complete stage 2 run at 40, if that goes OK you could try getting more aggressive just to see what happens.
I used 40 and stage 2 is now running as desired. Aida64 says there's only 600+MB free RAM and I'm satisfied with this. Then I made a bash alias for this.
Code:
alias docompute="~/Mlucas -cpu 0:7 -pm1_s2_nbuf 40"

Last fiddled with by leonardyan96 on 2021-12-21 at 12:04

2021-12-22, 03:57   #5
ewmayer
2ω=0

Sep 2002
República de California

266478 Posts

Quote:
 Originally Posted by leonardyan96 I used 40 and stage 2 is now running as desired. Aida64 says there's only 600+MB free RAM and I'm satisfied with this. Then I made a bash alias for this. Code: alias docompute="~/Mlucas -cpu 0:7 -pm1_s2_nbuf 40" Many thanks for your instruction.
Glad to hear it - what model phone is this, and how do your stage 2 per-iteration timings compare to the stage 1 ones?

 2021-12-23, 15:06 #6 leonardyan96     "Arashi Chisato" May 2017 Northern China 37 Posts It's a LAVA (an Indian brand) LE9820 featuring a MediaTek Helio P22 (MT6762V). I bought this second-hand phone for 450CNY (~70USD), then used it for half a year. Its build quality is so terrible that I can easily rip off its back cover. Stage 1 is nearly 200 ms/iter while stage 2 is about 230, with all 8 cores involved. I'm going to add an Essential Phone PH1 with Snapdragon 835.
2021-12-24, 06:47   #7
leonardyan96

"Arashi Chisato"
May 2017
Northern China

458 Posts

Quote:
 Originally Posted by ewmayer Glad to hear it - what model phone is this, and how do your stage 2 per-iteration timings compare to the stage 1 ones?
I learned you have used Galaxy S7s for Mlucas. These phones use Snapdragon 820 for North America version, so are they burning hot? I have used a 821. It gets extremely hot when I use some resource-demanding apps. 835 and later would be much better.

2021-12-24, 20:23   #8
ewmayer
2ω=0

Sep 2002
República de California

13×29×31 Posts

Quote:
 Originally Posted by leonardyan96 I learned you have used Galaxy S7s for Mlucas. These phones use Snapdragon 820 for North America version, so are they burning hot? I have used a 821. It gets extremely hot when I use some resource-demanding apps. 835 and later would be much better.
The S7s have a highly sophisticated internal cooling system, but still get hot running an FPU-heavy 24/7 application like Mlucas. I needed external cooling to keep the from auto-throttling, as in the pic on the Android-phone readme page with several phones in a USB charging stand and a USB fan blowing air over them. Was going to ask you what if anything you do by way of external cooling.

All my S7s save one are now retired (trying to flog them off on eBay for-parts) due to battery-swelling, which occurs under heavy loads like this - you'll want to keep an eye on that. The sole survivor only gets turned on occasionally to test new-code builds.

Last fiddled with by ewmayer on 2021-12-24 at 20:26

2021-12-25, 01:54   #9
leonardyan96

"Arashi Chisato"
May 2017
Northern China

37 Posts

Quote:
 Originally Posted by ewmayer Glad to hear it - what model phone is this, and how do your stage 2 per-iteration timings compare to the stage 1 ones?
It's a LAVA (an Indian brand) LE9820 featuring a MediaTek Helio P22 (MT6762V). I bought this second-hand phone for 450CNY (~70USD), then used it for half a year. Its build quality is so terrible that I can easily rip off its back cover.
Stage 1 is nearly 200 ms/iter while stage 2 is about 230, with all 8 cores involved.
I'm going to add an Essential Phone PH1 with Snapdragon 835.

(I'm posting again in case you didn't see that. Last time I didn't quote you since I'm not familiar with vBulletin.)

2021-12-25, 02:05   #10
leonardyan96

"Arashi Chisato"
May 2017
Northern China

37 Posts

Quote:
 Originally Posted by ewmayer The S7s have a highly sophisticated internal cooling system, but still get hot running an FPU-heavy 24/7 application like Mlucas. I needed external cooling to keep the from auto-throttling, as in the pic on the Android-phone readme page with several phones in a USB charging stand and a USB fan blowing air over them. Was going to ask you what if anything you do by way of external cooling. All my S7s save one are now retired (trying to flog them off on eBay for-parts) due to battery-swelling, which occurs under heavy loads like this - you'll want to keep an eye on that. The sole survivor only gets turned on occasionally to test new-code builds.
The SoC of mine doesn't seem to produce a lot of heat. There isn't any visible thermal throttling since all cores keep running in their highest freq when running Mlucas, and the back of my phone feels only a bit warm. Thus I don't use any external cooling.

Also I'm now trying -pm1_s2_nbuf 48 since the stage 2 timing looks good.

2021-12-25, 20:46   #11
ewmayer
2ω=0

Sep 2002
República de California

13×29×31 Posts

Quote:
 Originally Posted by leonardyan96 The SoC of mine doesn't seem to produce a lot of heat. There isn't any visible thermal throttling since all cores keep running in their highest freq when running Mlucas, and the back of my phone feels only a bit warm. Thus I don't use any external cooling. Also I'm now trying -pm1_s2_nbuf 48 since the stage 2 timing looks good.
Yes, I saw your first note re. your Indian phone's chipset - do you run it with the back cover off, or on? On the S7 the back cover is part of the cooling system, one of my S7s had a broken one, I stuck little Aluminum finned mini-heat-sinks on the chips to help with cooling.

Per the Interwebs, your phone's Helio P22 is 8x 2 GHz Cortex-A53 in a 12nm process, 5W TDP.

The S7's Snapdragon 820 is 4-core Armv8a, custom 14nm Kryo core rather than a Cortex, big.LITTLE with the 2 performance cores @1.6GHz and 2 efficiency cores @2.2GHz. TDP is 11W, so makes sense throttling would be more of an issue. Just ran a couple quick-tests @6M FFT on my remaining working (= battery still takes a charge) S7, a case-intact S7 Active with a siliconized sleeve over sides and back cover: './Mlucas -fft 6M -radset 192,16,32,32 -cpu 0:3 -iters 100|1000', with the phone resting on a closed-window sill, cool location but no airflow to speak of - you can see throttling beginning after less than a minute of 4-core runtime:

100-iter: 137ms
1000-iter: 156ms

I have lm-sensors installed on this device, 'sensors' dump a ton of output, but there are only 2 entries with a (crit = +145.0 C) field (the 145C seems high, but never got close to it), so I used 'sensors|grep crit' to monitor temps with the above 2 runs in background mode. 100-iters didn't even hit 50C, at 1000 things topped out at 56C. Not sure if that's an accurate reflection of the actual CPU hotspot temps, but OK as a relative measure.

Last fiddled with by ewmayer on 2021-12-25 at 20:49

 Similar Threads Thread Thread Starter Forum Replies Last Post jasong jasong 21 2019-07-14 11:58 wblipp Lounge 0 2014-09-09 18:42 D. B. Staple Factoring 2 2007-12-14 00:21 jasong GMP-ECM 9 2007-10-25 22:32 Matthias C. Noc PrimeNet 5 2004-08-25 15:42

All times are UTC. The time now is 11:12.

Sun Jan 16 11:12:15 UTC 2022 up 177 days, 5:41, 0 users, load averages: 0.95, 0.96, 0.90