Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Fortran并行程序无法编译_Fortran_Fortran Coarrays - Fatal编程技术网

Fortran并行程序无法编译

Fortran并行程序无法编译,fortran,fortran-coarrays,Fortran,Fortran Coarrays,我正在尝试编译一个Coarray-Fortran文件的示例。 compile的命令是: mpifort diffusion/diffusion-coarray.f90 -fcoarray=lib -o diffusion/diffusion-coarray -L ${PATH_TO_OPENCOARRAY_LIB} -lcaf_mpi 我已经使用spack 但有一个错误: /usr/bin/ld: cannot find -lcaf_mpi collect2: error: ld return

我正在尝试编译一个Coarray-Fortran文件的示例。 compile的命令是:

mpifort diffusion/diffusion-coarray.f90 -fcoarray=lib -o diffusion/diffusion-coarray -L ${PATH_TO_OPENCOARRAY_LIB} -lcaf_mpi
我已经使用
spack
但有一个错误:

/usr/bin/ld: cannot find -lcaf_mpi
collect2: error: ld returned 1 exit status
没有
-lcaf\u mpi
时,错误为:

/tmp/ccOdrmfc.o: In function `MAIN__':
diffusion-coarray.f90:(.text+0x32): undefined reference to `_gfortran_caf_num_images'
diffusion-coarray.f90:(.text+0x4c): undefined reference to `_gfortran_caf_this_image'
diffusion-coarray.f90:(.text+0x66): undefined reference to `_gfortran_caf_this_image'
diffusion-coarray.f90:(.text+0x77): undefined reference to `_gfortran_caf_num_images'
diffusion-coarray.f90:(.text+0x8a): undefined reference to `_gfortran_caf_num_images'
diffusion-coarray.f90:(.text+0xaa): undefined reference to `_gfortran_caf_this_image'
diffusion-coarray.f90:(.text+0xbd): undefined reference to `_gfortran_caf_this_image'
diffusion-coarray.f90:(.text+0xf4): undefined reference to `_gfortran_caf_num_images'
结束等等。
问题出在哪里?

谢谢您的帮助。我已经解决了这个问题。如果有人感兴趣,以下是我的解决方案: 1.按照说明安装Linuxbrew:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"

test -d ~/.linuxbrew && PATH="$HOME/.linuxbrew/bin:$HOME/.linuxbrew/sbin:$PATH"
test -d /home/linuxbrew/.linuxbrew && PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH"
test -r ~/.bash_profile && echo "export PATH='$(brew --prefix)/bin:$(brew --prefix)/sbin'":'"$PATH"' >>~/.bash_profile
echo "export PATH='$(brew --prefix)/bin:$(brew --prefix)/sbin'":'"$PATH"' >>~/.profile
  • 安装OpenCoArray库
    brew安装OpenCoArray
    现在我们可以使用
    caf
    cafrun
  • 编译.exe文件
    caf fname.f90-o test.exe
  • 运行程序
    cafrun-np(numimages)test.exe
  • 希望它能对某人有所帮助!
    另外,我的操作系统是Ubuntu 16.04.4 LTS,gfortran:GNU Fortran 5.4.0 20160609,所以其他必要的工具(例如,编译器
    caf
    和启动器
    cafrun
    是OpenCoArray软件包的一部分)将按照说明安装。

    感谢您的帮助。我已经解决了这个问题。如果有人感兴趣,以下是我的解决方案: 1.按照说明安装Linuxbrew:

    sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
    
    test -d ~/.linuxbrew && PATH="$HOME/.linuxbrew/bin:$HOME/.linuxbrew/sbin:$PATH"
    test -d /home/linuxbrew/.linuxbrew && PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH"
    test -r ~/.bash_profile && echo "export PATH='$(brew --prefix)/bin:$(brew --prefix)/sbin'":'"$PATH"' >>~/.bash_profile
    echo "export PATH='$(brew --prefix)/bin:$(brew --prefix)/sbin'":'"$PATH"' >>~/.profile
    
  • 安装OpenCoArray库
    brew安装OpenCoArray
    现在我们可以使用
    caf
    cafrun
  • 编译.exe文件
    caf fname.f90-o test.exe
  • 运行程序
    cafrun-np(numimages)test.exe
  • 希望它能对某人有所帮助!
    另外,我的操作系统是Ubuntu 16.04.4 LTS,gfortran:GNU Fortran 5.4.0 20160609,所以其他必要的工具(例如,编译器
    caf
    和启动器
    cafrun
    是OpenCoArray包的一部分)将按照说明安装。

    问题是/usr/bin/ld找不到-lcaf_mpi,开放式阵列库,可能是因为它没有安装。如果没有更多的信息(至少gfortran的版本会很有用),就不能说更多,但可能会有所帮助。哦,在问题中,请直接输入源代码(只要不太长),链接中断,因此问题也会中断。我们需要知道您是如何安装OpenCoArray的,以及在哪里安装的。问题是/usr/bin/ld找不到-lcaf_mpi,OpenCoArray库,可能是因为它没有安装。如果没有更多的信息(至少gfortran的版本会很有用),就不能说更多,但可能会有所帮助。哦,在问题中,请直接输入源代码(只要不太长),链接断开,因此也需要断开问题。我们需要知道您是如何安装OpenCoArray的,以及在何处安装的。感谢您回到这里,并提供您的解决方案。不过,为了使您的答案更有用,最好添加操作系统、编译器和OpenCoArray的版本。我的操作系统是Ubuntu 16.04.4 LTS,因此其他必要的工具(例如,编译器
    caf
    和启动器
    cafrun
    都是OpenCoArray软件包的一部分)将按照说明进行安装。使用Ubuntu20.04.2 LTS for gfortran,它可以帮助您重新开始,并提供您的解决方案。不过,为了使您的答案更有用,最好添加操作系统、编译器和OpenCoArray的版本。我的操作系统是Ubuntu 16.04.4 LTS,因此其他必要的工具(例如,编译器
    caf
    和启动器
    cafrun
    都是OpenCoArray软件包的一部分)将按照说明进行安装。使用Ubuntu20.04.2LTsforGFortran,它也可以工作