mirror of
https://git.wownero.com/wownero/RandomWOW.git
synced 2024-08-15 00:23:14 +00:00
Run a single thread synchronously
This commit is contained in:
parent
c05947db09
commit
03913d0e81
1 changed files with 29 additions and 14 deletions
15
src/main.cpp
15
src/main.cpp
|
@ -206,6 +206,7 @@ int main(int argc, char** argv) {
|
||||||
else {
|
else {
|
||||||
RandomX::Cache* cache = dataset.cache;
|
RandomX::Cache* cache = dataset.cache;
|
||||||
RandomX::datasetAlloc(dataset);
|
RandomX::datasetAlloc(dataset);
|
||||||
|
if (threadCount > 1) {
|
||||||
auto perThread = RandomX::DatasetBlockCount / threadCount;
|
auto perThread = RandomX::DatasetBlockCount / threadCount;
|
||||||
auto remainder = RandomX::DatasetBlockCount % threadCount;
|
auto remainder = RandomX::DatasetBlockCount % threadCount;
|
||||||
for (int i = 0; i < threadCount; ++i) {
|
for (int i = 0; i < threadCount; ++i) {
|
||||||
|
@ -220,6 +221,15 @@ int main(int argc, char** argv) {
|
||||||
for (int i = 0; i < threads.size(); ++i) {
|
for (int i = 0; i < threads.size(); ++i) {
|
||||||
threads[i].join();
|
threads[i].join();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (softAes) {
|
||||||
|
RandomX::datasetInit<true>(cache, dataset, 0, RandomX::DatasetBlockCount);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
RandomX::datasetInit<false>(cache, dataset, 0, RandomX::DatasetBlockCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
delete cache;
|
delete cache;
|
||||||
threads.clear();
|
threads.clear();
|
||||||
std::cout << "Dataset (4 GiB) initialized in " << sw.getElapsed() << " s" << std::endl;
|
std::cout << "Dataset (4 GiB) initialized in " << sw.getElapsed() << " s" << std::endl;
|
||||||
|
@ -238,12 +248,17 @@ int main(int argc, char** argv) {
|
||||||
}
|
}
|
||||||
std::cout << "Running benchmark (" << programCount << " programs) ..." << std::endl;
|
std::cout << "Running benchmark (" << programCount << " programs) ..." << std::endl;
|
||||||
sw.restart();
|
sw.restart();
|
||||||
|
if (threadCount > 1) {
|
||||||
for (int i = 0; i < vms.size(); ++i) {
|
for (int i = 0; i < vms.size(); ++i) {
|
||||||
threads.push_back(std::thread(&mine, vms[i], std::ref(atomicNonce), std::ref(result), programCount, i));
|
threads.push_back(std::thread(&mine, vms[i], std::ref(atomicNonce), std::ref(result), programCount, i));
|
||||||
}
|
}
|
||||||
for (int i = 0; i < threads.size(); ++i) {
|
for (int i = 0; i < threads.size(); ++i) {
|
||||||
threads[i].join();
|
threads[i].join();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mine(vms[0], std::ref(atomicNonce), std::ref(result), programCount, 0);
|
||||||
|
}
|
||||||
double elapsed = sw.getElapsed();
|
double elapsed = sw.getElapsed();
|
||||||
std::cout << "Calculated result: ";
|
std::cout << "Calculated result: ";
|
||||||
result.print(std::cout);
|
result.print(std::cout);
|
||||||
|
|
Loading…
Reference in a new issue