/* StarPU --- Runtime system for heterogeneous multicore architectures. * * Copyright (C) 2013-2020 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria * * StarPU is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or (at * your option) any later version. * * StarPU is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * See the GNU Lesser General Public License in COPYING.LGPL for more details. */ #include #include "helper.h" static starpu_pthread_mutex_t mutex = STARPU_PTHREAD_MUTEX_INITIALIZER; static starpu_pthread_cond_t cond = STARPU_PTHREAD_COND_INITIALIZER; void callback(void *arg) { unsigned *received = arg; STARPU_PTHREAD_MUTEX_LOCK(&mutex); *received = *received + 1; FPRINTF_MPI(stderr, "received = %u\n", *received); STARPU_PTHREAD_COND_SIGNAL(&cond); STARPU_PTHREAD_MUTEX_UNLOCK(&mutex); } int main(int argc, char **argv) { int ret, rank, size, sum; int value=0; starpu_data_handle_t *handles; int mpi_init; MPI_INIT_THREAD(&argc, &argv, MPI_THREAD_SERIALIZED, &mpi_init); ret = starpu_mpi_init_conf(&argc, &argv, mpi_init, MPI_COMM_WORLD, NULL); STARPU_CHECK_RETURN_VALUE(ret, "starpu_mpi_init_conf"); starpu_mpi_comm_rank(MPI_COMM_WORLD, &rank); starpu_mpi_comm_size(MPI_COMM_WORLD, &size); sum = ((size-1) * (size) / 2); if (rank == 0) { int src; int received = 1; handles = malloc(size * sizeof(starpu_data_handle_t)); for(src=1 ; src