I am wondering whether the code blow will trigger a temporary array allocation and data copying for array "ima". I compiled with "-check arg_tmp_created" and "-warn all" but did not get any message.
Program Test use blas95 !!mkl blas real(kind=8), allocatable :: rmb(:,:), rmc(:,:) integer(kind=2), allocatable :: ima(:,:) call gemm(A=real(imA,kind=8),B=RMB,C=RMc) End Program Test
Since the array passed can be of substantial size a temporary array may cause a massive overhead.
Any suggestions appreciated.
I think that in this case the temporary comes from the call to the intrinsic function real.
I do not think that the -check_arg_tmp_created can detect the temporaries created in these cases.
The flag seems to capture only the temporaries created as a result of passing a non-contiguous array to a procedure.
You've asked the compiler to create a copy of ima with the integers converted to reals. By what mechanism do you think it could avoid a copy? If there was a version of gemm that accepted integer for the type of the first array, then you wouldn't use the conversion.
The compiler knows how to do multiplication of reals by smallish integer constants in an efficient manner, but that doesn't work for variables.