[cmake-developers] FeatureSummary and Fortran

2016-02-08 Thread Alin Marin Elena
Hi,

I was playing to day with FeatureSummary and Fortran and I discovered the two 
do not like each other too much . While MPI is obviously found in here... 
Feature summary claims it did not

-- The Fortran compiler identification is GNU 5.3.1
-- Check for working Fortran compiler: /usr/bin/gfortran
-- Check for working Fortran compiler: /usr/bin/gfortran  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/gfortran supports Fortran 90
-- Checking whether /usr/bin/gfortran supports Fortran 90 -- yes
-- Found MPI_Fortran: /opt/openmpi/gcc/1.10.1/lib64/libmpi_usempif08.so;/opt/
openmpi/gcc/1.10.1/lib64/libmpi_usempi_ignore_tkr.so;/opt/openmpi/gcc/1.10.1/
lib64/libmpi_mpifh.so;/opt/openmpi/gcc/1.10.1/lib64/libmpi.so  
-- 
-- The following REQUIRED packages have not been found:

 * MPI

CMake Error at /usr/share/cmake/Modules/FeatureSummary.cmake:556 (message):
  feature_summary() Error: REQUIRED package(s) are missing, aborting CMake
  run.
Call Stack (most recent call first):
  CMakeLists.txt:6 (feature_summary)


-- Configuring incomplete, errors occurred!
See also "/home/alin/playground/cmake/summary/build/CMakeFiles/
CMakeOutput.log".

if I replace Fortran as language with C all is fine as expected. (The same 
happens if I add C to the project)

A simple simple way to reproduce  is the following CMakeLists.txt 

project(testM Fortran)

cmake_minimum_required(VERSION 2.8)
include(FeatureSummary)
find_package(MPI REQUIRED)
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)


I see this on linux cmake  3.4.3
I wonder if this is a bug or a feature?


Regards,
Alin


-- 
Without Questions there are no Answers!
__
Dr. Alin Marin ELENA
http://alin.elena.space/
__

signature.asc
Description: This is a digitally signed message part.
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake-developers

[cmake-developers] CMAKE_Fortran_STANDARD

2015-08-11 Thread Alin Marin Elena
Hi,

Is possible to add something like CMAKE_Fortran_STANDARD on the same line with
CMAKE_CXX_STANDARD

Regards,
Alin



Without Questions there are no Answers!
__
Dr. Alin Marin ELENA
http://alin.elena.space/
__
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] FindMPI take 2

2014-12-11 Thread Alin Marin Elena
Hi Brad,




 0001-correctly-detect-MPI-linker-flags-for-Intel-MPI-mayb.patch

 Thanks.  That adds a block much like one above it.  Can the preceding
 block be modified to match both -Wl, and -Xlinker?  Something like:

 -string(REGEX MATCHALL (^| )-Wl,([^\ ]+|\[^\]+\) 
 MPI_ALL_LINK_FLAGS ${MPI_LINK_CMDLINE})
 +string(REGEX MATCHALL (^| )(-Wl,|-Xlinker )([^\ ]+|\[^\]+\) 
 MPI_ALL_LINK_FLAGS ${MPI_LINK_CMDLINE})

 may work (untested).
Indeed the merging of the two sections is the elegant decision... I
kept it in two separate blocks maybe due to my phobia for debugging
regexes.
I have attached a checked patch for linker. flags with the blocks merged.

 The check for whether the CMAKE_LANG_COMPILER is already a MPI
 compiler requires a try_compile.  Is there some other way to check
 to see if there is any chance before the full test?
I do not know the answer to this. When I did my changes I tried to
minimise them.


 Also I'm not sure we fully support using a MPI compiler as the main
 compiler.  I can't think of anything that definitely won't work, but
 we don't have nightly testing for the case.

 Generally I've viewed the MPI compiler interrogation to be much like
 using pkg-config or $pkg-config tools to get the info needed to use
 a package.  Once that is done then MPI should be treated like any
 other library.
Unfortunately MPI wrapper is abused as main compiler in some projects.
Practically my patch just checks for that. As it involves a pretty
active decision from the user, I think we shall be fine.

 The user should be able to specify MPI_lang_COMPILER explicitly.
 Perhaps it could be initialized by ENV{MPICC}, ENV{MPICXX}, and
 ENV{MPIFC} environment variables?  This selection is much like
 picking the primary compiler in the first place.
This will the the best situation but will involve changes to the
FindMPI module that may be above my station to do.

regards,
Alin
From 9a8b2c7e0e39bef0e3aad84c8f1ba7e3489ab262 Mon Sep 17 00:00:00 2001
From: Alin Marin Elena alinm.el...@gmail.com
Date: Thu, 11 Dec 2014 09:56:39 +
Subject: [PATCH 2/2] Linking flags correctly detected for intel compilers

---
 Modules/FindMPI.cmake | 13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 5f23c02..840b714 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -363,18 +363,7 @@ function (interrogate_mpi_compiler lang try_libs)
 endif()
 
 # Extract linker flags from the link command line
-string(REGEX MATCHALL (^| )-Wl,([^\ ]+|\[^\]+\) MPI_ALL_LINK_FLAGS ${MPI_LINK_CMDLINE})
-set(MPI_LINK_FLAGS_WORK)
-foreach(FLAG ${MPI_ALL_LINK_FLAGS})
-  if (MPI_LINK_FLAGS_WORK)
-set(MPI_LINK_FLAGS_WORK ${MPI_LINK_FLAGS_WORK} ${FLAG})
-  else()
-set(MPI_LINK_FLAGS_WORK ${FLAG})
-  endif()
-endforeach()
-
-# Extract linker flags from the link command line  Intel compilers.. others maybe
-string(REGEX MATCHALL (^| )-Xlinker ([^\ ]+|\[^\]+\) MPI_ALL_LINK_FLAGS ${MPI_LINK_CMDLINE})
+string(REGEX MATCHALL (^| )(-Wl,|-Xlinker )([^\ ]+|\[^\]+\) MPI_ALL_LINK_FLAGS ${MPI_LINK_CMDLINE})
 set(MPI_LINK_FLAGS_WORK)
 foreach(FLAG ${MPI_ALL_LINK_FLAGS})
   if (MPI_LINK_FLAGS_WORK)
-- 
2.2.0

-- 

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:
http://public.kitware.com/mailman/listinfo/cmake-developers

Re: [cmake-developers] FindMPI take 2

2014-12-11 Thread Alin Marin Elena
Hi Kelly
 I have been looking into this.  For my setup, I found it useful to compare 
 the CMAKE_LANG_COMPILER to the list of known mpi wrapper names and prepend 
 _MPI_${lang}_COMPILER_NAMES with CMAKE_LANG_COMPILER so that the remaining 
 logic in FindMPI.cmake chooses the user supplied compiler/mpi-wrapper over 
 any of the other choices.  Something like this:

 # append vendor-specific compilers to the list if we either don't know the 
 compiler id,
 # or if we know it matches the regular compiler.
 foreach (lang C CXX Fortran)
   foreach (id GNU Intel PGI XL)
 if (NOT CMAKE_${lang}_COMPILER_ID OR CMAKE_${lang}_COMPILER_ID STREQUAL 
 id)
   list(APPEND _MPI_${lang}_COMPILER_NAMES 
 ${_MPI_${id}_${lang}_COMPILER_NAMES})
 endif()
 unset(_MPI_${id}_${lang}_COMPILER_NAMES)# clean up the namespace here
   endforeach()

 +  # If cmake_$lang_compiler matches a known mpi compiler wrapper name,
 +  # prefer the provided value.
 +  get_filename_component( compiler_wo_path ${CMAKE_${lang}_COMPILER} NAME )
 +  set( ${lang}_compiler_is_mpiwrapper false )
 +  foreach( mpiwrapper ${_MPI_${lang}_COMPILER_NAMES} )
 +if( ${mpiwrapper} STREQUAL ${compiler_wo_path} )
 +  set( ${lang}_compiler_is_mpiwrapper true )
 +endif()
 +  endforeach()
 +  if( ${lang}_compiler_is_mpiwrapper )
 +list( REMOVE_ITEM _MPI_${lang}_COMPILER_NAMES ${compiler_wo_path} )
 +list( INSERT _MPI_${lang}_COMPILER_NAMES 0 ${compiler_wo_path} )
 +  endif()
 endforeach()

checked your patch and indeed works.

In addition to that I have noticed that in the interrogate function we
never check that we can actually generate a binary with the findings,
shall we have a try_mpi_compile at the end of interrogate function?

regards
Alin
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] FindMPI take 2

2014-12-11 Thread Alin Marin Elena
Hi KT,

 In general, I think this is a good idea because I have encountered situation 
 were the cmake compiler was a different flavor (intel, gnu, pgi, etc) than 
 the selected mpi compiler wrapper.  However, if the chosen mpi compiler 
 wrapper is the same as CMAKE_LANG_COMPILER, we don't need the try_compile 
 because cmake will have already verified that the CMAKE_LANG_COMPILER works.
The nornal test will not test any MPI feature...to be sure that
actually the wrapper is an MPI compiler we will need to test a MPI
test.

Also we need to add a test to see if the found mpi has mpi.mod and can
be used. This is a Fortran usage only.

Also I like Brad's suggestion on MPICCfriends.

regards,
Alin
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] FindOpenMP and gfortran

2014-11-21 Thread Alin Marin Elena
Hi,

I have applied the patch on top of the official rc2 tar ball, rebuild
the rpm and everything works as expected!

Thanks
Alin
Without Questions there are no Answers!
__
Dr. Alin Marin ELENA
http://alin.elenaworld.net/
__


On 20 November 2014 14:11, Brad King brad.k...@kitware.com wrote:
 On 11/20/2014 8:57 AM, Nils Gladitz wrote:
 Thanks, done.

 @Alin I hope you don't mind that I took the liberty :)

 Alin, the commit is here:

  FindOpenMP: Use fixed form Fortran test program
  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7d633ebf

 Please try it out so we know it fixes your use case.

 Thanks,
 -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:
http://public.kitware.com/mailman/listinfo/cmake-developers


[cmake-developers] FindOpenMP and gfortran

2014-11-18 Thread Alin Marin Elena
Dear All,

I tried today FindOpenMP from 3.1.0 rc2 and gfortran (4.8.3) both on a
opensuse box...

I had the surprise to get failure to find the openmp. After some
digging I have found the route causes.

1. gfortran thinks .F files are fixed form
a simple test CMakeLists.txt to show the issue

project(hello Fortran)
#set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/Utils)

find_package(OpenMP REQUIRED)


error::
Performing Fortran SOURCE FILE Test OpenMP_FLAG_DETECTED failed with
the following output:
Change Dir: /home/alin/playground/
testopenmpcmake/build-error/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/gmake cmTryCompileExec292643/fast
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec292643.dir/build.make
CMakeFiles/cmTryCompileExec292643.dir/build
gmake[1]: Entering directory
'/home/alin/playground/testopenmpcmake/build-error/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report
/home/alin/playground/testopenmpcmake/build-error/CMakeFiles/CMakeTmp/CMakeFiles
1
Building Fortran object CMakeFiles/cmTryCompileExec292643.dir/src.F.o
/usr/bin/gfortran   -DOpenMP_FLAG_DETECTED -fopenmp   -c
/home/alin/playground/testopenmpcmake/build-error/CMakeFiles/CMakeTmp/src.F
-o CMakeFiles/cmTryCompil
eExec292643.dir/src.F.o
/home/alin/playground/testopenmpcmake/build-error/CMakeFiles/CMakeTmp/src.F:2.1:

program test
1
Error: Non-numeric character in statement label at (1)
/home/alin/playground/testopenmpcmake/build-error/CMakeFiles/CMakeTmp/src.F:2.1:



more to follow.


I have found two workarounds each of them have pros and cons in which
I will not enter as I do not have a strong feeling for any of the
solutions.

1. change .F to .F90 in
CheckFortranSourceCompiles.cmake

2. the fortran test in FindOpenMP.cmake shall be provided in fixed
form (add 6 empty spaces in front of the character of each line)

the original bug/feature was introduced by this
https://www.cmake.org/Bug/view.php?id=14656history=1

regards,
Alin




Without Questions there are no Answers!
__
Dr. Alin Marin ELENA
http://alin.elenaworld.net/
__
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake-developers