Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad flags for Fortran compiler #970

Closed
eschnett opened this issue Oct 18, 2013 · 15 comments
Closed

Bad flags for Fortran compiler #970

eschnett opened this issue Oct 18, 2013 · 15 comments
Assignees
Labels
category: CMake difficulty: easy Good issues for starting out with HPX development type: enhancement
Milestone

Comments

@eschnett
Copy link
Contributor

I added some Fortran code to my project. The Fortran compiler complains:

f951: warning: command line option ‘-Wsign-promo’ is valid for C++/ObjC++ but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wno-sync-nand’ is valid for C/C++ but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wno-delete-non-virtual-dtor’ is valid for C++/ObjC++ but not for Fortran [enabled by default]
f951: warning: command line option ‘-std=c++11’ is valid for C++/ObjC++ but not for Fortran [enabled by default]

I am using "add_hpx_executable" for building.

@ghost ghost assigned hkaiser Oct 18, 2013
@hkaiser
Copy link
Member

hkaiser commented Oct 18, 2013

add_hpx_executable has never been designed to build Fortran based executables (obviously). Not sure if we can do anything to suppress those warnings.

@brycelelbach
Copy link
Member

Do we even need to keep fortran support around anymore?

On 2013.10.18 11.15, Hartmut Kaiser wrote:

add_hpx_executable has never been designed to build Fortran based executables (obviously). Not sure if we can do anything to suppress those warnings.


Reply to this email directly or view it on GitHub:
#970 (comment)

Bryce Adelstein-Lelbach aka wash

STE||AR Group, Center for Computation and Technology, LSU

225-317-3866 - iPhone

225-578-6182 - Work (no voicemail)

stellar.cct.lsu.edu
boost-spirit.com
llvm.linuxfoundation.org

cppnow.org

@eschnett
Copy link
Contributor Author

In my case: Cactus supports Fortran. If we want to use HPX with Cactus, then there needs to be some official, supported way to make this happen. If add_hpx_executable is not that way, then e.g. using pkgconfig may work?

@brycelelbach
Copy link
Member

I'll try to set it up so that add_hpx_executable works with fortran

@brycelelbach
Copy link
Member

Ah, support for this already exists. Just add "LANGUAGE Fortran" to the add_hpx_executable statement.

@eschnett
Copy link
Contributor Author

That's what I did. This doesn't remove the warnings.

This is my CMakeLists.txt:

project(block_matrix)

cmake_minimum_required(VERSION 2.8)

enable_language(Fortran)

# Add HPX cmake configuration directory to the search path
# TODO: Use CMAKE setting instead of environment variable
set(CMAKE_MODULE_PATH $ENV{HPX_DIR}/share/cmake-2.8/Modules)

# Instruct cmake to find the HPX settings
find_package(HPX)

# BLAS
# TODO: Look for gsl_cblas.h as well
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  # On Darwin, use the Accelerate framework
  find_path(ACCELERATE_INCLUDE_DIR cblas.h)
  find_library(ACCELERATE_LIBRARY Accelerate)
elseif (${CMAKE_CXX_COMPILER} MATCHES "icpc")
  # If using the Intel compiler, use MKL
  # TODO: derive search path from icpc path
  set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -mkl)
  find_path(MKL_INCLUDE_DIR mkl_cblas.h)
  add_definitions(-DMKL_CBLAS)
else (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  # Else, use libblas.a
  find_path(CBLAS_INCLUDE_DIR cblas.h)
  find_library(CBLAS_LIBRARY blas)
endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
#add_definitions(-DCBLAS)

add_definitions(-DBLAS)

set(SOURCES algorithms.cc algorithms_fun.cc bench.cc block_matrix.cc hpxbench.cc
  hwloc.cc main.cc matrix.cc matrix_hpx.cc tensor.cc tests.cc
  daxpy.f dcopy.f dgemm.f dgemv.f dnrm2.f dscal.f xerbla.f)
#set(SOURCES simultaneous.cc)

add_definitions(-DHPX_ACTION_ARGUMENT_LIMIT=6)

include_directories(${ACCELERATE_INCLUDE_DIR} ${CBLAS_INCLUDE_DIR}
  ${MKL_INCLUDE_DIR} ${HPX_INCLUDE_DIR})
link_directories(${HPX_LIBRARY_DIR})

add_hpx_executable(block_matrix
  SOURCES ${SOURCES}
  COMPONENT_DEPENDENCIES iostreams
  DEPENDENCIES hwloc ${ACCELERATE_LIBRARY} ${CBLAS_LIBRARY})

@hkaiser
Copy link
Member

hkaiser commented Oct 20, 2013

Unrelated note:

set(CMAKE_MODULE_PATH $ENV{HPX_DIR}/share/cmake-2.8/Modules)

Please change your CMake file to use HPX_ROOT instead of HPX_DIR. That was probably caused by a documentation error which has been fixed in the meantime. Moreover, I'd suggest not to rely on environment setting, but that's a matter of choice and taste. CMake is not able to figure out whether an environment setting has been changed since last configured, so this might not pick up the latest settings.

@hkaiser
Copy link
Member

hkaiser commented Oct 20, 2013

What Bryce meant, was to write:

add_hpx_executable(block_matrix
    SOURCES ${SOURCES}
    COMPONENT_DEPENDENCIES iostreams
    DEPENDENCIES hwloc ${ACCELERATE_LIBRARY} ${CBLAS_LIBRARY}
    LANGUAGE Fortran)

@eschnett
Copy link
Contributor Author

I am using multiple languages, both C++ and Fortran. If I just add "LANGUAGE Fortran", then the C++ code doesn't build any more because "decltype" is not recognized. I assume that some vital C++ flags are then missing.

Would "LANGUAGES CXX Fortran" be the correct syntax? I found some code in "HPX_CompilerFlags.cmake" that suggests this, but I'm not sure whether "LANGUAGES" is recognized as keyword or just ignored.

@eschnett eschnett reopened this Oct 20, 2013
@eschnett
Copy link
Contributor Author

It seems that "LANGUAGES" is not recognized.

@hkaiser
Copy link
Member

hkaiser commented Oct 20, 2013

This:

add_hpx_executable(block_matrix
    SOURCES ${SOURCES}
    COMPONENT_DEPENDENCIES iostreams
    DEPENDENCIES hwloc ${ACCELERATE_LIBRARY} ${CBLAS_LIBRARY}
    LANGUAGE Fortran CXX)

should work, but I have not tried.

@eschnett
Copy link
Contributor Author

No, I tried this as well. This leads to

$ make
CMake Error at /Users/eschnett/hpx/share/hpx-0.9.7/cmake/HPX_AddExecutable.cmake:172 (if):
  if given arguments:

    "HPX_CXX" "Fortran_COMPILE_FLAGS"

  Unknown arguments specified

@hkaiser
Copy link
Member

hkaiser commented Oct 21, 2013

Yes, you're right. I checked the hpx_add_executable code. It supports specifying only one language and I'm not sure (as I said above) that we can make it work at all. CMake is very peculiar in the ways compile options can be specified.

@eschnett
Copy link
Contributor Author

Okay. If I can link via pkgconfig, then I don't need to use cmake.

@sithhell
Copy link
Member

sithhell commented Sep 3, 2014

This should be fixed by ecdb034. Please reopen if the problem still persists.

@sithhell sithhell closed this as completed Sep 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: CMake difficulty: easy Good issues for starting out with HPX development type: enhancement
Projects
None yet
Development

No branches or pull requests

4 participants