Flags ordered by their impact on performance

Additional error handling
This commit is contained in:
tevador
2019-04-21 23:23:13 +02:00
parent d30eef75af
commit bc78b628ea
8 changed files with 54 additions and 36 deletions

View File

@@ -8,8 +8,7 @@ int main() {
randomx_cache *myCache = randomx_alloc_cache(RANDOMX_FLAG_DEFAULT);
randomx_init_cache(myCache, mySeed, sizeof mySeed);
randomx_vm *myMachine = randomx_create_vm(RANDOMX_FLAG_DEFAULT);
randomx_vm_set_cache(myMachine, myCache);
randomx_vm *myMachine = randomx_create_vm(RANDOMX_FLAG_DEFAULT, myCache, NULL);
randomx_calculate_hash(myMachine, &myInput, sizeof myInput, hash);

View File

@@ -26,8 +26,7 @@ int main() {
t2.join();
randomx_release_cache(myCache);
randomx_vm *myMachine = randomx_create_vm((randomx_flags)(RANDOMX_FLAG_FULL_MEM | RANDOMX_FLAG_JIT | RANDOMX_FLAG_HARD_AES | RANDOMX_FLAG_LARGE_PAGES));
randomx_vm_set_dataset(myMachine, myDataset);
randomx_vm *myMachine = randomx_create_vm((randomx_flags)(RANDOMX_FLAG_FULL_MEM | RANDOMX_FLAG_JIT | RANDOMX_FLAG_HARD_AES | RANDOMX_FLAG_LARGE_PAGES), nullptr, myDataset);
randomx_calculate_hash(myMachine, &myInput, sizeof myInput, hash);

View File

@@ -201,11 +201,11 @@ int main(int argc, char** argv) {
std::cout << "Memory initialized in " << sw.getElapsed() << " s" << std::endl;
std::cout << "Initializing " << threadCount << " virtual machine(s) ..." << std::endl;
for (int i = 0; i < threadCount; ++i) {
randomx_vm *vm = randomx_create_vm(flags);
if (miningMode)
randomx_vm_set_dataset(vm, dataset);
else
randomx_vm_set_cache(vm, cache);
randomx_vm *vm = randomx_create_vm(flags, cache, dataset);
if (vm == nullptr) {
std::cout << "ERROR: Unsupported virtual machine options" << std::endl;
return 1;
}
vms.push_back(vm);
}
std::cout << "Running benchmark (" << noncesCount << " nonces) ..." << std::endl;