How to detect different MAGMA flavors at compile time?
Posted: Mon Oct 07, 2019 10:53 am
Hello, I'm working to integrate MAGMA on my program (written in C++); I mainly have to use magma_zgeev().
I'm new to the library, but to my understanding magma_zgeev() takes different arguments based on the flavor: i.e. MAGMA's version sort of maps into the LAPACK prototype while clMAGMA's version takes an additional queue argument before the last argument. There are differences in function prototypes even between MAGMA v1 and MAGMA v2, e.g. magma_queue_create() takes two arguments in MAGMA v2 and clMAGMA but it takes only one argument in MAGMA v1.
My idea is to differentiate these cases at compile time via macros, e.g. define some macro MAGMA_FLAVOR_CLMAGMA if the user is compiling the code with clMAGMA, MAGMA_FLAVOR_MAGMA if he's compiling with regular MAGMA, etc. for other flavors; this would in principle enable my program to run on different machines with possibly different hardware and different MAGMA versions. I definitely don't want to do this differentiation at runtime.
I'm therefore looking for some flavor-specific MAGMA macro(s) that would allow me to make this distinction; for example, I can distinguish MAGMA v2 from clMAGMA by looking for the magma_queue_create_from_cuda macro, but in this way I cannot distinguish MAGMA v2 from MAGMA v1. Is there any safer / more stable way to do it?
I'm new to the library, but to my understanding magma_zgeev() takes different arguments based on the flavor: i.e. MAGMA's version sort of maps into the LAPACK prototype while clMAGMA's version takes an additional queue argument before the last argument. There are differences in function prototypes even between MAGMA v1 and MAGMA v2, e.g. magma_queue_create() takes two arguments in MAGMA v2 and clMAGMA but it takes only one argument in MAGMA v1.
My idea is to differentiate these cases at compile time via macros, e.g. define some macro MAGMA_FLAVOR_CLMAGMA if the user is compiling the code with clMAGMA, MAGMA_FLAVOR_MAGMA if he's compiling with regular MAGMA, etc. for other flavors; this would in principle enable my program to run on different machines with possibly different hardware and different MAGMA versions. I definitely don't want to do this differentiation at runtime.
I'm therefore looking for some flavor-specific MAGMA macro(s) that would allow me to make this distinction; for example, I can distinguish MAGMA v2 from clMAGMA by looking for the magma_queue_create_from_cuda macro, but in this way I cannot distinguish MAGMA v2 from MAGMA v1. Is there any safer / more stable way to do it?