iaroslav-ai opened a new issue #14721: Random number generator seed setting does not always work for `mxnet.ndarray.linalg.potrf` URL: https://github.com/apache/incubator-mxnet/issues/14721 ## Description Output of the function `mxnet.nd.linalg.potrf` is not deterministic for some inputs, with `mxnet` and `numpy` random number generator seeds set to a fixed value. ## Environment info (Required) ``` ----------Python Info---------- Version : 3.6.8 Compiler : GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57) Build : ('v3.6.8:3c6b436a57', 'Dec 24 2018 02:04:31') Arch : ('64bit', '') ------------Pip Info----------- Version : 18.1 Directory : /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip ----------MXNet Info----------- Version : 1.4.0 Directory : /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mxnet Commit Hash : a03d59ed867ba334d78d61246a1090cd1868f5da ----------System Info---------- Platform : Darwin-16.7.0-x86_64-i386-64bit system : Darwin node : 88e9fe657230.ant.amazon.com release : 16.7.0 version : Darwin Kernel Version 16.7.0: Wed Feb 27 00:29:57 PST 2019; root:xnu-3789.73.43~1/RELEASE_X86_64 ----------Hardware Info---------- machine : x86_64 processor : i386 b'machdep.cpu.extfeatures: SYSCALL XD 1GBPAGE EM64T LAHF LZCNT PREFETCHW RDTSCP TSCI' b'machdep.cpu.leaf7_features: SMEP ERMS RDWRFSGS TSC_THREAD_OFFSET BMI1 HLE AVX2 BMI2 INVPCID RTM SMAP RDSEED ADX IPT SGX FPU_CSDS MPX CLFSOPT' b'machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX SMX EST TM2 SSSE3 FMA CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC MOVBE POPCNT AES PCID XSAVE OSXSAVE SEGLIM64 TSCTMR AVX1.0 RDRAND F16C' b'machdep.cpu.brand_string: Intel(R) Core(TM) i7-7660U CPU @ 2.50GHz' ----------Network Test---------- Setting timeout: 10 Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0566 sec, LOAD: 1.2177 sec. Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.0773 sec, LOAD: 1.0474 sec. Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.0708 sec, LOAD: 0.9511 sec. Timing for FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.0632 sec, LOAD: 0.5497 sec. Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0457 sec, LOAD: 0.7540 sec. Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0480 sec, LOAD: 0.1564 sec ``` Package was installed with `pip3 install -U mxnet`. ## Minimum reproducible example The script below results in output of `potrf` which is slightly (~1e-15) different from call to call, despite fixed seed; This can be verified from print statements. This is also the case across different runs of python script, an example can be provided upon request. Such behavior has a butterfly effect on the rest of the code that uses this function. ```python import numpy as np from mxnet import nd import mxnet K = nd.load("K-1-1")[0] L_previous = None for i in range(100): np.random.seed(0) mxnet.random.seed(0) L = nd.linalg.potrf(K) if L_previous is not None: print("Result difference, should be 0:", nd.sum(nd.abs(L-L_previous))) L_previous = L ``` Example failing input: [K-1-1.zip](https://github.com/apache/incubator-mxnet/files/3089902/K-1-1.zip) Such behavior does not seem to be the case for all inputs, but only for some. ## Steps to reproduce 1. Save example python script in a file. 2. Unzip example input K-1-1 to be in same folder as script 3. Execute the python script. ## What have you tried to solve it? 1. Setting random generator seeds for `numpy`, `mxnet` and `random` packages, did not help unfortunately.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
