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

Dependency Generation from Compiler

Frank_Illenseer
Beginner
816 Views

Hi,

I would like to generate a list of dependencies for MAKE from the source file in Fortran. From the INtel Fortran Help, I got the "-gen-dep" (or /QMMD) option, but this does not seem to work as I expect it to work...

Assume the following source file "class_a.F90":

module class_a

  use interface_b, only: i_configuration_type

  implicit none

  private
  public :: configuration_type

  type, extends(i_configuration_type) :: configuration_type
    logical :: use_is_calculated = .false.
  contains
    procedure :: is_calculated
  end type configuration_type

contains

  function is_calculated(this)
    implicit none

    class(configuration_type), intent(in) :: this
    logical :: is_calculated

    is_calculated = this%use_is_calculated

    return
  end function is_calculated

end module class_a

If I then run the following command on that file

ifort /QMMD /syntax-only class_a.F90

I get a (partial) "class_a.d" file

class_a.obj : \
  class_a.F90 INTERFACE_CONFIGURATION_TYPE

and a bunch of errors

Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.2.180 Build 20160204
Copyright (C) 1985-2016 Intel Corporation.  All rights reserved.

class_a.F90(3): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [INTERFACE_B]
  use interface_b, only: i_configuration_type
------^
class_a.F90(10): error #6406: Conflicting attributes or multiple declaration of name.   [I_CONFIGURATION_TYPE]
  type, extends(i_configuration_type) :: configuration_type
----------------^
class_a.F90(3): error #6580: Name in only-list does not exist.   [I_CONFIGURATION_TYPE]
  use interface_b, only: i_configuration_type
-------------------------^

I would expect the compiler to just output the dependency for "i_configuration_type.mod" into the ".d" file.

Or how is this feature of dependency generation from the compiler to be used? - I must somehow be able to run the dependency generation on the source files before the actual compilation happens to get the full list of (first order) dependencies and then include this in MAKE such that this then knows in which order to build which files.

Thanks and best regards,

Frank
 

0 Kudos
6 Replies
Steven_L_Intel1
Employee
816 Views

The idea of -gen-dep is to create a set of text pieces which can be incorporated into a makefile. You'll need to ignore compile errors from the pass that generates the dependencies.

0 Kudos
Frank_Illenseer
Beginner
816 Views
Hi Steve and thank you for your info. I understood it the way you tell me, i.e. that I get pieces to be included in makefiles. However, if you look at what is put in the .d file above, then the first part is ok and expected, but the all uppercase part does not make sense in my opinion. It should be
class_a.obj : \
  class_a.F90 interface_configuration_type.mod
in my opinion, or did I miss anything? (Sure then just ignoring the compiler error)
0 Kudos
Steven_L_Intel1
Employee
816 Views

Ah, I see. Yes, you're right - this behavior is incorrect. I will let the developers know.  Thanks. Issue ID is DPD200409380.

0 Kudos
Frank_Illenseer
Beginner
816 Views

Thank you, Steve, for logging it as defect. - Should I do anything further now? (I also have Intel Premier login, should I also file there?) - Will you then log here, once fixed? - Is there any time estimate?

Thanks and best regards,
Frank

0 Kudos
Steven_L_Intel1
Employee
816 Views

You don't need to do anything more - I will update this thread when there is news. I can't predict when this will get fixed, though it seems likely to me that it will get done before the final release of the "2017" product later this year.

The issue occurs when there is no .mod file for the module. A possible workaround is to create a temporary Visual Studio project, add all the sources and do a build with /gen-dep specified. The VS integration knows how to do the order right and you'll get the dependency info. Then you can take that and do what you want with it.

0 Kudos
Steven_L_Intel1
Employee
816 Views

This will be fixed for the 2017 "product" release later this year.

0 Kudos
Reply