CPU random generator warning

Asked by whr

Dear all,

I'm trying to move my working environment to one with AMD cpu to take advantage of the AMD ThreadRipper. Before that, I made a test with Ryzen 3700x and the latest Ubuntu 20.04.

I'm installing the 2020.01a version. During configuring the compilation process, I get a warning :
WARNING: CPU random generator seem to be failing, disable hardware random number generation
WARNING: RDRND generated: 0xffffffff 0xffffffff 0xffffffff 0xffffffff

Ignoring this, I finished the installation successfully. I have run some tests involving makeCloud (considering some random number is involved). They works fine, although I can still get the same warning every time I open yade through terminal.

Google told me this is a known problem with Ryzen 3000-series CPU. I am working on a lenovo desktop and the problem is still there after I updated BIOS to the latest version. I am wandering, how much this problem will affect yade and how to get rid of this warning.

Thx,
Huanran

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
whr
Solved:
Last query:
Last reply:
Revision history for this message
whr (huanran-wu) said :
#1

I did more tests. I change seed in makeCloud and found out different seed produce the same set of particles.

Sad news. Seems I need to find a solution to this problem.

Thx,
Huanran

Revision history for this message
Robert Caulk (rcaulk) said :
#2

Yes, sadly this problem seems very far removed from Yade. I guess the problem would even occur without yade, so just start Python and generate a random number:

import numpy as np

rn = np.random.rand(3,1)

print(rn)

If it is the case, then really you should use that MWE right there and go to stack overflow.

Good luck.

Revision history for this message
Janek Kozicki (cosurgi) said :
#3

Uhh. We had a bug in makeCloud in which the seed was ignored. Before you get around to replacing your CPU , better to make sure that your version of yade had this bug fixed: https://gitlab.com/yade-dev/trunk/-/merge_requests/428

Revision history for this message
whr (huanran-wu) said :
#4

Thank you, Robert and Janek.

>Robert,
I tested Python, it's able to generate different random number with your suggested code.

I didn't know the bug in makeCloud then. I noticed somebody on Internet said AMD tested their CPU on ubuntu 18.04 so I reinstalled my OS to 18.04. Although the RDRND bug persist (tested with a code from https://arstechnica.com/gadgets/2019/10/how-a-months-old-amd-microcode-bug-destroyed-my-weekend/), I compiled yade-2020.01a without warning and it worked fine now, including makeCloud.

>Janek,
Thanks for the info. Since makeCloud in yade-2020.01a works fine in ubuntu 18.04, I assume it's not affected by the bug you mentioned and I cannot test a newer version of yade on ubuntu 20.04 now. BTW, based on my understanding of seed, if it's ignored makeCloud should generate different set of particles with same seed?

Yade works fine on my desktop now, but I'm not sure if it's a good idea to move to ThreadRipper now. ;)

Thanks,
Huanran

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#5

> if it's ignored makeCloud should generate different set of particles with same seed?

Yes but no. :)
If you check line 52 [1] you'll see that seed was not fully ignored, it was just always zero regardless of user input.
Defaulting to -1 really makes it random (i.e. hardware based) I think - can't find immediate confirmation in boost doc right now.
Bruno

[1] https://gitlab.com/yade-dev/trunk/-/merge_requests/428/diffs

Revision history for this message
Robert Caulk (rcaulk) said :
#6

This one of the reasons I am always hesitant to put AMD Ryzen chips into a workstation despite their apparent cost savings.

Revision history for this message
whr (huanran-wu) said :
#7

Just add a comment on the bug Janek mentioned.

I tested it and yade-2020.01a indeed has this bug. makeCloud generate different set of particle with same seed. The source code is the same as those before fixed in [1].

>If you check line 52 [1] you'll see that seed was not fully ignored, it was just always zero regardless of user input.

The bug is caused by line 128 in [1] where seed is ignored. Defaulting to -1 makes it random in case no seed is defined in the fixed version, am I right?

[1]https://gitlab.com/yade-dev/trunk/-/merge_requests/428/diffs