Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28384 Discussions

Error message for /Qopt-matmul with /O2 without /Qparallel not meaningful

Johannes_Rieke
New Contributor III
509 Views

Hi,

I got an error in compiling a simple code under PSXE2016 update 1 and VS 2015 SP1:

program matmul_test
    use ISO_FORTRAN_ENV, only : rk => real64
    implicit none

    ! Variables
    integer                               :: i
    integer, parameter                    :: n = 2000
    real(rk)                              :: t0, t1
    real(rk), dimension(:,:), allocatable :: matrix_a, matrix_b, matrix_c

    ! Body of matmul
    print *, '--- Matmul error message test'
    
    allocate(matrix_a(n,n))
    allocate(matrix_b(n,n))
    allocate(matrix_c(n,n))
    
    ! some random values
    call random_seed()
    call random_number(matrix_a)
    call random_number(matrix_b)
    
    ! perform calculation
    call cpu_time(t0)
    matrix_c = matmul(matrix_a,matrix_b)
    call cpu_time(t1)
    write(*,'(a, f10.3)') ' Time for matmul        = ', t1-t0
end program matmul_test

The compiler options are:

/nologo /O2 /Qopt-matmul /module:"x64\Release\\" /object:"x64\Release\\" /Fd"x64\Release\vc140.pdb" /libs:dll /threads /c

This is the error message:

1>------ Build started: Project: matmul, Configuration: Release x64 ------
1>Compiling with Intel(R) Visual Fortran Compiler 16.0.1.146 [Intel(R) 64]...
1>matmul_test.f90
1>ifort: command line error: option '/Qopt-matmul' not supported
1>
1>Build log written to  "file://D:\02_Fortran\99_test\matmul\x64\Release\BuildLog.htm"
1>matmul - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Severity    Code    Description    Project    File    Line    Suppression State
Error        command line error: option '/Qopt-matmul' not supported        ifort   

This compile error does not lead to the conflict. '/Qopt-matmul' seems only to work if '/Qparallel' is also enabled or if /o3 is requested, which enables /Qparallel(?). The documentation does not give a hint on this. It is only said, that a minimum of /o2 is necessary to be considered.

'/Qopt-matmul=sequential' seems to be not supported anymore in PSXE 16 up1?

If I'm right with my observation, I would be happy, if the documentation and the error message would be updated.

Best regards, Johannes

 

0 Kudos
7 Replies
TimP
Honored Contributor III
509 Views

I confirmed this apparent documentation bug.  As the doc says:

/Qopt-matmul[-]
          replace matrix multiplication with calls to intrinsics and threading
          libraries for improved performance (DEFAULT at /O3 /Qparallel)

 

opt-matmul was included in O3 or Qparallel, in earlier ifort releases, but was available outside of those options.

Likewise, the combination /Qopt-matmul- -O3 was available, but is no longer.  This used to be the way to optimize matmul with in-line code for single thread. 

I had some difficulty saving your source file in a form readable by ifort, but succeeded eventually.  Generating asm files, I see no reference to the former external library support code for matmul.  So it does appear that opt-matmul has been retired without corresponding change in the documentation.

Qparallel now appears to be inserting calls to kmp threaded library without otherwise changing the generated code or invoking specific library support for matmul.

According to Qopt-report4, O3 now adds unroll-and-jam optimization and adds code targeted for sizes from 8 to 500 where the default targets 125.  O3 and Qparallel together target up to 2000.

opt-report says there is a vector math library call, even at default settings (but with QxHost), but I don't see it in the external references.

0 Kudos
Steven_L_Intel1
Employee
509 Views

It is true that /Qopt-matmul requires both O2 or higher and /Qparallel or /Qopenmp. The message the driver gives could be better. I will ask the documentation and the message to be improved. It has not been retired.

The optimizer decides whether or not to call the opt-matmul routine - I don't know what criteria it uses. However, I do know that the inline-generated code for MATMUL has improved over the years.

0 Kudos
Johannes_Rieke
New Contributor III
509 Views

Dear Tim, dear Steve,

many thanks for your replies.

@Steve Since /Qopt-matmul works only with /Qparallel or /Qopenmp, I assume the sequential option is obsolete in PSXE 16, which was an option in 15?

Regards, Johannes

0 Kudos
Steven_L_Intel1
Employee
509 Views

I am not seeing any sort of modifier for /Qopt-matmul in the 15.0 documentation, nor do I remember it ever having one. See https://software.intel.com/en-us/node/524953  Perhaps you are thinking of /Qmkl which does have a :sequential option.

The documentation does say:

This option is enabled by default if options O3 and parallel are specified. To disable this optimization, specify -qno-opt-matmul or /Qopt-matmul-.

This option has no effect unless option O2 or higher is set.

0 Kudos
Steven_L_Intel1
Employee
509 Views

I checked and found that the next major version no longer gives the error message if you leave off /Qparallel.

0 Kudos
Johannes_Rieke
New Contributor III
509 Views

Hi Steve,

thanks for the info. Good to know that this will give no compile error in the next major release.

You are right, I let me be confused with the /Qmkl=sequential option and I read this thread not completely (https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/540816), otherwise I had known that this ('/Qopt-matmul=sequential') was only an idea for an option from Jim and nothing what was, is and will be implemented.

Best regards, Johannes

0 Kudos
Johannes_Rieke
New Contributor III
509 Views

Hi all,

I'm happy to report, that PSXE 16 Update 3 solves this issue also. The combination of /O2, /Qopt-matmul and no parallelization nor OpenMP compiles now without errors, but don't expect a speed up.

Many thanks, Johannes

0 Kudos
Reply