Skip to content

Commit d89fcf9

Browse files
committed
Added to command line.
Added log port setting to the command line. Changed default setting for CUDA device to none because nvidia likes throwing unknown exceptions otherwise.
1 parent 4310891 commit d89fcf9

5 files changed

Lines changed: 64 additions & 8 deletions

File tree

src/cli/ace_helprun.cpp

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,8 @@ void HelpRun::settingsSetHelp()
599599
{
600600
// Initialize an enumeration and string list used to determine what setting set
601601
// command was given to get help on, if any.
602-
enum {CUDA,OpenCL,Threads,Buffer,ChunkDir,ChunkPre,ChunkExt,Logging};
603-
QStringList list {"cuda","opencl","threads","buffer","chunkdir","chunkpre","chunkext","logging"};
602+
enum {CUDA,OpenCL,Threads,Buffer,ChunkDir,ChunkPre,ChunkExt,Logging,LogPort};
603+
QStringList list {"cuda","opencl","threads","buffer","chunkdir","chunkpre","chunkext","logging","logport"};
604604

605605
// Create an empty command string, setting it to this run's next command argument
606606
// is any exists.
@@ -637,6 +637,9 @@ void HelpRun::settingsSetHelp()
637637
case Logging:
638638
settingsSetLoggingHelp();
639639
break;
640+
case LogPort:
641+
settingsSetLogPortHelp();
642+
break;
640643
default:
641644
{
642645
// If the setting set command was not recognized or was empty then print the basic
@@ -645,11 +648,12 @@ void HelpRun::settingsSetHelp()
645648
stream << "Command: " << _runName << " settings set <key> <value>\n"
646649
<< "Updates a persistent setting with the given key to the new given value.\n\n"
647650
<< " key: The key of the setting that will be updated to a new value. Valid keys\n"
648-
<< " are cuda, opencl, threads, buffer, chunkdir, chunkpre, chunkext, and\n"
649-
<< " logging.\n\n"
651+
<< " are cuda, opencl, threads, buffer, chunkdir, chunkpre, chunkext,\n"
652+
<< " logging, and logport.\n\n"
650653
<< "value: The new value of the given setting.\n\n"
651654
<< "Help: " << _runName << " help settings set <key>\n"
652-
<< "Get help about a specific setting to set with the given key.\n\n";
655+
<< "Get help about a specific setting to set with the given key.\n\n"
656+
<< "Valid settings set keys:\n";
653657
break;
654658
}
655659
}
@@ -822,6 +826,20 @@ void HelpRun::settingsSetLoggingHelp()
822826

823827

824828

829+
void HelpRun::settingsSetLogPortHelp()
830+
{
831+
QTextStream stream(stdout);
832+
stream << "Command: " << _runName << " settings set logport <port>\n"
833+
<< "Updates the logging port setting. The logging port is the port number the ACE\n"
834+
<< "logging system listens on for logging client connections.\n\n"
835+
<< "port: The new port number.\n\n";
836+
}
837+
838+
839+
840+
841+
842+
825843
/*!
826844
* Displays the help text for the settings list command.
827845
*/

src/cli/ace_helprun.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ namespace Ace
4444
void settingsSetChunkPreHelp();
4545
void settingsSetChunkExtHelp();
4646
void settingsSetLoggingHelp();
47+
void settingsSetLogPortHelp();
4748
void settingsListHelp();
4849
/*!
4950
* The command arguments parsed out of the command line arguments of the main

src/cli/ace_settingsrun.cpp

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ void SettingsRun::execute()
5858
stream << " Chunk Prefix: " << settings.chunkPrefix() << "\n";
5959
stream << " Chunk Extension: " << settings.chunkExtension() << "\n";
6060
stream << " Logging: " << ( settings.loggingEnabled() ? QStringLiteral("on") : QStringLiteral("off") ) << "\n";
61+
stream << " Logging Port: " << settings.loggingPort() << "\n";
6162
}
6263

6364
// Else call the setting parser method to determine which command was given.
@@ -197,8 +198,8 @@ void SettingsRun::set()
197198
}
198199

199200
// Create an enumeration and string list used to determine the command given.
200-
enum {Unknown=-1,CUDACom,OpenCLCom,Threads,Buffer,ChunkDir,ChunkPre,ChunkExt,Logging};
201-
QStringList list {"cuda","opencl","threads","buffer","chunkdir","chunkpre","chunkext","logging"};
201+
enum {Unknown=-1,CUDACom,OpenCLCom,Threads,Buffer,ChunkDir,ChunkPre,ChunkExt,Logging,LogPort};
202+
QStringList list {"cuda","opencl","threads","buffer","chunkdir","chunkpre","chunkext","logging","logport"};
202203

203204
// Determine which setting is to be set by the command given, calling the
204205
// appropriate method and popping this object's first command argument.
@@ -229,6 +230,9 @@ void SettingsRun::set()
229230
case Logging:
230231
setLogging();
231232
break;
233+
case LogPort:
234+
setLogPort();
235+
break;
232236
case Unknown:
233237
{
234238
// The set command is not known so throw an exception informing the user.
@@ -565,6 +569,38 @@ void SettingsRun::setLogging()
565569

566570

567571

572+
void SettingsRun::setLogPort()
573+
{
574+
// Add the debug header.
575+
EDEBUG_FUNC(this);
576+
577+
// Make sure there is a command argument to process.
578+
if ( _command.size() < 1 )
579+
{
580+
E_MAKE_EXCEPTION(e);
581+
e.setTitle(QObject::tr("Invalid argument"));
582+
e.setDetails(QObject::tr("Settings set logport requires sub argument, exiting..."));
583+
throw e;
584+
}
585+
586+
bool ok;
587+
int port {_command.first().toInt(&ok)};
588+
if ( !ok || port < 0 || port > 65535 )
589+
{
590+
E_MAKE_EXCEPTION(e);
591+
e.setTitle(QObject::tr("Invalid argument"));
592+
e.setDetails(QObject::tr("Given logging port '%1' invalid, exiting...").arg(_command.first()));
593+
throw e;
594+
}
595+
596+
Ace::Settings::instance().setLoggingPort(port);
597+
}
598+
599+
600+
601+
602+
603+
568604
/*!
569605
* Executes the settings list command, parsing the first argument to determine
570606
* which specific list command is to be executed and calling the appropriate

src/cli/ace_settingsrun.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ namespace Ace
3636
void setChunkPre();
3737
void setChunkExt();
3838
void setLogging();
39+
void setLogPort();
3940
void list();
4041
void listCUDA();
4142
void listOpenCL();

src/core/ace_settings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ namespace Ace
9494
/*!
9595
* The default CUDA device index value.
9696
*/
97-
constexpr static int _cudaDeviceDefault {0};
97+
constexpr static int _cudaDeviceDefault {-1};
9898
/*!
9999
* The default OpenCL platform index value.
100100
*/

0 commit comments

Comments
 (0)