2 # Copyright (C) 2009-2012 EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #import context from ..
24 execfile("../pacocontext.py")
25 from module_generator import Generator,Module,Service,PACOComponent
31 Ports::Param_Double_Port::seq_double data;
33 for (double i=0; i< 10; i++)
35 _master_port_port->configure_port_method_put(10);
36 _master_port_port->put(data);
38 Ports::Param_Double_Port::seq_double * results;
39 _master_port_port->get_results(results);
40 std::cerr << "Master receive a sequence of length = " << results->length() << std::endl;
41 for (int i = 0; i < results->length(); i++)
42 std::cerr << "Master receive data : " << (*results)[i] << std::endl;
47 // Réception des données
48 Ports::Param_Double_Port::seq_double * data = _worker_port_port->get_data();
49 std::cerr << "Node " << getMyRank() << " receive a sequence of length = " << data->length() << std::endl;
50 for (int i = 0; i < data->length(); i++)
51 std::cerr << "Node " << getMyRank() << " receive data : " << (*data)[i] << std::endl;
55 data = new Ports::Param_Double_Port::seq_double();
57 for (double i=0; i< 5; i++)
59 (*data)[i] = i + i + (getMyRank() * 20);
61 _worker_port_port->configure_set_data(5, 5*getTotalNode(), 5*getMyRank());
62 _worker_port_port->set_data(data);
66 c1=PACOComponent("MASTER",
69 Service("StartMaster",
70 parallel_outstream=[("master_port", "Param_Double_Port")],
77 c2=PACOComponent("WORKER",
80 Service("StartWorker",
81 parallel_instream=[("worker_port", "Param_Double_Port")],
89 g=Generator(Module("DSC_PARALLEL_PARAM",components=[c1, c2],prefix="./install"),context)
95 g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR})