1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- /* 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 <starpu_mpi.h>
- #include "helper.h"
- #include <starpu_mpi_checkpoint.h>
- #define ARRAY_SIZE 12
- int main(int argc, char* argv[])
- {
- starpu_data_handle_t h;
- starpu_data_handle_t h_array[ARRAY_SIZE];
- starpu_mpi_checkpoint_template cp_template;
- int val = 42;
- int val2 = 1234;
- int array[ARRAY_SIZE];
- int ret;
- struct starpu_conf conf;
- //init array
- for (int i=0 ; i<ARRAY_SIZE ; i++)
- {
- array[i] = i*1111+42;
- }
- for (int i=0 ; i<ARRAY_SIZE ; i++)
- {
- h_array[i] = NULL;
- }
- starpu_conf_init(&conf);
- conf.nmic = 0;
- conf.nmpi_ms = 0;
- ret = starpu_init(&conf);
- if (STARPU_UNLIKELY(ret == -ENODEV))
- {
- return 77;
- }
- STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
- if (starpu_cpu_worker_get_count() < 1)
- {
- FPRINTF(stderr, "This application requires at least 1 cpu worker\n");
- starpu_shutdown();
- return 77;
- }
- starpu_variable_data_register(&h, STARPU_MAIN_RAM, (uintptr_t)&val2, sizeof(int));
- starpu_vector_data_register(h_array, STARPU_MAIN_RAM, (uintptr_t)array, ARRAY_SIZE, sizeof(int));
- for (int i=0 ; i<ARRAY_SIZE ; i++) {
- starpu_variable_data_register(&h_array[i], STARPU_MAIN_RAM, (uintptr_t)&array[i], sizeof(int));
- }
- starpu_mpi_checkpoint_template_register(&cp_template,
- STARPU_VALUE, &val, sizeof(int), 1,
- STARPU_DATA_ARRAY, h_array, ARRAY_SIZE, 1,
- STARPU_R, &h, 1,
- 0);
- _starpu_mpi_checkpoint_template_print(cp_template);
- return 0;
- }
|