mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Mlucas (https://www.mersenneforum.org/forumdisplay.php?f=118)
-   -   "sched_setaffinity: Invalid argument"? (https://www.mersenneforum.org/showthread.php?t=27480)

leonardyan96 2022-01-10 12:45

"sched_setaffinity: Invalid argument"?
 
I'm trying to run Mlucas on a Huawei Matepad pro 10.5" 2021, with Harmony OS 2.0.0(runs Android apps but said to be not Android), Snapdragon 870 and 8GiB RAM. I'm using all 8 cores and running v20.1.1 (02 Dec 2021).
After compiling, when running selftests I saw a lot of information lines as I quoted in the title. It repeats several times (roughly from 6 times to 12, as I see it) for each radix-set. For example:
[CODE]
Using complex FFT radices ..............
sched_setaffinity: Invalid argument
sched_setaffinity: Invalid argument
mers_mod_square: Init threadpool of 8 threads
sched_setaffinity: Invalid argument
sched_setaffinity: Invalid argument
sched_setaffinity: Invalid argument
sched_setaffinity: Invalid argument
sched_setaffinity: Invalid argument
sched_setaffinity: Invalid argument
sched_setaffinity: Invalid argument
sched_setaffinity: Invalid argument
sched_setaffinity: Invalid argument
Using 8 threads in carry step
sched_setaffinity: Invalid argument
[/CODE]
After that it runs actual FFT and prints the results. For now the selftest hasn't completed but almost all radix-sets was successful. However I don't remember seeing these lines when testing with another Android device 2 months before (possibly using an earlier patch version of Mlucas). Also, actual pm1 running on that Android device doesn't produce such lines.

So does this mean anything usual or terrible?

leonardyan96 2022-01-10 12:53

These lines also appear when running single-threaded (omitting -cpu flags).

leonardyan96 2022-01-10 14:17

After some search I learned this is a function provided by the Linux environment. I tried the following command, it successfully finished and that message still appeared twice.
[CODE]./Mlucas -fft 192 -iters 100 -radset 0 -cpu 1[/CODE]

leonardyan96 2022-01-10 14:35

According to what I found with some more tests, when I specify any cpu cores other than 2 and 3 the error message will appear. When -cpu 2, -cpu 3 or -cpu 2:3 the screen output gets clean. It might be something weird with the OS or SoC, but doesn't stop the FFT from being correctly finished.

chris2be8 2022-01-10 16:34

What is in /proc/cpuinfo ? It sounds as if Linux thinks it only has CPUs 2 and 3.

ewmayer 2022-01-10 21:36

[QUOTE=chris2be8;597576]What is in /proc/cpuinfo ? It sounds as if Linux thinks it only has CPUs 2 and 3.[/QUOTE]

Echoed - some OSes do weird things with respect to physical and/or logical core numbering. An attempt to set a thread's affinity to a non-existent core (based on the OS' core numbering scheme, as captured in /proc/cpuinfo) will simply leave any thread affinity management to the OS, but obviously one would prefer to not get warning messages in one's runs.

leonardyan96 2022-01-10 23:27

[QUOTE=chris2be8;597576]What is in /proc/cpuinfo ? It sounds as if Linux thinks it only has CPUs 2 and 3.[/QUOTE]

IMO if there's only 2 cores shown in /proc/cpuinfo, Mlucas will report 2 cores too, instead of 8.

I'll check this later.

leonardyan96 2022-01-11 01:22

Selftest just finished. In mlucas.cfg the timings look bad, from 2000 to 7000 ms/iter. Seems that it failed to utilize all the cores.

leonardyan96 2022-01-11 01:33

[QUOTE=chris2be8;597576]What is in /proc/cpuinfo ? It sounds as if Linux thinks it only has CPUs 2 and 3.[/QUOTE]

CPU numbers in it looks normal, from 0 to 7.
I tried taskset yet doesn't work.

I'm going to give up, since I'm not able to root it or flash a custom ROM, and I'm not planning to run Mlucas on it for a long term. It's purchased only a few months ago.

leonardyan96 2022-01-11 02:46

Just did another test on my daily phone with Snapdragon 835. It has 8 cores, among which little cores are 0-3 and big cores are 4-7.
The little cores can all be safely specified without any warning. However those big cores look tricky. Sometimes it's 4 and 5 which work, sometimes 4 & 6, and sometimes 5 & 7. It seems unstable.
According to the timing, when I specify only 1 core and it warns "Invalid argument", the program seems to fall back to only one small core(cpu 0?). This is the slowest case.
I'm not sure if root or custom ROM works. Qualcomm chips are really a pain in the ass... :surrender

ewmayer 2022-01-11 19:07

[QUOTE=leonardyan96;597629]Just did another test on my daily phone with Snapdragon 835. It has 8 cores, among which little cores are 0-3 and big cores are 4-7.
The little cores can all be safely specified without any warning. However those big cores look tricky. Sometimes it's 4 and 5 which work, sometimes 4 & 6, and sometimes 5 & 7. It seems unstable.
According to the timing, when I specify only 1 core and it warns "Invalid argument", the program seems to fall back to only one small core(cpu 0?). This is the slowest case.
I'm not sure if root or custom ROM works. Qualcomm chips are really a pain in the ass... :surrender[/QUOTE]

Have you ever been able to run using '-cpu 0:7' without the invalid-argument warnings, or is 6 cores the maximum that has (sometimes) worked? It sounds like the OS is doing some kind of dynamic core binding/unbinding. Note that the pthread affinity-setting is formally a *hint* to the OS, whether it gets respected or not depends on the OS and the particuar device in question. Apple M1 is another such 4-big|4-little 8-core hybrid, but there cores 0-7 are always available. I suggest you try just using -cpu 0:3 and run self-tests (preferably with the phone mostly idle at the time and in some decent airflow), in hopes the OS will remap the process to mostly use the performance cores.


All times are UTC. The time now is 18:55.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.