cholesky.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009, 2010 Université de Bordeaux
  4. * Copyright (C) 2010, 2011 CNRS
  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 __DW_CHOLESKY_H__
  18. #define __DW_CHOLESKY_H__
  19. #include <semaphore.h>
  20. #include <string.h>
  21. #include <math.h>
  22. #include <sys/time.h>
  23. #include <limits.h>
  24. #ifdef STARPU_USE_CUDA
  25. #include <cuda.h>
  26. #include <cuda_runtime.h>
  27. #include <cublas.h>
  28. #endif
  29. #include <common/blas.h>
  30. #include <starpu.h>
  31. #define NMAXBLOCKS 32
  32. #define BLOCKSIZE (size/nblocks)
  33. static unsigned size = 4*1024;
  34. static unsigned nblocks = 16;
  35. static unsigned nbigblocks = 8;
  36. static unsigned noprio = 0;
  37. static unsigned display = 0;
  38. static void __attribute__((unused)) parse_args(int argc, char **argv)
  39. {
  40. int i;
  41. for (i = 1; i < argc; i++) {
  42. if (strcmp(argv[i], "-size") == 0) {
  43. char *argptr;
  44. long int ret;
  45. ret = strtol(argv[++i], &argptr, 10);
  46. if (*argptr != '\0') {
  47. fprintf(stderr, "Invalid size %s, aborting \n", argv[i]);
  48. exit(EXIT_FAILURE);
  49. }
  50. if (ret == LONG_MIN || ret == LONG_MAX) {
  51. perror("strtol");
  52. exit(EXIT_FAILURE);
  53. }
  54. if (ret == 0) {
  55. fprintf(stderr, "0 is not a valid size\n");
  56. exit(EXIT_FAILURE);
  57. }
  58. size = ret;
  59. }
  60. if (strcmp(argv[i], "-nblocks") == 0) {
  61. char *argptr;
  62. nblocks = strtol(argv[++i], &argptr, 10);
  63. }
  64. if (strcmp(argv[i], "-nbigblocks") == 0) {
  65. char *argptr;
  66. nbigblocks = strtol(argv[++i], &argptr, 10);
  67. }
  68. if (strcmp(argv[i], "-no-prio") == 0) {
  69. noprio = 1;
  70. }
  71. if (strcmp(argv[i], "-display") == 0) {
  72. display = 1;
  73. }
  74. if (strcmp(argv[i], "-h") == 0) {
  75. printf("usage : %s [-display] [-size size] [-nblocks nblocks]\n", argv[0]);
  76. }
  77. }
  78. if (nblocks > size) nblocks = size;
  79. }
  80. #endif // __DW_CHOLESKY_H__