Bug 164609 - librecalc does not multithreading
Summary: librecalc does not multithreading
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
25.8.0.0 alpha0+
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Multithreading
  Show dependency treegraph
 
Reported: 2025-01-06 15:41 UTC by elias estatistics
Modified: 2025-01-07 13:58 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
Try to change in 1st sheet high energy to anything else. >10min, single core 100% (256.97 KB, image/png)
2025-01-06 15:41 UTC, elias estatistics
Details
saving document - cpu singlethreaded to 100% hop from thread to thread (286.50 KB, image/png)
2025-01-06 15:42 UTC, elias estatistics
Details

Note You need to log in before you can comment on or make changes to this bug.
Description elias estatistics 2025-01-06 15:41:42 UTC
Created attachment 198398 [details]
Try to change in 1st sheet high energy to anything else. >10min, single core 100%

Version: 24.8.3.2 (X86_64) / LibreOffice Community
Build ID: 480(Build:2)
CPU threads: 24; OS: Linux 6.12; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Debian package version: 4:24.8.3-3
Calc: threaded (yes, multithreded is activated from the menu.

ods sheet: https://file.io/RYFiIGrDQQ93 (until 20 jan2025)

----------------------------------------------------
Librecalc does not do real multithreading. 

Sheet description:
Yes, I have 3 intensive sheets. I characterize "Intensive sheets" that are not simple "IF" calcs", but include calculations on arrays. My sheets almost are full of INDEX(ARRAY, small(if(ARRAY=1, ROW(....)), row(....)). 

Therefore, aprroximately: such index(small(if)) calcs exist:
1st sheet) 90*1000  columns "data" sheet
2nd sheet) 350*1000 columns "prod_tbls" sheet
3rd sheet) 300*300  col*rows "tidt_tbl" sheet 
and transpose: 
4th sheet) 500*100  transpose "trnsp_tbl" sheet
"copy from here" - no intensive sheet (some simple ifs)

Note that all calculations are boxed into pink lines.Zoom out to find them.  
----------------------------------------------------
I did some experiments:
(1st attachment - replace,
2nd attachment saving)


a) Try to change in 1st sheet "high energy" to anything else with cntr+H. It takes >5min. ONLY 1 core is active each time to 100%, BUT the number of core that is going 100% is changing (some seconds can be the 1st, the 12th, the 5th whatever). 
This is NO multithreading - this is changing what core is going 100% each time.

b) Try to save the calc. It is taking more than 3-4 minutes. The game with cores is the same here too. No real multithreading.

For comparison, to compile from source pspp with "make" (single core) is taking >10minutes. when using make -j (multithreading), the job is finished less than 1-2min. 

----------------------------------------------------
My thoughts - i am not a programmer 

I can understand that is hard to parallelize calcs that the output of one is the input of the next one. All my calc formulas are SERIAL calcs. a->b->c->d etc. How one can put one calcs for the 1st thread and another to the 3rd thread while the output is unknown? 

a) cells alignments, colors, styles can be put on some threads eg. 1st,2nd, 3rd
b) When formula (is horizontal applied) is applied to an input of eg. 1000 rows, this can be broken eg. to 250+250+250+250 eg 4 independent threads.   
c) You can see in my sheets that while the formula is applied to 1000 rows, the real data occupying in 1st sheet (data) ~400 rows, 2nd sheet 60 rows. So, a lot of calculations can be saved, if it is predicted that will exists "null data". 

My case maybe is special, but i think intensive formulas maybe 90% of cases will be SERIAL formulas, either horizontally, or vertically. Mixed designs, or complex designs must be more rare i think. 

However, i think you may design all relevant scenarios and decide in each case how calcs can be broken down for multithreading. 

have a happy year!
----------------------------------------------------
Comment 1 elias estatistics 2025-01-06 15:42:38 UTC
Created attachment 198399 [details]
saving document - cpu singlethreaded to 100% hop from thread to thread
Comment 2 elias estatistics 2025-01-06 15:44:24 UTC
1st sheet) 90*1000  columns "data" sheet
2nd sheet) 350*1000 columns "prod_tbls" sheet
3rd sheet) 300*300  col*rows "tidt_tbl" sheet 

sorry for the error: 
all refer to columns*rows
Comment 3 elias estatistics 2025-01-06 15:45:15 UTC
sorry core=thread, i was confused
Comment 4 Piotr Osada 2025-01-06 16:40:43 UTC
Please attach comment 0 file here (https://file.io/RYFiIGrDQQ93 (until 20 jan2025)).
Comment 5 elias estatistics 2025-01-07 13:58:36 UTC
I dont know why the file was deleted. I cant upload it again in the same url.
I upload it to new urls here:
-https://filebin.net/i2rthdukmwf6v98y
-here (until 10th JAN2025): https://we.tl/t-73TaEMlnKV
-mydrive https://drive.google.com/file/d/1PtWaPs26ZQP_44javQzKxsiSxB_hh1Og/view?usp=drive_link