- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I was trying to replace the matmul by the blas subroutine ZGEMM to do to following operation :
Mat_Inter = transpose(Matrice1)*Matrice2
MatProduit = Mat_Inter*Matrice3
I wrote :
CALL ZGEMM('T','N',NbreCol_mat1,NbreLig_mat3,NbreLig_mat1,alpha,Matrice1,NbreLig_mat1,Matrice2,NbreLig_mat1,beta,Mat_Inter,NbreCol_mat1)
CALL ZGEMM('N','N',NbreCol_mat1,NbreCol_mat3,NbreLig_mat3,alpha,Mat_Inter,NbreCol_mat1,Matrice3,NbreLig_mat3,beta,MatProduit,NbreCol_mat1)
I checked very well the sizes of the matrixes and I followed the description of the parameters of ZGEMM. Even though, I obtained the following error for the two lines.
MKL Error : parameter 3 was incorrect on entry to zgemm
For example with the first line : With TRANSA = 'T' and With TRANSA = 'N', NbreCol_mat1 = 48, NbreLig_mat3=480, NbreLig_mat1= 480, Alpha = 1., Matrice1(480,48),NbreLig_mat1 = 480, Matrice2(480,48),beta =0,Mat_inter(48,480).
Can anybody please give me an explanation for this error?
Thanks
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't know whether anyone could give you more of an explanation than what you will see by reading the open xource zgemm.f (this means a negative value was passed in). It could be due to various bugs, including mixing ilp64 (64-bit integer) and lp64 (32-bit integer) argument types.
One would hope that INCLUDE 'mkl.fi' would help catch some data type inconsistencies.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It may be possible to answer your question after seeing the declarations/allocation statements for the matrices and the values for the m,n,k arguments (args. 3, 4 and 5).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I added INCLUDE 'mkl.fi' in the begenning of my code, the error still the same. For the allocation statements, I wrote : Allocate(Matrice1(NbreLig_mat1,NbreCol_mat1)); Allocate(Matrice2(NbreLig_mat1,NbreLig_mat3)); Allocate(Matrice3(NbreLig_mat3,NbreCol_mat3))
And As I saied before? FOR THE FIRST zgemm instruction: the arguments m, n and k correspond to : NbreCol_mat1 = 48, NbreLig_mat3=480, NbreLig_mat1= 480. The first matrix operation is 'T' and the second matrix operation is 'N'.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I replaced the statement causing the error by : CALL ZGEMM('T','N',48,480,480,alpha,Matrice1,480,Matrice2,480,beta,Mat_Inter2,48) and bizarrely, I haven't the same error ! the values are exactely the same! Can anybody please has an explanation ? Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you use IMPLICIT NONE in your code?
Or have you built using /warn:declarations ?
It's possible that something was misspelled.
--Lorri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you use IMPLICIT NONE in your code?
Or have you built using /warn:declarations ?
It's possible that something was misspelled.
--Lorri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes I use IMPLICIT NONE at the begenning of my code and while importing the librabries (in the project properties), I checked that I'm importing the ilp64 libraries to avoid mixing argument types .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ines wrote:
I replaced the statement causing the error by : CALL ZGEMM('T','N',48,480,480,alpha,Matrice1,480,Matrice2,480,beta,Mat_Inter2,48) and bizarrely, I haven't the same error ! the values are exactely the same! Can anybody please has an explanation ?
There is nothing "bizarre" here -you probably have mismatched integer arguments. Literal integers would be passed as 8-byte integers (by reference) if you compiled using the /4I8 option. On the other hand, integer variables declared with KIND=4 (or with INTEGER*4) would be passed as 4-byte integers, leading to a mismatch with the expected arguments in the ILP-64 library routine.
A definite diagnosis can be made only if you cooperate and show the declarations of the variables in the call to ZGEMM. In particular, what are the types of NbreCol_mat1,NbreLig_mat3,NbreLig_mat1? Even better, make up a small and complete test program to reproduce the problem and post it along with the build commands (or a makefile).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have declared my integers simply as follow : INTEGER :: taille1, NbreLig_mat1, NbreCol_mat1, taille3, NbreLig_mat3, NbreCol_mat3
I'm running my code with the Intel® Visual Fortran Compiler for Windows*, I don't use a makefile. I will maybe try to run it in linux and see if it gives the same problems.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Inez wrote:We have to contend with the fact that the Intel compiler has nearly a thousand options, many of which could potentially have a bearing on the problem described in this thread. That is why we ask for a test example. If that example fails to show the problem, we would ask for more particulars such as OS version, compiler version, compiler options used, and so on.
I'm running my code with the Intel® Visual Fortran Compiler for Windows
Please note that simply stating that you use the Intel compiler provides hardly enough information to pin down the causes of the problem. When a problem cannot be reproduced (especially if given a mere paraphrasing), it is quite likely that the problem will remain unresolved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I runned the same code in Linux and I haven't actually any problem, it works pretty good and gives excellent results !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ines F - The key question here is "Do you understand why it 'works' in your Linux setup?"
Did you understand what was being said about the data size of the various arguments you were passing *to* ZGEMM and the data size of the dummy arguments that are expected *by* ZGEMM?
You should really look at ZGEMM and see the list of dummy arguments, make a note of the data size (default integer, or integer*8 or integer*2 and so on) each one should be. Then you need to look at your code that calls ZGEMM and see what is the data size of each actual argument you are passing.
The error you reported indicated that you have a mismatch in data size between a variable (or variables) in your code in the call to ZGEMM and ZGEMM itself.
Les

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page