Commit 2796d429 authored by Adam P. Goucher's avatar Adam P. Goucher

Another symmetry

parent 07455b05
Pipeline #54403096 passed with stages
in 7 minutes and 18 seconds
......@@ -7,6 +7,13 @@
multiverse[threadnum + 256] = 0; multiverse[threadnum + 320] = 0; \
multiverse[threadnum + 384] = 0; multiverse[threadnum + 448] = 0; threadnum += 384
#define CUDABITREVERSE(c, b) c = (b >> 32) | (b << 32); \
c = ((c & 0xffff0000ffff0000ull) >> 16) | ((c & 0x0000ffff0000ffffull) << 16); \
c = ((c & 0xff00ff00ff00ff00ull) >> 8) | ((c & 0x00ff00ff00ff00ffull) << 8); \
c = ((c & 0xf0f0f0f0f0f0f0f0ull) >> 4) | ((c & 0x0f0f0f0f0f0f0f0full) << 4); \
c = ((c & 0xccccccccccccccccull) >> 2) | ((c & 0x3333333333333333ull) << 2); \
c = ((c & 0xaaaaaaaaaaaaaaaaull) >> 1) | ((c & 0x5555555555555555ull) << 1)
__global__ void copyhashes_C1(uint64_cu *multiverse, uint32_cu *univec, uint64_cu *hashes, uint32_cu offset, bool initial) {
#include "cphash_header.h"
......@@ -87,6 +94,28 @@ __global__ void copyhashes_D2_p2(uint64_cu *multiverse, uint32_cu *univec, uint6
#include "cphash_footer.h"
}
__global__ void copyhashes_D4_p4(uint64_cu *multiverse, uint32_cu *univec, uint64_cu *hashes, uint32_cu offset, bool initial) {
#include "cphash_header.h"
// Copy SHA-256 hash:
if ((threadIdx.x >= 32) && (threadIdx.x < 48)) {
b = hashes[(hashnum << 2) + (threadIdx.x >> 2) - 8];
b = (b >> (16 * (threadIdx.x & 3)));
b = ((b & 0x00ff) << 32) | ((b & 0xff00) << 16);
} else if ((threadIdx.x >= 16) && (threadIdx.x < 32)) {
uint32_cu ti = 63 - threadIdx.x;
b = hashes[(hashnum << 2) + (ti >> 2) - 8];
b = (b >> (16 * (ti & 3)));
b = ((b & 0x00ff) << 32) | ((b & 0xff00) << 16);
}
uint64_cu CUDABITREVERSE(c, b);
b = (b >> 8) | (c << 8);
#include "cphash_footer.h"
}
void copyhashes(std::string full_symmetry, int universes_left, uint64_cu *multiverse,
uint32_cu *univec, uint64_cu *hashes, uint32_cu offset, bool initial) {
......@@ -106,6 +135,8 @@ void copyhashes(std::string full_symmetry, int universes_left, uint64_cu *multiv
copyhashes_D2_p1<<<universes_left, 64>>>(multiverse, univec, hashes, offset, initial);
} else if (symmetry == "D2_+2") {
copyhashes_D2_p2<<<universes_left, 64>>>(multiverse, univec, hashes, offset, initial);
} else if (symmetry == "D4_+4") {
copyhashes_D4_p4<<<universes_left, 64>>>(multiverse, univec, hashes, offset, initial);
} else {
std::cerr << "Fatal: symmetry " << symmetry << " unrecognised!!!" << std::endl;
exit(1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment