Commit d18b2465 authored by KLOCZKO Thibaud's avatar KLOCZKO Thibaud

Add Core string to dtkApplication kind methods so as to prevent name

collision with support layer.
parent 15bc2696
......@@ -42,3 +42,4 @@ int main(int argc, char *argv[])
return app.exec();
}
......@@ -23,13 +23,13 @@ int main(int argc, char **argv)
{
QCoreApplication application(argc, argv);
if(!dtkApplicationArgumentsContain(&application, "-type")) {
if(!dtkCoreApplicationArgumentsContain(&application, "-type")) {
qDebug() << "Usage:" << argv[0] << " [-p port] -type <Oar | Torque | Local |...>";
return 1;
}
int port;
if(dtkApplicationArgumentsContain(&application, "-p"))
port = dtkApplicationArgumentsValue(&application, "-p").toInt();
if(dtkCoreApplicationArgumentsContain(&application, "-p"))
port = dtkCoreApplicationArgumentsValue(&application, "-p").toInt();
else
port = 9999;
......@@ -46,7 +46,7 @@ int main(int argc, char **argv)
dtkDistributedServerDaemon server(port);
server.setManager( dtkApplicationArgumentsValue(&application, "-type"));
server.setManager( dtkCoreApplicationArgumentsValue(&application, "-type"));
qDebug() << "server started";
int status = application.exec();
......
......@@ -48,7 +48,7 @@ public:
DTK_DISTRIBUTED_BEGIN_GLOBAL;
QUrl url(dtkApplicationArgumentsValue(qApp,"--server"));
QUrl url(dtkCoreApplicationArgumentsValue(qApp,"--server"));
qDebug() << "Running on master, connect to remote server" ;
slave.connect(url);
......@@ -79,7 +79,7 @@ int main(int argc, char **argv)
{
QCoreApplication application(argc, argv);
if (!dtkApplicationArgumentsContain(qApp,"--server")) {
if (!dtkCoreApplicationArgumentsContain(qApp,"--server")) {
qCritical() << "no server set! use --server <url> " ;
return 1;
}
......@@ -106,8 +106,8 @@ int main(int argc, char **argv)
dtkDistributedPolicy policy;
QString policyType = "qthread";
if (dtkApplicationArgumentsContain(qApp,"--policy")) {
policyType = dtkApplicationArgumentsValue(qApp,"--policy");
if (dtkCoreApplicationArgumentsContain(qApp,"--policy")) {
policyType = dtkCoreApplicationArgumentsValue(qApp,"--policy");
}
policy.setType(policyType);
......
......@@ -3,9 +3,9 @@
* Author: Julien Wintz
* Created: Thu Feb 28 16:28:31 2013 (+0100)
* Version:
* Last-Updated: mar. avril 15 11:09:21 2014 (+0200)
* Last-Updated: mer. sept. 17 11:23:04 2014 (+0200)
* By: Thibaud Kloczko
* Update #: 62
* Update #: 66
*/
/* Change Log:
......@@ -91,7 +91,7 @@ public:
// Helper functions
// ///////////////////////////////////////////////////////////////////
inline bool dtkApplicationArgumentsContain(int argc, char **argv, QString value)
inline bool dtkCoreApplicationArgumentsContain(int argc, char **argv, QString value)
{
for(int i = 1; i < argc; i++)
if(QString(argv[i]) == value)
......@@ -100,12 +100,12 @@ inline bool dtkApplicationArgumentsContain(int argc, char **argv, QString value)
return false;
}
inline bool dtkApplicationArgumentsContain(QCoreApplication *application, QString value)
inline bool dtkCoreApplicationArgumentsContain(QCoreApplication *application, QString value)
{
return application->arguments().contains(value);
}
inline QString dtkApplicationArgumentsValue(int argc, char **argv, QString key)
inline QString dtkCoreApplicationArgumentsValue(int argc, char **argv, QString key)
{
for(int i = 1; i < argc; i++) {
if(QString(argv[i]) == key) {
......@@ -119,7 +119,7 @@ inline QString dtkApplicationArgumentsValue(int argc, char **argv, QString key)
return QString();
}
inline QString dtkApplicationArgumentsValue(QCoreApplication *application, QString key)
inline QString dtkCoreApplicationArgumentsValue(QCoreApplication *application, QString key)
{
QStringList args = application->arguments();
int i = args.indexOf(key);
......
......@@ -112,8 +112,8 @@ QStringList dtkDistributedPolicy::hosts(void)
}
}
qDebug() << "No hostfile found, try qapp args";
if (dtkApplicationArgumentsContain(qApp,"-np")) {
int np = dtkApplicationArgumentsValue(qApp,"-np").toInt();
if (dtkCoreApplicationArgumentsContain(qApp,"-np")) {
int np = dtkCoreApplicationArgumentsValue(qApp,"-np").toInt();
for (int i = 0; i < np; i++) {
d->hosts << "localhost";
}
......@@ -121,15 +121,15 @@ QStringList dtkDistributedPolicy::hosts(void)
d->hosts << "localhost";
d->nthreads = 1;
}
if (dtkApplicationArgumentsContain(qApp,"-nt")) { // number of threads
if (dtkCoreApplicationArgumentsContain(qApp,"-nt")) { // number of threads
if (d->type == "mpi") {
int nt = dtkApplicationArgumentsValue(qApp,"-nt").toInt();
int nt = dtkCoreApplicationArgumentsValue(qApp,"-nt").toInt();
int total = d->hosts.count() * nt;
for (int i = d->hosts.count(); i < total; i++) {
d->hosts << "localhost";
}
} else {
d->nthreads = dtkApplicationArgumentsValue(qApp,"-nt").toInt();
d->nthreads = dtkCoreApplicationArgumentsValue(qApp,"-nt").toInt();
}
}
qDebug() << "policy updated, hosts:" << d->hosts.count() << "threads:" << d->nthreads;
......
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