CMake 3.11 Fortran submodule parallel compilation fails for a single target

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

CMake 3.11 Fortran submodule parallel compilation fails for a single target

Zaak Beekman
I thought that CMake had Fortran submodule support as of 3.8 or 3.10. However, when compiling a single library target with submodules in parallel on macOS with GFortran trunk (or GFortran 7.3) I get:

    f951: Fatal Error: Module file 'mylib.smod' has not been generated, either because the module does not contain a MODULE PROCEDURE or there is an error in the module.
    Compilation terminated

   make[2]: *** [src/MyLib/CMakeFiles/MyLib.dir/MyLib_implementation.f90.o] Error 1

So it seems that CMake is not generating a Makefile in such a way that it requires MyLib_interface.f90 containing the interface top level module mylib.mod to be processed/compiled *before* MyLib_interface.f90. Because of this, there is no mylib.mod file generated from MyLib_interface.f90 before MyLib_implementation.f90 is compiled.

Am I missing something? Is there a way to express this dependency in such a way that CMake will generate a make file that ensures the source files are processed in the correct order, even with `make -j`?

Thanks,
Zaak

Izaak "Zaak" Beekman

-------------------------------------------------------------------------------
HPC Scientist
ParaTools Inc.
1509 16th St, NW
Washington, DC 20036
mobile: <a href="tel:(917)%20797-3239" value="+19177973239" target="_blank">(917) 797-3239
-------------------------------------------------------------------------------

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: CMake 3.11 Fortran submodule parallel compilation fails for a single target

Brad King
On 04/11/2018 01:44 PM, Zaak Beekman wrote:
> I thought that CMake had Fortran submodule support as of 3.8 or 3.10.

CMake 3.7 added support to the Fortran dependency scanner to tolerate
the *syntax* of submodules.  Only the main modules are handled for
dependencies though.

Unfortunately we still don't support the actual `.smod` dependencies.
See also:

  https://gitlab.kitware.com/cmake/cmake/issues/17017

-Brad
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: CMake 3.11 Fortran submodule parallel compilation fails for a single target

Zaak Beekman
Just FYI. I found an OK work around in that issue.

On Thu, Apr 12, 2018 at 9:22 AM Brad King <[hidden email]> wrote:
On 04/11/2018 01:44 PM, Zaak Beekman wrote:
> I thought that CMake had Fortran submodule support as of 3.8 or 3.10.

CMake 3.7 added support to the Fortran dependency scanner to tolerate
the *syntax* of submodules.  Only the main modules are handled for
dependencies though.

Unfortunately we still don't support the actual `.smod` dependencies.
See also:

  https://gitlab.kitware.com/cmake/cmake/issues/17017

-Brad

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake