Skip to content

Commit

Permalink
The macros to convert trans/notrans etc were not correct for use inline
Browse files Browse the repository at this point in the history
  • Loading branch information
abouteiller committed Aug 22, 2024
1 parent 5fa144b commit 3b5e2d3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 58 deletions.
44 changes: 15 additions & 29 deletions src/dplasmaaux_cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,40 +23,26 @@
#include <cublas_v2.h>
#endif /* !defined(CUBLAS_V2_H_) */

#define dplasma_cublas_side(side) \
assert( (side == dplasmaRight) || (side == dplasmaLeft) ); \
side = (side == dplasmaRight) ? CUBLAS_SIDE_RIGHT : CUBLAS_SIDE_LEFT;
#define dplasma_cublas_side(side) ( \
assert( (side == dplasmaRight) || (side == dplasmaLeft) ), \
side = (side == dplasmaRight) ? CUBLAS_SIDE_RIGHT : CUBLAS_SIDE_LEFT)

#define dplasma_cublas_diag(diag) ( \
assert( (diag == dplasmaNonUnit) || (diag == dplasmaUnit) ), \
diag = (diag == dplasmaNonUnit) ? CUBLAS_DIAG_NON_UNIT : CUBLAS_DIAG_UNIT)

#define dplasma_cublas_diag(diag) \
assert( (diag == dplasmaNonUnit) || (diag == dplasmaUnit) ); \
diag = (diag == dplasmaNonUnit) ? CUBLAS_DIAG_NON_UNIT : CUBLAS_DIAG_UNIT;

#define dplasma_cublas_fill(fill) \
assert( (fill == dplasmaLower) || (fill == dplasmaUpper) ); \
fill = (fill == dplasmaLower) ? CUBLAS_FILL_MODE_LOWER : CUBLAS_FILL_MODE_UPPER;
#define dplasma_cublas_fill(fill) ( \
assert( (fill == dplasmaLower) || (fill == dplasmaUpper) ), \
fill = (fill == dplasmaLower) ? CUBLAS_FILL_MODE_LOWER : CUBLAS_FILL_MODE_UPPER)

#if defined(PRECISION_z) || defined(PRECISION_c)
#define dplasma_cublas_op(trans) \
assert( (trans == dplasmaNoTrans) || (trans == dplasmaTrans) || (trans == dplasmaConjTrans) ); \
switch(trans){ \
case dplasmaNoTrans: \
trans = CUBLAS_OP_N; \
break; \
case dplasmaTrans: \
trans = CUBLAS_OP_T; \
break; \
case dplasmaConjTrans: \
trans = CUBLAS_OP_C; \
break; \
default: \
trans = CUBLAS_OP_N; \
break; \
}
#define dplasma_cublas_op(trans) ( \
assert( (trans == dplasmaNoTrans) || (trans == dplasmaTrans) || (trans == dplasmaConjTrans) ), \
trans = (trans == dplasmaConjTrans) ? CUBLAS_OP_C: (trans == dplasmaTrans) ? CUBLAS_OP_T : CUBLAS_OP_N)
#else
#define dplasma_cublas_op(trans) \
assert( (trans == dplasmaNoTrans) || (trans == dplasmaTrans) ); \
trans = (trans == dplasmaNoTrans) ? CUBLAS_OP_N : CUBLAS_OP_T;
#define dplasma_cublas_op(trans) ( \
assert( (trans == dplasmaNoTrans) || (trans == dplasmaTrans) ), \
trans = (trans == dplasmaNoTrans) ? CUBLAS_OP_N : CUBLAS_OP_T)
#endif /* PRECISION_z || PRECISION_c */

extern parsec_info_id_t dplasma_dtd_cuda_infoid;
Expand Down
44 changes: 15 additions & 29 deletions src/dplasmaaux_hip.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,40 +16,26 @@
#include <hipsolver/hipsolver.h>
#include <rocsolver/rocsolver.h>

#define dplasma_hipblas_side(side) \
assert( (side == dplasmaRight) || (side == dplasmaLeft) ); \
side = (side == dplasmaRight) ? HIPBLAS_SIDE_RIGHT : HIPBLAS_SIDE_LEFT;
#define dplasma_hipblas_side(side) ( \
assert( (side == dplasmaRight) || (side == dplasmaLeft) ), \
side = (side == dplasmaRight) ? HIPBLAS_SIDE_RIGHT : HIPBLAS_SIDE_LEFT)

#define dplasma_hipblas_diag(diag) ( \
assert( (diag == dplasmaNonUnit) || (diag == dplasmaUnit) ), \
diag = (diag == dplasmaNonUnit) ? HIPBLAS_DIAG_NON_UNIT : HIPBLAS_DIAG_UNIT)

#define dplasma_hipblas_diag(diag) \
assert( (diag == dplasmaNonUnit) || (diag == dplasmaUnit) ); \
diag = (diag == dplasmaNonUnit) ? HIPBLAS_DIAG_NON_UNIT : HIPBLAS_DIAG_UNIT;

#define dplasma_hipblas_fill(fill) \
assert( (fill == dplasmaLower) || (fill == dplasmaUpper) ); \
fill = (fill == dplasmaLower) ? HIPBLAS_FILL_MODE_LOWER : HIPBLAS_FILL_MODE_UPPER;
#define dplasma_hipblas_fill(fill) ( \
assert( (fill == dplasmaLower) || (fill == dplasmaUpper) ), \
fill = (fill == dplasmaLower) ? HIPBLAS_FILL_MODE_LOWER : HIPBLAS_FILL_MODE_UPPER)

#if defined(PRECISION_z) || defined(PRECISION_c)
#define dplasma_hipblas_op(trans) \
assert( (trans == dplasmaNoTrans) || (trans == dplasmaTrans) || (trans == dplasmaConjTrans) ); \
switch(trans){ \
case dplasmaNoTrans: \
trans = HIPBLAS_OP_N; \
break; \
case dplasmaTrans: \
trans = HIPBLAS_OP_T; \
break; \
case dplasmaConjTrans: \
trans = HIPBLAS_OP_C; \
break; \
default: \
trans = HIPBLAS_OP_N; \
break; \
}
#define dplasma_hipblas_op(trans) ( \
assert( (trans == dplasmaNoTrans) || (trans == dplasmaTrans) || (trans == dplasmaConjTrans) ), \
trans = (trans == dplasmaConjTrans) ? HIPBLAS_OP_C: (trans == dplasmaTrans) ? HIPBLAS_OP_T : HIPBLAS_OP_N)
#else
#define dplasma_hipblas_op(trans) \
assert( (trans == dplasmaNoTrans) || (trans == dplasmaTrans) ); \
trans = (trans == dplasmaNoTrans) ? HIPBLAS_OP_N : HIPBLAS_OP_T;
#define dplasma_hipblas_op(trans) ( \
assert( (trans == dplasmaNoTrans) || (trans == dplasmaTrans) ), \
trans = (trans == dplasmaNoTrans) ? HIPBLAS_OP_N : HIPBLAS_OP_T)
#endif /* PRECISION_z || PRECISION_c */

extern parsec_info_id_t dplasma_dtd_hip_infoid;
Expand Down

0 comments on commit 3b5e2d3

Please sign in to comment.