Running a C++ Program with CMake, MPI and OpenCV

75 views Asked by At

I am currently writing a C++ program using MPI and OpenCV, and I am having trouble executing the program.

When I build it using the CLion's Compiler (These) and run it, it seems to be working fine.

Compiling

Success Image

However, when I compile it using cmake . && make, and run using mpirun, I am unable to execute the code. It is not giving me any output at all, or is giving me a path error. Error Image

I require this to set the number of processors that MPI should use

I am unsure of how to fix this, any help will be appreciated.

CMake File :

cmake_minimum_required(VERSION 3.27)
project(HPC_Project)

set(CMAKE_CXX_STANDARD 20)

find_package(MPI REQUIRED)
find_package(OpenCV REQUIRED)

include_directories("/opt/homebrew/Cellar/opencv/4.9.0_5/include/opencv4")
link_directories("/opt/homebrew/Cellar/opencv/4.9.0_5/include/opencv4")

add_executable(HPC_Project main.cpp
        utils/filter_functions.h
        utils/filter_functions.cpp
        utils/display_functions.h
        utils/display_functions.cpp
        utils/serial_codes.h
        utils/serial_codes.cpp
        utils/parallel_dependent_codes.h
        utils/parallel_dependent_codes.cpp
        utils/parallel_independent_codes.h
        utils/parallel_independent_codes.cpp
        trial.cpp
        trial.h)


target_link_libraries(HPC_Project PRIVATE MPI::MPI_CXX ${MPI_LIBRARIES} ${OpenCV_LIBS})
#OpenCV::core OpenCV::imgproc OpenCV::highgui

I have tried several methods to build and run the program, but nothing seems to be working

0

There are 0 answers