134 | | The other approach is to run MUSCLE as separate API |
| 134 | The other approach is to run MUSCLE as separate processes. The MUSCLE provide two base kernel classes: `NativeKernel` and `MPIKernel` that can be used to run application code as separate process. The process can comunicate with the library (and other kernels) via a new C/C++ MUSCLE API: |
| 135 | {{{ |
| 136 | muscle::env::init(); |
| 137 | |
| 138 | cout << "c++: begin "<< argv[0] <<endl; |
| 139 | cout << "Kernel Name: " << muscle::cxa::kernel_name() << endl; |
| 140 | |
| 141 | for(int time = 0; !muscle::env::will_stop(); time ++) { |
| 142 | |
| 143 | // process data |
| 144 | for(int i = 0; i < 5; i++) { |
| 145 | dataA[i] = i; |
| 146 | } |
| 147 | |
| 148 | // dump to our portals |
| 149 | muscle::env::send("data", dataA, 5, MUSCLE_DOUBLE); |
| 150 | } |
| 151 | |
| 152 | muscle::env::finalize(); |
| 153 | }}} |