Commit ee726758 authored by Ondrej Mosnáček's avatar Ondrej Mosnáček

[global] Fix minor coding style issues

parent 35e58264
Pipeline #53738277 (#115) passed with stages
in 62 minutes and 2 seconds
......@@ -7,7 +7,7 @@ namespace cuda {
ProgramContext::ProgramContext(
const GlobalContext *globalContext,
const std::vector<Device> &devices,
const std::vector<Device> &,
Type type, Version version)
: globalContext(globalContext), type(type), version(version)
{
......
......@@ -230,7 +230,7 @@ std::string Device::getInfo() const
{ CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, "Out-of-order execution" },
{ CL_QUEUE_PROFILING_ENABLE, "Profiling" },
}) << std::endl;
return std::move(out.str());
return out.str();
}
} // namespace opencl
......
......@@ -33,7 +33,7 @@ cl::Program KernelLoader::loadArgon2Program(
try {
std::string opts = buildOpts.str();
prog.build(opts.c_str());
} catch (const cl::Error &err) {
} catch (const cl::Error &) {
std::cerr << "ERROR: Failed to build program:" << std::endl;
for (cl::Device &device : context.getInfo<CL_CONTEXT_DEVICES>()) {
std::cerr << " Build log from device '" << device.getInfo<CL_DEVICE_NAME>() << "':" << std::endl;
......
......@@ -21,19 +21,19 @@ int BenchmarkDirector::runBenchmark(Argon2Runner &runner) const
if (beVerbose) {
auto &time = stats.getNanoseconds();
std::cout << "Mean computation time: "
<< RunTimeStats::repr((nanosecs)time.getMean())
<< RunTimeStats::repr(nanosecs(time.getMean()))
<< std::endl;
std::cout << "Mean deviation: "
<< RunTimeStats::repr((nanosecs)time.getMeanDeviation())
<< RunTimeStats::repr(nanosecs(time.getMeanDeviation()))
<< " (" << time.getMeanDeviationPerMean() * 100.0 << "%)"
<< std::endl;
auto &perHash = stats.getNanosecsPerHash();
std::cout << "Mean computation time (per hash): "
<< RunTimeStats::repr((nanosecs)perHash.getMean())
<< RunTimeStats::repr(nanosecs(perHash.getMean()))
<< std::endl;
std::cout << "Mean deviation (per hash): "
<< RunTimeStats::repr((nanosecs)perHash.getMeanDeviation())
<< RunTimeStats::repr(nanosecs(perHash.getMeanDeviation()))
<< std::endl;
return 0;
}
......
......@@ -12,9 +12,6 @@ using namespace libcommandline;
struct Arguments
{
bool showHelp = false;
bool listDevices = false;
std::string mode = "cuda";
std::size_t deviceIndex = 0;
......@@ -28,9 +25,12 @@ struct Arguments
std::size_t m_cost = 1024;
std::size_t lanes = 1;
std::size_t batchSize = 16;
std::size_t sampleCount = 10;
std::string kernelType = "by-segment";
bool precomputeRefs = false;
std::size_t sampleCount = 10;
bool showHelp = false;
bool listDevices = false;
};
static CommandLineParser<Arguments> buildCmdLineParser()
......@@ -49,7 +49,7 @@ static CommandLineParser<Arguments> buildCmdLineParser()
new ArgumentOption<Arguments>(
makeNumericHandler<Arguments, std::size_t>([] (Arguments &state, std::size_t index) {
state.deviceIndex = (std::size_t)index;
state.deviceIndex = index;
}), "device", 'd', "use device with index INDEX", "0", "INDEX"),
new ArgumentOption<Arguments>(
......@@ -67,23 +67,23 @@ static CommandLineParser<Arguments> buildCmdLineParser()
"version", 'v', "Argon2 version (1.0|1.3)", "1.3", "VERSION"),
new ArgumentOption<Arguments>(
makeNumericHandler<Arguments, std::size_t>([] (Arguments &state, std::size_t num) {
state.t_cost = (std::size_t)num;
state.t_cost = num;
}), "t-cost", 'T', "time cost", "1", "N"),
new ArgumentOption<Arguments>(
makeNumericHandler<Arguments, std::size_t>([] (Arguments &state, std::size_t num) {
state.m_cost = (std::size_t)num;
state.m_cost = num;
}), "m-cost", 'M', "memory cost", "1024", "N"),
new ArgumentOption<Arguments>(
makeNumericHandler<Arguments, std::size_t>([] (Arguments &state, std::size_t num) {
state.lanes = (std::size_t)num;
state.lanes = num;
}), "lanes", 'L', "number of lanes", "1", "N"),
new ArgumentOption<Arguments>(
makeNumericHandler<Arguments, std::size_t>([] (Arguments &state, std::size_t num) {
state.batchSize = (std::size_t)num;
state.batchSize = num;
}), "batch-size", 'b', "number of tasks per batch", "16", "N"),
new ArgumentOption<Arguments>(
makeNumericHandler<Arguments, std::size_t>([] (Arguments &state, std::size_t num) {
state.sampleCount = (std::size_t)num;
state.sampleCount = num;
}), "samples", 's', "number of batches to run and measure", "10", "N"),
new ArgumentOption<Arguments>(
[] (Arguments &state, const std::string &type) { state.kernelType = type; },
......
......@@ -289,7 +289,7 @@ static CommandLineParser<Arguments> buildCmdLineParser()
new ArgumentOption<Arguments>(
makeNumericHandler<Arguments, std::size_t>([] (Arguments &state, std::size_t index) {
state.deviceIndex = (std::size_t)index;
state.deviceIndex = index;
}), "device", 'd', "use device with index INDEX", "0", "INDEX"),
new FlagOption<Arguments>(
......
#include "testcase.h"
static char toHex(std::uint8_t digit) {
return digit >= 10 ? 'a' + (digit - 10) : '0' + digit;
return digit >= 10 ? 'a' + char(digit - 10) : char('0' + digit);
}
static void dumpBytes(std::ostream &out, const void *data, std::size_t size)
......
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