You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 8, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 8, 2021. It is now read-only.
I added a new test project which can be used for testing results on different platforms.
If you want to test it on your platform:
Start the sandbox node sandbox.js
Run command ./Tevador.RandomJS.Test.exe --threads 2 --seed 123 --count 1000
The number of threads can be adjusted according to the number of cores of your processor. The command generates 1000 random programs and calculates a cumulative hash of all the outputs.
So far I have tested:
Intel Ivy Bridge, Windows x86_64
Intel Sandy Bridge, Ubuntu x86_64
AMD Ryzen, Ubuntu x86_64
Raspberry PI, Ubuntu armv7l
Intel Kaby Lake R, Windows x86_64
In all cases the result is 3cc26d6be7f5f542e8037247deec69c2e3a3d70db67dac5371f86e06fbe3c8cc.
We should test an x86 (32bit) platform (not that I'm expecting anyone to mine on such machine). Also more AMD CPUs (they can give different results for transcendental math functions).
I decided to remove all transcendental functions (exp, log, sin, cos, cbrt, atan) from the generator due to poor cross-platform compatibility (rounding is not enough).
With these functions enabled, the results don't match between Windows and Linux with the XS engine.
The reason why the results match for the V8 is because V8 has its own software implementation of all these functions using only IEEE-754 safe operations. We could copy this implementation to the XS, but I don't see the point in that because an ASIC could easily include a faster on-chip implementation.
The only function that stays is Math.sqrt which is portable and implemented in hardware in most CPUs.
For testing of floating point math compatibility, please use the following command:
@fuwa0529 b83a20eaa1d1615b860dd7477dc8945d23b84cd9082a7240df600b347410441c is the correct hash for that commit.
I have also tested the latest commit from the dev branch on Intel Kaby Lake (Windows), AMD Ryzen and Raspberry Pi 3 (Ubuntu) and all give the same results.
I think at this point we can conclude that reproducibility is not an issue.
I have also tested the latest commit from the dev branch on Intel Kaby Lake (Windows), AMD Ryzen and Raspberry Pi 3 (Ubuntu) and all give the same results.
I'm curious about performance numbers for all these processors. Can even Raspberry Pi 3 be used for mining?
Intel Kaby Lake R @~3.5 GHz (turbo) - 8 ms per program
Intel Sandy Bridge @ 3.7 GHz - 9.3 ms per program
Raspberry Pi 3 @ 1.2 GHz - 58 ms per program
So the Raspberry is about 6-7 times slower per core. It consumes ~5 W when mining with all 4 cores, but you need some kind of cooling solution because it will start thermal throttling quickly. The performance per watt seems to be comparable to the most efficient laptop processors, so it's definitely usable for mining.
So the Raspberry is about 6-7 times slower per core. It consumes ~5 W when mining with all 4 cores, but you need some kind of cooling solution because it will start thermal throttling quickly. The performance per watt seems to be comparable to the most efficient laptop processors, so it's definitely usable for mining.
Huh, and considering 40$ price it will be the most profitable option: 8x Raspberry Pi 3 will cost 320$ and will be faster than Kaby Lake. Future mining rigs will look like this: https://www.youtube.com/watch?v=i_r3z1jYHAc
@antanst We are no longer aiming for binary compatilibity with all JS engines. The XS engine will be used as reference and some results will not match with other engines. The most important thing is that results match across platforms with the same engine.
Nevertheless, you can try to find what causes the different outputs like this:
Use just one thread --threads 1 (this is needed to make sure programs are always processed in the same order).
Append --debug option to the command line. This will output the hashes of all programs.
Redirect the output to a file: mono Tevador.RandomJS.Test.exe ..... > output1.txt
Run the same command with the other engine and redirect to output2.txt.
Use diff output1.txt output2.txt to find which seeds produce different hashes. Seed is the value before colon :.
Run mono Tevador.RandomJS.exe *seed* > program.js to generate the exact program that causes the mismatch.
Then you can run node fast-eval.js < program.js to compare the outputs. You can also use diff to see which lines differ. From here it's quite easy to find the mathematical operation that causes the mismatch.
The fact that Rasberry PI is an efficient option should be a huge warning flag that this is not an ASIC resistant PoW. These numbers indicate that the additional complexity of Intel’s branch prediction, cache lookahead, etc is not worth the gates. An ASIC designer will be writing a very simple, small-gate CPU-type thing which runs direct execution from the generator algo with no parsing, interpretation, bytecode, object code, or anything else needed in general purpose CPU’s. An ASIC will put lots of slow but small cores into a chip, and the design will not take long because they can exclude all the fancy stuff Intel and AMD do. ARM cores are easily licensable and customizable for particular applications.
I’ve tried to say this in other ways in other threads, but these numbers back it up.
Specialized ARM core with proper core-to-cache ratio will be ~2 times more power efficient. I don't see a big problem with it. Many manufacturers can produce ARM cores because you said yourself they're easily licensable. This ARM-based hardware will be just like tuned Raspberry Pi, it can/will be used for other stuff apart mining.
2x is huge in mining. As we have seen, hashrate will increase to the point where it’s barely profitable vs electricity. A 2x ASIC means home mining on CPU is not profitable. Everyone will need the ASIC.
CPU mining is a different world. First, having just single CPU + motherboard + RAM + power supply is already very inefficient. Buying specialized ARM boards and connecting them to the same power bus will be the way to go: https://www.youtube.com/watch?v=i_r3z1jYHAc&t=284s
These ARM boards will be easy to buy like RPi now.
Activity
tevador commentedon Jun 3, 2018
@wowario Your first result was different. Any idea why?
jwinterm commentedon Jun 4, 2018
Tested with Intel(R) Core(TM) i5-6600K CPU @ 3.50GHz
Ubuntu 18.04 x86_64
commit 79d3c4c
Cumulative output hash: 3cc26d6be7f5f542e8037247deec69c2e3a3d70db67dac5371f86e06fbe3c8cc
tevador commentedon Jun 4, 2018
We should test an x86 (32bit) platform (not that I'm expecting anyone to mine on such machine). Also more AMD CPUs (they can give different results for transcendental math functions).
jwinterm commentedon Jun 4, 2018
I have a couple oldish AMD boxes around, don't think I have any x86s though. Will try to test on AMDs in next couple days.
jwinterm commentedon Jun 5, 2018
Tested on -
AMD Athlon(tm) II X2 220 Processor
Ubuntu 16.04 x86_64
commit: 8923b3b
got:
Cumulative output hash: 3cc26d6be7f5f542e8037247deec69c2e3a3d70db67dac5371f86e06fbe3c8cc
bomb-on commentedon Jun 5, 2018
Tested on:
OS X 10.13.5
Intel Core i5 2.7GHz
commit: 8923b3b
Results:
tevador commentedon Jun 7, 2018
Note that as of commit d32fd77, the cumulative hash is different because the generator has been slightly modified.
The new hash is:
If you do
git pull, you have to manually update yourProgramOptions.xml(copy from src/Tevador.RandomJS/ProgramOptions.xml to bin).tevador commentedon Jun 20, 2018
I decided to remove all transcendental functions (exp, log, sin, cos, cbrt, atan) from the generator due to poor cross-platform compatibility (rounding is not enough).
With these functions enabled, the results don't match between Windows and Linux with the XS engine.
The reason why the results match for the V8 is because V8 has its own software implementation of all these functions using only IEEE-754 safe operations. We could copy this implementation to the XS, but I don't see the point in that because an ASIC could easily include a faster on-chip implementation.
The only function that stays is
Math.sqrtwhich is portable and implemented in hardware in most CPUs.For testing of floating point math compatibility, please use the following command:
It generates programs with only math expressions and doesn't depend on
ProgramOptions.xml.Output with commit e136756 should be:
It is now possible to also test with the XS engine. You have to clone and compile it from here: https://github.com/tevador/moddable
To use this engine, append the following command line option:
--runnerUri file://PATH-TO-XST-EXECUTABLE, for example:For the NodeJS sandbox, you can use (it's the default option):
tevador commentedon Jun 23, 2018
@fuwa0529
b83a20eaa1d1615b860dd7477dc8945d23b84cd9082a7240df600b347410441cis the correct hash for that commit.I have also tested the latest commit from the dev branch on Intel Kaby Lake (Windows), AMD Ryzen and Raspberry Pi 3 (Ubuntu) and all give the same results.
I think at this point we can conclude that reproducibility is not an issue.
SChernykh commentedon Jun 28, 2018
I'm curious about performance numbers for all these processors. Can even Raspberry Pi 3 be used for mining?
bomb-on commentedon Jun 28, 2018
Tested on:
OS X 10.13.5
Intel Core i5 2.7GHz
commit: e136756
Results:
tevador commentedon Jun 28, 2018
@SChernykh
Commit 4fc608c, 1 core, XS engine:
8 msper program9.3 msper program58 msper programSo the Raspberry is about 6-7 times slower per core. It consumes ~5 W when mining with all 4 cores, but you need some kind of cooling solution because it will start thermal throttling quickly. The performance per watt seems to be comparable to the most efficient laptop processors, so it's definitely usable for mining.
jwinterm commentedon Jul 1, 2018
OK, tested again with:
AMD Athlon(tm) II X2 220 Processor
Ubuntu 16.04 x86_64
commit: e136756
Got the same result as others using the options suggested:
SChernykh commentedon Jul 1, 2018
Huh, and considering 40$ price it will be the most profitable option: 8x Raspberry Pi 3 will cost 320$ and will be faster than Kaby Lake. Future mining rigs will look like this: https://www.youtube.com/watch?v=i_r3z1jYHAc
stoffu commentedon Jul 2, 2018
antanst commentedon Jul 6, 2018
antanst commentedon Jul 7, 2018
Also tested with Node-Chakracore v10.1.0 official release binaries. Same system as previous post. Results are different.
tevador commentedon Jul 7, 2018
@antanst We are no longer aiming for binary compatilibity with all JS engines. The XS engine will be used as reference and some results will not match with other engines. The most important thing is that results match across platforms with the same engine.
Nevertheless, you can try to find what causes the different outputs like this:
--threads 1(this is needed to make sure programs are always processed in the same order).--debugoption to the command line. This will output the hashes of all programs.mono Tevador.RandomJS.Test.exe ..... > output1.txtoutput2.txt.diff output1.txt output2.txtto find which seeds produce different hashes. Seed is the value before colon:.mono Tevador.RandomJS.exe *seed* > program.jsto generate the exact program that causes the mismatch.node fast-eval.js < program.jsto compare the outputs. You can also usediffto see which lines differ. From here it's quite easy to find the mathematical operation that causes the mismatch.antanst commentedon Jul 7, 2018
Ok. Apologies for spamming the thread. Since you asked, I've followed your steps and traced the difference to this code output:
Code:
Outputs of vanilla Node 8 and 10:
Output of Chackra Node v10:
Looks like a vanilla Node bug.
tevador commentedon Jul 7, 2018
Interesting find. To me it looks like Chackra Node v10 bug, because the anonymous function doesn't have name
g(should be empty).JohannesLau commentedon Jul 7, 2018
Ryzen 1700x
Windows 10.0.17134 Build 17134
C:\Users\Johannes\Downloads\RandomJS-master\RandomJS-master\src\Tevador.RandomJS.Test\bin\Debug>Tevador.RandomJS.Test.exe --count 1000 --seed 123 --threads 2 --customOptions --XML_AssignmentOperators_Add 1 --XML_AssignmentOperators_Sub 1 --XML_AssignmentOperators_Mul 1 --XML_AssignmentOperators_Div 1 --XML_AssignmentOperators_Mod 1 --XML_AssignmentOperators_PreInc 1 --XML_AssignmentOperators_PostDec 1 --XML_AssignmentOperators_PreDec 1 --XML_AssignmentOperators_PostInc 1 --XML_UnaryOperators_Sqrt 1 --XML_BinaryOperators_Add 1 --XML_BinaryOperators_Sub 1 --XML_BinaryOperators_Mul 1 --XML_BinaryOperators_Div 1 --XML_BinaryOperators_Mod 1 --XML_Literals_Numeric 1 --XML_NumericLiterals_DecimalInteger 3 --XML_NumericLiterals_BinaryInteger 1 --XML_NumericLiterals_OctalInteger 3 --XML_NumericLiterals_SmallInteger 3 --XML_NumericLiterals_HexInteger 3 --XML_NumericLiterals_FixedFloat 3 --XML_NumericLiterals_ExpFloat 3 --XML_Expressions_AssignmentExpression 4 --XML_Expressions_BinaryExpression 5 --XML_Expressions_Literal 2 --XML_Expressions_UnaryExpression 5 --XML_Statements_AssignmentStatement 1 --XML_AssignmentInForLoop_Add 1 --XML_GlobalVariablesCountRange_Min 100 --XML_GlobalVariablesCountRange_Span 0 --XML_VariableInitializerDepth 4 --XML_MaxExpressionDepth 4 --XML_ConstVariableChance 0.1 --XML_MaxStringLengthRange_Min 35 --XML_MaxStringLengthRange_Span 0 Collecting statistics from 1000 random program executions (seed = 123) 5 %, 10 %, 15 %, 20 %, 25 %, 30 %, 35 %, 40 %, 45 %, 50 %, 55 %, 60 %, 65 %, 70 %, 75 %, 80 %, 85 %, 90 %, 95 %, Completed in 5.3005916 seconds Longest runtimes: Seed = 6eda4048d38469bb1a003a1fa77905ef394e57eb23d030b2e417440382adb38b, Runtime = 0.02108 s Seed = 1a1badef09d9f7ac65a6c798369b9afdb3bac23de7f7cbd98c532340d27c834f, Runtime = 0.02046 s Seed = 46509a1b7306a0929fbfed991ac472499a5fb1c569d4e3ced8863c23eee61eb2, Runtime = 0.02037 s Seed = e635da2a2215b8a98377d1057b9fa17fcfe7238a9de3722a59d80e8bf16aac8f, Runtime = 0.02011 s Seed = f525016ba483981a4faf26f2892f0033c0ca2bb4d1929eabc90aadbd021c9ed1, Runtime = 0.01887 s Seed = 8416a772f22270ab74c50934ca568d1cafed1fafe35d542494633c713ca1bb2a, Runtime = 0.01855 s Seed = 5b58f2d9d91e0638bbb522be955e3700decb7f281736329c0c76cc0a329718a8, Runtime = 0.01846 s Seed = f69690e35ed0063aac349ac68fccceeb0d9937e1cc6ea29e089823b2bbd4c9f2, Runtime = 0.01839 s Seed = 787102c377b98a079e9e522cd453f233fc8919fee7b512e5f1a2863b5701c492, Runtime = 0.01740 s Seed = dedc8ea24911abbed6e14398ad677fda754f679815e894bda3cdc5935d26841e, Runtime = 0.00834 s Runtime [s] Min: 0.00245; Max: 0.02108; Avg: 0.00408; Stdev: 0.00186; Runtime [s] 99.99th percentile: 0.0210800130000735 Average entropy of program output (est.): 6739.48 bits Cyclomatic complexity Min: 0; Max: 0; Avg: 0; Stdev: 0; Lines of code Min: 0; Max: 0; Avg: 0; Stdev: 0; Halstead difficulty Min: 0; Max: 0; Avg: 0; Stdev: 0; Matches 'SyntaxError' optimization: 0.00 % 'SyntaxError' optimization runtime: 0.00 % Matches 'XS': 0.00 % Cumulative output hash: b83a20eaa1d1615b860dd7477dc8945d23b84cd9082a7240df600b347410441ctimolson commentedon Oct 11, 2018
The fact that Rasberry PI is an efficient option should be a huge warning flag that this is not an ASIC resistant PoW. These numbers indicate that the additional complexity of Intel’s branch prediction, cache lookahead, etc is not worth the gates. An ASIC designer will be writing a very simple, small-gate CPU-type thing which runs direct execution from the generator algo with no parsing, interpretation, bytecode, object code, or anything else needed in general purpose CPU’s. An ASIC will put lots of slow but small cores into a chip, and the design will not take long because they can exclude all the fancy stuff Intel and AMD do. ARM cores are easily licensable and customizable for particular applications.
I’ve tried to say this in other ways in other threads, but these numbers back it up.
SChernykh commentedon Oct 11, 2018
Specialized ARM core with proper core-to-cache ratio will be ~2 times more power efficient. I don't see a big problem with it. Many manufacturers can produce ARM cores because you said yourself they're easily licensable. This ARM-based hardware will be just like tuned Raspberry Pi, it can/will be used for other stuff apart mining.
timolson commentedon Oct 11, 2018
2x is huge in mining. As we have seen, hashrate will increase to the point where it’s barely profitable vs electricity. A 2x ASIC means home mining on CPU is not profitable. Everyone will need the ASIC.
SChernykh commentedon Oct 11, 2018
CPU mining is a different world. First, having just single CPU + motherboard + RAM + power supply is already very inefficient. Buying specialized ARM boards and connecting them to the same power bus will be the way to go: https://www.youtube.com/watch?v=i_r3z1jYHAc&t=284s
These ARM boards will be easy to buy like RPi now.
SChernykh commentedon Oct 11, 2018
There will also be PCI-e boards with many small ARM cores like Xeon Phi. And we'll be back to making rigs on PCI-e risers 💯
timolson commentedon Oct 11, 2018
It’s true. That world would be ok. But I’m not convinced I can’t make an ASIC that’s faster than the ARM for running RandomJS programs only.