Ninja Fortran on XL

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

Ninja Fortran on XL

Ephi Sinowitz (BLOOMBERG/ 919 3RD A)
Trying to get this to work by setting a proper CMAKE_Fortran_PREPROCESS_SOURCE variable.

Here is GNU_Fortran for reference. 
set(CMAKE_Fortran_PREPROCESS_SOURCE
"<CMAKE_Fortran_COMPILER> -cpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> -o <PREPROCESSED_SOURCE>")

The analogous switch for -E in XL is -d -qnoobject. However, CMake expects the PREPROCESSED_SOURCE output to be in the form <SOURCE>-pp.f and XL does not allow you to control that. The output is always of the form F<SOURCE>.f

Is there anything I can do here like putting redirection or two commands inside the CMAKE_Fortran_PREPROCESS_SOURCE variable?

Here is a relevant snippet from the XL compiler documentation on this switch.

“To call cpp for a particular file, use a file suffix of .F, .F77, .F90, .F95, .F03, or .F08. If you specify the -d option, each .F* file filename.F* is preprocessed into an intermediate file Ffilename.f, which is then compiled. ... If you only want to preprocess and do not want to produce object or executable files, specify the -qnoobject option also.”

-ephi


--

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: Ninja Fortran on XL

Brad King
On 04/12/2018 08:22 AM, Ephi Sinowitz (BLOOMBERG/ 919 3RD A) wrote:
> CMake expects the PREPROCESSED_SOURCE output to be in the form
> <SOURCE>-pp.f and XL does not allow you to control that. The output> is always of the form F<SOURCE>.f
>
> Is there anything I can do here like putting redirection or two
> commands inside the CMAKE_Fortran_PREPROCESS_SOURCE variable?

One can put two commands, e.g. something like:

```
set(CMAKE_Fortran_PREPROCESS_SOURCE
   "<CMAKE_Fortran_COMPILER> ... -d -qnoobject <SOURCE>"
   "mv <WHEREVER_XL_PUTS_IT> <PREPROCESSED_SOURCE>"
    )
```

Filling in `<WHEREVER_XL_PUTS_IT>` may be difficult.  I've observed:

* `/path/to/foo.F`    ==>  `./Ffoo.f`
* `/path/to/foo.F90`  ==>  `./Ffoo.f90`

CMake would need to be taught to produce a `<PLACEHOLDER>`
for this value, and it would need to know the mapping that
xlf uses for extensions.

Does xlf have a way to control in what directory the file is placed?

-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: Ninja Fortran on XL

Ephi Sinowitz (BLOOMBERG/ 919 3RD A)
In reply to this post by Ephi Sinowitz (BLOOMBERG/ 919 3RD A)
Unfortunately there is no way I can see to control the output directory. It is always the current working directory.

From: [hidden email] At: 04/12/18 09:42:58
To: [hidden email], [hidden email]
Subject: Re: [CMake] Ninja Fortran on XL

On 04/12/2018 08:22 AM, Ephi Sinowitz (BLOOMBERG/ 919 3RD A) wrote:
> CMake expects the PREPROCESSED_SOURCE output to be in the form
> <SOURCE>-pp.f and XL does not allow you to control that. The output> is always of the form F<SOURCE>.f
>
> Is there anything I can do here like putting redirection or two
> commands inside the CMAKE_Fortran_PREPROCESS_SOURCE variable?

One can put two commands, e.g. something like:

```
set(CMAKE_Fortran_PREPROCESS_SOURCE
"<CMAKE_Fortran_COMPILER> ... -d -qnoobject <SOURCE>"
"mv <WHEREVER_XL_PUTS_IT> <PREPROCESSED_SOURCE>"
)
```

Filling in `<WHEREVER_XL_PUTS_IT>` may be difficult. I've observed:

* `/path/to/foo.F` ==> `./Ffoo.f`
* `/path/to/foo.F90` ==> `./Ffoo.f90`

CMake would need to be taught to produce a `<PLACEHOLDER>`
for this value, and it would need to know the mapping that
xlf uses for extensions.

Does xlf have a way to control in what directory the file is placed?

-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