View previous topic :: View next topic |
Author |
Message |
SarahS93 l33t
Joined: 21 Nov 2013 Posts: 693
|
Posted: Thu Jan 11, 2024 2:42 pm Post subject: how to create a file with random data - use all cpu cores |
|
|
Code: | time -p dd if=/dev/urandom of=urandom1gbfile bs=1G count=10
10+0 Datensätze ein
10+0 Datensätze aus
10737418240 Bytes (11 GB, 10 GiB) kopiert, 23,3878 s, 459 MB/s
real 24,17
user 0,00
sys 24,08 |
25 seconds for a 10gb random file.
the system has 8 core cpu. dd only use 1 core, 7 cores are unused.
is there a way to create it faster with all 8 cores together?
:edit
for a 16gb file with data from urandom with all 8 cores in use i try
Code: | for i in $(seq 1 8); do (head -c 2G </dev/urandom >>urandom16gbfile&); done |
it works
is there an other better way to do that? |
|
Back to top |
|
|
jpsollie Apprentice
Joined: 17 Aug 2013 Posts: 291
|
Posted: Fri Jan 12, 2024 11:22 am Post subject: |
|
|
I'm not really sure why you'd want that, but something you may try is using fallocate file1 as a 16gb file, then run all threads in parralel using something like dd if=/dev/urandom of=filexx seek=(core_nr * 2gb) to write everything _________________ The power of Gentoo optimization (not overclocked): [img]https://www.passmark.com/baselines/V10/images/503714802842.png[/img] |
|
Back to top |
|
|
mrbassie l33t
Joined: 31 May 2013 Posts: 786 Location: over here
|
Posted: Mon Jan 15, 2024 6:25 pm Post subject: |
|
|
Is this not a job for taskset? _________________ Bus conductors learned to code. |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 21750
|
Posted: Mon Jan 15, 2024 6:51 pm Post subject: |
|
|
If all the jobs are busy, the kernel should schedule them to otherwise-idle cores without user intervention to pick which core to use.
I concur with jpsollie that this does not seem useful, and I will add that this seems like another XY problem. An explanation of the true goal might let us offer a better solution. |
|
Back to top |
|
|
|