我试图在catkin环境中使用openMP支持编译OpenNN。我没有成功地编译它,但是我意识到我的代码是在一个线程中执行的。
我的CMakeLists.txt是:
cmake_minimum_required(VERSION 2.8.3)
project(opennn)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED
)
## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)
find_package(Eigen3 REQUIRED)
find_package(OpenMP)
if(OPENMP_FOUND)
message (STATUS “OpenMP found ${OpenMP_INCLUDE_DIRS}”)
set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}”)
set(CMAKE_C_FLAGS “${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}” )
else(OPENMP_FOUND)
message (STATUS “OpenMP not found”)
endif()
###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
INCLUDE_DIRS src
LIBRARIES opennn
# CATKIN_DEPENDS other_catkin_pkg
# DEPENDS system_lib
)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(include
${Eigen_INCLUDE_DIRS}
/usr/include/eigen3
)
## Declare a C++ library
add_library(opennn
src/${PROJECT_NAME}/variables.cpp
src/${PROJECT_NAME}/instances.cpp
src/${PROJECT_NAME}/missing_values.cpp
src/${PROJECT_NAME}/data_set.cpp
src/${PROJECT_NAME}/plug_in.cpp
src/${PROJECT_NAME}/ordinary_differential_equations.cpp
src/${PROJECT_NAME}/mathematical_model.cpp
src/${PROJECT_NAME}/inputs.cpp
src/${PROJECT_NAME}/outputs.cpp
src/${PROJECT_NAME}/unscaling_layer.cpp
src/${PROJECT_NAME}/scaling_layer.cpp
src/${PROJECT_NAME}/probabilistic_layer.cpp
src/${PROJECT_NAME}/perceptron_layer.cpp
src/${PROJECT_NAME}/perceptron.cpp
src/${PROJECT_NAME}/neural_network.cpp
src/${PROJECT_NAME}/multilayer_perceptron.cpp
src/${PROJECT_NAME}/independent_parameters.cpp
src/${PROJECT_NAME}/conditions_layer.cpp
src/${PROJECT_NAME}/bounding_layer.cpp
src/${PROJECT_NAME}/sum_squared_error.cpp
src/${PROJECT_NAME}/solutions_error.cpp
src/${PROJECT_NAME}/root_mean_squared_error.cpp
src/${PROJECT_NAME}/performance_term.cpp
src/${PROJECT_NAME}/performance_functional.cpp
src/${PROJECT_NAME}/outputs_integrals.cpp
src/${PROJECT_NAME}/normalized_squared_error.cpp
src/${PROJECT_NAME}/neural_parameters_norm.cpp
src/${PROJECT_NAME}/minkowski_error.cpp
src/${PROJECT_NAME}/mean_squared_error.cpp
src/${PROJECT_NAME}/inverse_sum_squared_error.cpp
src/${PROJECT_NAME}/independent_parameters_error.cpp
src/${PROJECT_NAME}/final_solutions_error.cpp
src/${PROJECT_NAME}/cross_entropy_error.cpp
src/${PROJECT_NAME}/training_strategy.cpp
src/${PROJECT_NAME}/training_algorithm.cpp
src/${PROJECT_NAME}/training_rate_algorithm.cpp
src/${PROJECT_NAME}/random_search.cpp
src/${PROJECT_NAME}/quasi_newton_method.cpp
src/${PROJECT_NAME}/newton_method.cpp
src/${PROJECT_NAME}/levenberg_marquardt_algorithm.cpp
src/${PROJECT_NAME}/gradient_descent.cpp
src/${PROJECT_NAME}/evolutionary_algorithm.cpp
src/${PROJECT_NAME}/conjugate_gradient.cpp
src/${PROJECT_NAME}/testing_analysis.cpp
src/${PROJECT_NAME}/model_selection.cpp
src/${PROJECT_NAME}/numerical_integration.cpp
src/${PROJECT_NAME}/numerical_differentiation.cpp
src/${PROJECT_NAME}/tinyxml2.cpp
)
target_link_libraries(opennn ${Eigen_LIBRARIES})
这会在编译时抛出以下错误:
Building CXX object opennn/CMakeFiles/opennn.dir/src/opennn/missing_values.cpp.o
Building CXX object opennn/CMakeFiles/opennn.dir/src/opennn/data_set.cpp.o
c++: error: “: No such file or directory
[ 14%] c++: fatal error: no input files
compilation terminated.
/bin/sh: 1: -fopenmp”: not found
c++: error: “: No such file or directory
make[2]: *** [opennn/CMakeFiles/opennn.dir/src/opennn/missing_values.cpp.o] Error 127
make[2]: *** Waiting for unfinished jobs....
c++: fatal error: no input files
compilation terminated.