Mise à jour terminée. Pour connaître les apports de la version 13.8.4 par rapport à notre ancienne version vous pouvez lire les "Release Notes" suivantes :
https://about.gitlab.com/releases/2021/02/11/security-release-gitlab-13-8-4-released/
https://about.gitlab.com/releases/2021/02/05/gitlab-13-8-3-released/

main.cpp 3.04 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/* main.cpp ---
 *
 * Author: Nicolas Niclausse
 * Copyright (C) 2014 - Nicolas Niclausse, Inria.
 * Created: 2014/10/28 12:45:34
 */

/* Commentary:
 *
 */

/* Change log:
 *
 */



18 19 20

#include <dtkDistributed>
#include <dtkComposer>
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53

#include <QtConcurrent>

int main(int argc, char **argv)
{


    bool useGUI = false;

    QApplication application(argc, argv, useGUI);
    application.setApplicationName("dtkComposerEvaluator");
    application.setApplicationVersion("1.0.0");
    application.setOrganizationName("inria");
    application.setOrganizationDomain("fr");

    // plugins
    dtkDistributedSettings settings;
    settings.beginGroup("communicator");
    qDebug() << "initialize plugin manager "<< settings.value("plugins").toString();
    dtkDistributed::communicator::pluginManager().initialize(settings.value("plugins").toString());
    qDebug() << "initialization done ";
    settings.endGroup();

    qDebug() << dtkDistributed::communicator::pluginManager().plugins();
    qDebug() << dtkDistributed::communicator::pluginFactory().keys();

    QStringList args = QCoreApplication::arguments();
    if(args.count() < 2) {
        qDebug() << "argv" << args;
        qDebug() << "Usage: " << argv[0] << "--spawn | [-pg] <composition> ";
        return 0;
    }

54
    dtkComposerNodeFactory *factory = new dtkComposerNodeFactory;
55 56 57 58 59

    if (args[1] == "--spawn") {

        // FIXME: don't hardcode plugin
        dtkDistributedPolicy policy;
NICLAUSSE Nicolas's avatar
NICLAUSSE Nicolas committed
60 61 62 63
        //FIXME: don't use manager
        // dtkDistributedWorkerManager manager;
        // policy.setType("mpi3");
        // manager.setPolicy(&policy);
64 65 66 67 68

        dtkComposerEvaluatorProcess p;

        QStringList hosts;
        // dtkDistributedCommunicator *comm = manager.spawn();
NICLAUSSE Nicolas's avatar
NICLAUSSE Nicolas committed
69
//        dtkDistributedCommunicator *comm ;
NICLAUSSE Nicolas's avatar
NICLAUSSE Nicolas committed
70
        //manager.spawn();
71

NICLAUSSE Nicolas's avatar
NICLAUSSE Nicolas committed
72
//        p.setInternalCommunicator(comm);
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
        p.setParentCommunicator(policy.communicator());
        p.setFactory(factory);
        p.setApplication("dtkComposerEvaluator");

        int value;
        do  { value = p.exec(); } while (value  == 0);

        return value;
    }

    dtkComposerScene *scene = new dtkComposerScene;
    dtkComposerStack *stack = new dtkComposerStack;
    dtkComposerGraph *graph = new dtkComposerGraph;
    dtkComposerEvaluator *evaluator = new dtkComposerEvaluator;;

    scene->setFactory(factory);
    scene->setStack(stack);
    scene->setGraph(graph);

    evaluator->setGraph(graph);

    dtkComposerReader *reader;
    reader = new dtkComposerReader;
    reader->setFactory(factory);
    reader->setScene(scene);
    reader->setGraph(graph);

    int index= 1;

    if (args[1] == "-pg") {
        index = 2;
        evaluator->setProfiling(true);
    }


    if (!reader->read(argv[index])) {
        qDebug() << "read failure for " << argv[index];
        return 1;
    } else {

        QObject::connect(evaluator,SIGNAL(evaluationStopped()),&application, SLOT(quit()));
        QtConcurrent::run(evaluator, &dtkComposerEvaluator::run_static, false);
        application.exec();
        // dtkPluginManager::instance()->uninitialize();
    }
}