diff --git a/rai/rai_node/entry.cpp b/rai/rai_node/entry.cpp index f480a688..14bcf544 100644 --- a/rai/rai_node/entry.cpp +++ b/rai/rai_node/entry.cpp @@ -7,106 +7,6 @@ #include #include -class xorshift128 -{ -public: - uint64_t s[2]; - - uint64_t next (void) - { - uint64_t s1 = s[0]; - const uint64_t s0 = s[1]; - s[0] = s0; - s1 ^= s1 << 23; // a - return (s[1] = (s1 ^ s0 ^ (s1 >> 17) ^ (s0 >> 26))) + s0; // b, c - } -}; - -class xorshift1024 -{ -public: - uint64_t s[16]; - int p; - - uint64_t next (void) - { - uint64_t s0 = s[p]; - uint64_t s1 = s[p = (p + 1) & 15]; - s1 ^= s1 << 31; // a - s1 ^= s1 >> 11; // b - s0 ^= s0 >> 30; // c - return (s[p] = s0 ^ s1) * 1181783497276652981LL; - } -}; - -void fill_128_reference (void * data) -{ - xorshift128 rng; - rng.s[0] = 1; - rng.s[1] = 0; - for (auto i (reinterpret_cast (data)), n (reinterpret_cast (data) + 1024 * 1024); i != n; ++i) - { - *i = rng.next (); - } -} - -#if 0 -void fill_128_sse (void * data) -{ - xorshift128 rng; - rng.s [0] = 1; - rng.s [1] = 0; - for (auto i (reinterpret_cast <__m128i *> (data)), n (reinterpret_cast <__m128i *> (data) + 512 * 1024); i != n; ++i) - { - auto v0 (rng.next ()); - auto v1 (rng.next ()); - _mm_store_si128 (i, _mm_set_epi64x (v1, v0)); - } -} -#endif // 0 - -void fill_1024_reference (void * data) -{ - xorshift1024 rng; - rng.p = 0; - rng.s[0] = 1; - for (auto i (0u); i < 16; ++i) - { - rng.s[i] = 0; - } - for (auto i (reinterpret_cast (data)), n (reinterpret_cast (data) + 1024 * 1024); i != n; ++i) - { - *i = rng.next (); - } -} - -#if 0 -void fill_1024_sse (void * data) -{ - xorshift1024 rng; - rng.p = 0; - rng.s [0] = 1; - for (auto i (0u); i < 16; ++i) - { - rng.s [i] = 0; - } - for (auto i (reinterpret_cast <__m128i *> (data)), n (reinterpret_cast <__m128i *> (data) + 512 * 1024); i != n; ++i) - { - auto v0 (rng.next ()); - auto v1 (rng.next ()); - _mm_store_si128 (i, _mm_set_epi64x (v1, v0)); - } -} - -void fill_zero (void * data) -{ - for (auto i (reinterpret_cast <__m128i *> (data)), n (reinterpret_cast <__m128i *> (data) + 512 * 1024); i != n; ++i) - { - _mm_store_si128 (i, _mm_setzero_si128 ()); - } -} -#endif // 0 - int main (int argc, char * const * argv) { boost::program_options::options_description description ("Command line options"); @@ -128,7 +28,6 @@ int main (int argc, char * const * argv) ("debug_profile_kdf", "Profile kdf function") ("debug_verify_profile", "Profile signature verification") ("debug_profile_sign", "Profile signature generation") - ("debug_xorshift_profile", "Profile xorshift algorithms") ("platform", boost::program_options::value (), "Defines the for OpenCL commands") ("device", boost::program_options::value (), "Defines for OpenCL command") ("threads", boost::program_options::value (), "Defines count for OpenCL command"); @@ -419,63 +318,6 @@ int main (int argc, char * const * argv) { std::cout << "Version " << RAIBLOCKS_VERSION_MAJOR << "." << RAIBLOCKS_VERSION_MINOR << std::endl; } -#if 0 - else if (vm.count ("debug_xorshift_profile")) - { - auto unaligned (new uint8_t [64 * 1024 * 1024 + 16]); - auto aligned (reinterpret_cast (reinterpret_cast (unaligned) & ~uintptr_t (0xfu))); - { - memset (aligned, 0x0, 64 * 1024 * 1024); - auto begin (std::chrono::high_resolution_clock::now ()); - for (auto i (0u); i < 1000; ++i) - { - fill_zero (aligned); - } - auto end (std::chrono::high_resolution_clock::now ()); - std::cerr << "Memset " << std::chrono::duration_cast (end - begin).count () << std::endl; - } - { - memset (aligned, 0x0, 64 * 1024 * 1024); - auto begin (std::chrono::high_resolution_clock::now ()); - for (auto i (0u); i < 1000; ++i) - { - fill_128_reference (aligned); - } - auto end (std::chrono::high_resolution_clock::now ()); - std::cerr << "Ref fill 128 " << std::chrono::duration_cast (end - begin).count () << std::endl; - } - { - memset (aligned, 0x0, 64 * 1024 * 1024); - auto begin (std::chrono::high_resolution_clock::now ()); - for (auto i (0u); i < 1000; ++i) - { - fill_1024_reference (aligned); - } - auto end (std::chrono::high_resolution_clock::now ()); - std::cerr << "Ref fill 1024 " << std::chrono::duration_cast (end - begin).count () << std::endl; - } - { - memset (aligned, 0x0, 64 * 1024 * 1024); - auto begin (std::chrono::high_resolution_clock::now ()); - for (auto i (0u); i < 1000; ++i) - { - fill_128_sse (aligned); - } - auto end (std::chrono::high_resolution_clock::now ()); - std::cerr << "SSE fill 128 " << std::chrono::duration_cast (end - begin).count () << std::endl; - } - { - memset (aligned, 0x0, 64 * 1024 * 1024); - auto begin (std::chrono::high_resolution_clock::now ()); - for (auto i (0u); i < 1000; ++i) - { - fill_1024_sse (aligned); - } - auto end (std::chrono::high_resolution_clock::now ()); - std::cerr << "SSE fill 1024 " << std::chrono::duration_cast (end - begin).count () << std::endl; - } - } -#endif // 0 else { std::cout << description << std::endl;