mpi_decomposition_params.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2013,2015-2017 CNRS
  4. * Copyright (C) 2009,2010,2014-2017,2020 Université de Bordeaux
  5. *
  6. * StarPU is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as published by
  8. * the Free Software Foundation; either version 2.1 of the License, or (at
  9. * your option) any later version.
  10. *
  11. * StarPU is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. *
  15. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. */
  17. #include "mpi_cholesky.h"
  18. #include <string.h>
  19. #include <stdlib.h>
  20. #include <stdio.h>
  21. #include <math.h>
  22. #ifdef STARPU_QUICK_CHECK
  23. unsigned size = 2*320;
  24. unsigned nblocks = 2;
  25. unsigned nbigblocks = 2;
  26. #elif !defined(STARPU_LONG_CHECK)
  27. unsigned size = 4*320;
  28. unsigned nblocks = 4;
  29. unsigned nbigblocks = 2;
  30. #else
  31. unsigned size = 16*320;
  32. unsigned nblocks = 16;
  33. unsigned nbigblocks = 2;
  34. #endif
  35. unsigned noprio = 0;
  36. unsigned check = 0;
  37. unsigned display = 0;
  38. int dblockx = -1;
  39. int dblocky = -1;
  40. void parse_args(int argc, char **argv, int nodes)
  41. {
  42. int i;
  43. for (i = 1; i < argc; i++)
  44. {
  45. if (strcmp(argv[i], "-size") == 0)
  46. {
  47. char *argptr;
  48. size = strtol(argv[++i], &argptr, 10);
  49. }
  50. if (strcmp(argv[i], "-dblockx") == 0)
  51. {
  52. char *argptr;
  53. dblockx = strtol(argv[++i], &argptr, 10);
  54. }
  55. if (strcmp(argv[i], "-dblocky") == 0)
  56. {
  57. char *argptr;
  58. dblocky = strtol(argv[++i], &argptr, 10);
  59. }
  60. if (strcmp(argv[i], "-nblocks") == 0)
  61. {
  62. char *argptr;
  63. nblocks = strtol(argv[++i], &argptr, 10);
  64. }
  65. if (strcmp(argv[i], "-nbigblocks") == 0)
  66. {
  67. char *argptr;
  68. nbigblocks = strtol(argv[++i], &argptr, 10);
  69. }
  70. if (strcmp(argv[i], "-no-prio") == 0)
  71. {
  72. noprio = 1;
  73. }
  74. if (strcmp(argv[i], "-check") == 0)
  75. {
  76. check = 1;
  77. }
  78. if (strcmp(argv[i], "-display") == 0)
  79. {
  80. display = 1;
  81. }
  82. if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
  83. {
  84. printf("usage : %s [-size size] [-nblocks nblocks] [-no-prio] [-display] [-check]\n", argv[0]);
  85. }
  86. }
  87. if (nblocks > size)
  88. nblocks = size;
  89. if (dblockx == -1 || dblocky == -1)
  90. {
  91. int factor;
  92. dblockx = nodes;
  93. dblocky = 1;
  94. for(factor=sqrt(nodes) ; factor>1 ; factor--)
  95. {
  96. if (nodes % factor == 0)
  97. {
  98. dblockx = nodes/factor;
  99. dblocky = factor;
  100. break;
  101. }
  102. }
  103. }
  104. FPRINTF(stdout, "size: %u - nblocks: %u - dblocksx: %d - dblocksy: %d\n", size, nblocks, dblockx, dblocky);
  105. }