mpi_cholesky.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009, 2010 Université de Bordeaux 1
  4. * Copyright (C) 2010, 2011, 2012 Centre National de la Recherche Scientifique
  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. #ifndef __MPI_CHOLESKY_H__
  18. #define __MPI_CHOLESKY_H__
  19. #include <string.h>
  20. #include <math.h>
  21. #include <sys/time.h>
  22. #ifdef STARPU_USE_CUDA
  23. #include <cuda.h>
  24. #include <cuda_runtime.h>
  25. #include <cublas.h>
  26. #endif
  27. #include <common/blas.h>
  28. #include <starpu.h>
  29. #define BLOCKSIZE (size/nblocks)
  30. static unsigned size = 4*1024;
  31. static unsigned nblocks = 16;
  32. static unsigned nbigblocks = 2;
  33. static unsigned noprio = 0;
  34. static unsigned display = 0;
  35. static unsigned dblockx = -1;
  36. static unsigned dblocky = -1;
  37. void chol_cpu_codelet_update_u11(void **, void *);
  38. void chol_cpu_codelet_update_u21(void **, void *);
  39. void chol_cpu_codelet_update_u22(void **, void *);
  40. #ifdef STARPU_USE_CUDA
  41. void chol_cublas_codelet_update_u11(void *descr[], void *_args);
  42. void chol_cublas_codelet_update_u21(void *descr[], void *_args);
  43. void chol_cublas_codelet_update_u22(void *descr[], void *_args);
  44. #endif
  45. static void __attribute__((unused)) parse_args(int argc, char **argv)
  46. {
  47. int i;
  48. for (i = 1; i < argc; i++)
  49. {
  50. if (strcmp(argv[i], "-size") == 0)
  51. {
  52. char *argptr;
  53. size = strtol(argv[++i], &argptr, 10);
  54. }
  55. if (strcmp(argv[i], "-dblockx") == 0)
  56. {
  57. char *argptr;
  58. dblockx = strtol(argv[++i], &argptr, 10);
  59. }
  60. if (strcmp(argv[i], "-dblocky") == 0)
  61. {
  62. char *argptr;
  63. dblocky = strtol(argv[++i], &argptr, 10);
  64. }
  65. if (strcmp(argv[i], "-nblocks") == 0)
  66. {
  67. char *argptr;
  68. nblocks = strtol(argv[++i], &argptr, 10);
  69. }
  70. if (strcmp(argv[i], "-nbigblocks") == 0)
  71. {
  72. char *argptr;
  73. nbigblocks = strtol(argv[++i], &argptr, 10);
  74. }
  75. if (strcmp(argv[i], "-no-prio") == 0)
  76. {
  77. noprio = 1;
  78. }
  79. if (strcmp(argv[i], "-display") == 0)
  80. {
  81. display = 1;
  82. }
  83. if (strcmp(argv[i], "-h") == 0)
  84. {
  85. printf("usage : %s [-display] [-size size] [-nblocks nblocks]\n", argv[0]);
  86. }
  87. }
  88. if (nblocks > size) nblocks = size;
  89. }
  90. #endif // __MPI_CHOLESKY_H__