123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #include <starpu_mpi.h>
- #include <interface/complex_interface.h>
- #include <interface/complex_codelet.h>
- int main(int argc, char **argv)
- {
- int rank, nodes;
- int ret;
- ret = starpu_init(NULL);
- STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
- starpu_mpi_initialize_extended(&rank, &nodes);
- if (nodes < 2)
- {
- fprintf(stderr, "This program needs at least 2 nodes\n");
- ret = 77;
- }
- else
- {
- if (rank == 0)
- {
- double real[2] = {4.0, 2.0};
- double imaginary[2] = {7.0, 9.0};
- starpu_data_handle_t handle;
- starpu_complex_data_register(&handle, 0, real, imaginary, 2);
- starpu_insert_task(&cl_display, STARPU_R, handle, 0);
- starpu_mpi_send(handle, 1, 10, MPI_COMM_WORLD);
- #warning todo: send data back and test equality
- }
- else if (rank == 1)
- {
- double real[2] = {0.0, 0.0};
- double imaginary[2] = {0.0, 0.0};
- starpu_data_handle_t handle;
- MPI_Status status;
- starpu_complex_data_register(&handle, 0, real, imaginary, 2);
- starpu_mpi_recv(handle, 0, 10, MPI_COMM_WORLD, &status);
- starpu_insert_task(&cl_display, STARPU_R, handle, 0);
- }
- }
- starpu_task_wait_for_all();
- starpu_mpi_shutdown();
- starpu_shutdown();
- return ret;
- }
|