mpi_cholesky.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009-2012 Université de Bordeaux
  4. * Copyright (C) 2010 Mehdi Juhoor <mjuhoor@gmail.com>
  5. * Copyright (C) 2010, 2011, 2012, 2013, 2015 CNRS
  6. *
  7. * StarPU is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as published by
  9. * the Free Software Foundation; either version 2.1 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * StarPU is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. *
  16. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. */
  18. #include "mpi_cholesky.h"
  19. int main(int argc, char **argv)
  20. {
  21. /* create a simple definite positive symetric matrix example
  22. *
  23. * Hilbert matrix : h(i,j) = 1/(i+j+1)
  24. * */
  25. float ***bmat;
  26. int rank, nodes, ret;
  27. double timing, flops;
  28. int correctness;
  29. ret = starpu_init(NULL);
  30. STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
  31. ret = starpu_mpi_init(&argc, &argv, 1);
  32. STARPU_CHECK_RETURN_VALUE(ret, "starpu_mpi_init");
  33. starpu_mpi_comm_rank(MPI_COMM_WORLD, &rank);
  34. starpu_mpi_comm_size(MPI_COMM_WORLD, &nodes);
  35. starpu_cublas_init();
  36. parse_args(argc, argv, nodes);
  37. matrix_init(&bmat, rank, nodes, 1);
  38. matrix_display(bmat, rank);
  39. dw_cholesky(bmat, size/nblocks, rank, nodes, &timing, &flops);
  40. starpu_mpi_shutdown();
  41. matrix_display(bmat, rank);
  42. dw_cholesky_check_computation(bmat, rank, nodes, &correctness, &flops);
  43. matrix_free(&bmat, rank, nodes, 1);
  44. starpu_cublas_shutdown();
  45. starpu_shutdown();
  46. assert(correctness);
  47. if (rank == 0)
  48. {
  49. FPRINTF(stdout, "Computation time (in ms): %2.2f\n", timing/1000);
  50. FPRINTF(stdout, "Synthetic GFlops : %2.2f\n", (flops/timing/1000.0f));
  51. }
  52. return 0;
  53. }