JayDDee / cpuminer-opt

Optimized multi algo CPU miner
Other
773 stars 545 forks source link

Parameter to set path to verthash.dat file #303

Closed RainbowMiner closed 3 years ago

RainbowMiner commented 3 years ago

Thank you for adding verthash. Would it be possible to add an extra parameter for a user defined path to the verthash.dat file? E.g. --verthash-dat-path <path to verthash.dat>

Regards,

RBM

JayDDee commented 3 years ago

Already in the works. I will also add a parameter to disable data file verification at startup, saves a few seconds.

RainbowMiner commented 3 years ago

Nice. Thank you!

JayDDee commented 3 years ago

I left those out of the initial release because it was more work than just adding the verthash code, which was essentially plug-n-play. I also don't like adding new command line options that apply to only one algo.

However, I think I have a compromise:

--data-file will be used by verthash to define the path to the verthash data file including it's name. The default is verthash.dat in the current directory.

--verify will be used by verthash to perform verification of the verthash data file at startup. Note the default is changed to disabled. Verification doesn't seem that useful, it seems like a leftover from debugging the generator.

Verthash is the only current user of these options but they are generic enough to be used by other algos that might have similar characteristics.

Then there is the creation of verthash.dat. It's too big for downloading and is very verthash specific.

Creating it on the fly if required is possible but that could be triggered by a simple command line typo. It could also leave a mess behind in some unintended directory when triggered in error.

A seperate downloadable program would also be a possibility but that would essentially be just the existing VerthashMiner with the mining code removed.

It's kind of awkward to have to download one miner just to create a file needed by a different miner but I'm hoping it doesn't become a big issue. or doesn't become a big issue until I can find a solution I can live with.

RainbowMiner commented 3 years ago

Very good compromise!

JayDDee commented 3 years ago

I also have a solution for creation of the data file. There will be option to create a data file like in Verthash miner. It will be triggered automatically under very specific conditions

If the combination of --verify without --data-file will automatically trigger creation if the file is not found in the default location. This combination should be unusual in most circumstances. A request to verify the data file would be expected to also specify the file to be verified.

The use case works lik this:

Most user are not expected to use --verify on a regular basis, mostly it will be used only on the first run if ever.

The typical first run by a newbie would use the defaults. Without --verify a file not found error will be generated and the miner wil exit. A message will also be displayed suggesting adding --verify to create a new default file.

The miner wil then create a data file, verify it and start mining.

Data file creation will never occur if --data-file option is present even if it points to the default file location and name.

The trigger occurs only if: 1, --data-file is not used, 2, no default file is found, and 3, --verify is used.

Here'a look at it in action...

$ ./cpuminer -a verthash ...

     **********  cpuminer-opt 3.16.1  *********** 
 A CPU miner with multi algo support and optimized for CPUs
 with AVX512, SHA and VAES extensions by JayDDee.
 BTC donation address: 12tdvfF7KmAsihBXQXynT6E6th2c2pByTT

[2021-03-22 12:33:25] No Verthash data file specified and default not found. [2021-03-22 12:33:25] Add '--verify' to create default 'verthash.dat' [2021-03-22 12:33:25] FAIL: verthash algorithm failed to initialize

$ ./cpuminer -a verthash --verify ...

     **********  cpuminer-opt 3.16.1  *********** 
 A CPU miner with multi algo support and optimized for CPUs
 with AVX512, SHA and VAES extensions by JayDDee.
 BTC donation address: 12tdvfF7KmAsihBXQXynT6E6th2c2pByTT

[2021-03-22 12:33:41] No Verthash data file specified and default not found. [2021-03-22 12:33:41] Creating default 'verthash.dat' in current directory, this could take a long time [2021-03-22 12:36:18] Verthash data file created successfully [2021-03-22 12:36:18] Using Verthash data file 'verthash.dat' [2021-03-22 12:36:18] Verifying Verthash data [2021-03-22 12:36:22] Verthash data has been verified

CPU: Intel(R) Core(TM) i9-9940X CPU @ 3.30GHz SW built on Mar 21 2021 with GCC 9.3.0 CPU features: AVX512 AES SW features: AVX512 AES Algo features: None

Starting miner with no optimizations...

JayDDee commented 3 years ago

cpuminer-op-3.16.1 is released. let me know of any problems.

RainbowMiner commented 3 years ago

Smart programming! Thank you, I will report back, if there are any problems.

JayDDee commented 3 years ago

I assume there are no problems, closing.