【发布时间】:2022-01-26 00:24:00
【问题描述】:
我正在尝试使用 Visual Studio Code 开发 Fortran MPI 程序。但是,虽然我可以很好地成功构建和运行它们,但如果我可以为 MPI(以及其他外部模块)使用智能感知/自动完成功能,这对我将非常有帮助。我的settings.json 中有/usr/lib/openmpi/(包含mpi_f08.mod)作为fortran.includePaths 的一部分。但是,当我 use mpi_f08 时,我从 VS Code Module "mpi_f08" not found in project 收到问题消息。这是一个最小的 CMake 构建示例:
! hello.f90
program hello
use mpi_f08
implicit none
integer :: ierror, nproc, my_rank
call MPI_Init()
call MPI_Comm_size(MPI_COMM_WORLD, nproc, ierror)
call MPI_Comm_rank(MPI_COMM_WORLD, my_rank, ierror)
print*, "hello from rank ", my_rank
call MPI_Finalize()
end program hello
# CMakeLists.txt
cmake_minimum_required(VERSION 3.12)
project(hello_mpi)
enable_language(Fortran)
find_package(MPI REQUIRED)
add_executable(hello_mpi hello.f90)
include_directories(${MPI_Fortran_INCLUDE_PATH})
target_link_libraries(hello_mpi PUBLIC ${MPI_Fortran_LIBRARIES})
我希望能够 (i) 摆脱警告/消息,更重要的是 (ii) 当我按下 CTRL+空格时启用来自 MPI 的建议,就像我从内部模块调用一样。
【问题讨论】:
-
这是英特尔 oneAPI?
-
我正在使用 gfortran(以及 VSCode 中的“现代 Fortran”扩展,虽然我不介意使用另一个)。
标签: visual-studio-code fortran mpi