integer - Is there a way to determine the size of BLAS IDAMAX function? -
i determine size of integer function idamax in blas fortran library. can either 4-bytes (i32lp64 model) or 8-bytes (ilp64).
knowing size can determine overall integer declaration (integer*4 or integer*8) in prebuild blas library.
the problem sizeof(*idamax_(&n, dx,&incx)) of program below returning 4, though expect 8 mkl-integer*8 blas.
any comments, please ?
#include <stdio.h> void main() { extern * idamax_(); // external fortran blas function idamax int n=2; int incx=1; //long n=2; long incx=1; double dx[2]; dx[0]=1.0; dx[1]=2.0; printf("sizeof(n)=%i\n",sizeof(n)); printf("sizeof(*idamax_(&n, dx, &incx))=%i\n",sizeof(*idamax_(&n, dx,&incx)) ); // still returns 4 !!! //printf("sizeof(idamax_(&n, dx, &incx))=%i\n",sizeof(idamax_(&n, dx, &incx)) ); // idamax call crashes wrong integer sizes - mkl, gnu ibblas.a ! same fortran idamax_(&n, dx, &incx); }
your code not determining function in blas fortran library. it's determining function declared with
extern * idamax_();
as did not specify return type of function, it's default int
, constant size of 4 on machines.
if want determine return type of mkl's blas function, thing need check header file. in ${mkl_root}/include/mkl_blas.h
can find
mkl_int idamax(const mkl_int *n, const double *x, const mkl_int *incx);
the return type mkl_int
, , size sizeof(mkl_int)
, determined on compile time. can find similar in ${mkl_root}/include/mkl_types.h
#ifdef mkl_ilp64 #ifndef mkl_int #define mkl_int mkl_int64 #endif #else #ifndef mkl_int #define mkl_int int #endif #endif
so size of mkl_int
depends on whether define mkl_ilp64
or not @ compile time.
Comments
Post a Comment