cg.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  4. *
  5. * StarPU is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * StarPU is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. #ifndef __STARPU_EXAMPLE_CG_H__
  17. #define __STARPU_EXAMPLE_CG_H__
  18. #include <starpu.h>
  19. #include <math.h>
  20. #include <common/blas.h>
  21. #ifdef STARPU_USE_CUDA
  22. #include <cuda.h>
  23. #include <cublas.h>
  24. #endif
  25. #define DOUBLE
  26. #ifdef DOUBLE
  27. #define TYPE double
  28. #define GEMV STARPU_DGEMV
  29. #define DOT STARPU_DDOT
  30. #define AXPY STARPU_DAXPY
  31. #define SCAL STARPU_DSCAL
  32. #define cublasdot cublasDdot
  33. #define cublasscal cublasDscal
  34. #define cublasaxpy cublasDaxpy
  35. #define cublasgemv cublasDgemv
  36. #define cublasscal cublasDscal
  37. #else
  38. #define TYPE float
  39. #define GEMV STARPU_SGEMV
  40. #define DOT STARPU_SDOT
  41. #define AXPY STARPU_SAXPY
  42. #define SCAL STARPU_SSCAL
  43. #define cublasdot cublasSdot
  44. #define cublasscal cublasSscal
  45. #define cublasaxpy cublasSaxpy
  46. #define cublasgemv cublasSgemv
  47. #define cublasscal cublasSscal
  48. #endif
  49. #endif /* __STARPU_EXAMPLE_CG_H__ */