在典型的 Fortran 程序中使用 macports 中的 ATLAS/Lapack

发布于 2024-10-10 21:49:51 字数 471 浏览 0 评论 0原文

我正在尝试用 mpi 和 fortran 编写一个简单的微分方程求解器。我想我也可以熟悉使用 ATLAS/LAPACK/BLAS 例程,因为它们似乎对我将来可能做的任何数值建模都非常有用。我通过 macports 安装了 ATLAS。我使用 gcc 4.4(也通过 macports 安装。)

我主要是自学的,从来没有故意使用过 ATLAS、BLAS、LAPACK 或任何“库”(我在 C++ Java 和 Perl 中使用过“include”语句或它们的等价物) -但没有完全理解它们是如何工作的。)

我只是希望能够使用 ATLAS 编写一段代码来解决 Fortran 中的 Ax=b 问题。我已经查找了示例代码,但它似乎需要“pgi”。经过多次谷歌搜索后,我仍然不知道“pgi”是什么或者它有什么作用。在终端中输入“add pgi”只是告诉我 “添加:未找到命令”

我使用 mac 10.5.8 以防有任何直接相关。

我希望这是一个合理的地方来提出这个问题。

I am trying to write a simple differental equation solver in mpi and fortran. I figured I may as well get familiar with using ATLAS/LAPACK/BLAS routines as they seem quite useful for any future numerical modeling I might do. I installed ATLAS via macports. I use gcc 4.4 (also installed via macports.)

I am mostly self taught, and have never used ATLAS, BLAS, LAPACK, or any "library" knowingly (I have used "include" statements or their equivalents in C++ Java and Perl--but without full understanding of how they work.)

I would just like to be able to write a code that solves Ax=b in fortran using ATLAS. I have looked for sample code, but it seems to require "pgi." After much googling I still have no idea what "pgi" is or what it does. Typing "add pgi" in terminal just told me that
"add: command not found"

I use a mac 10.5.8 in case that is of any direct relevance.

I hope this is a reasonable place to ask this question.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时光清浅 2024-10-17 21:49:51

一方面:链接时必须确保包含库。这可以通过带有“-l”选项的编译命令来命名库来完成。如果库位于不寻常的目录中,您可能还需要“-L”选项来告诉链接器在哪里可以找到它。如果您使用 macports gfortran 和 macports 安装库,您可能不需要“-L”选项。 Macports 库将位于 /opt/local/lib 中,因此如果您需要选项:“-L/opt/local/lib”。当您使用“-l”选项指定库的名称时,约定是保留“lib”和文件类型,即“-latlas”。

对于某些库,您可能需要在 Fortran 源代码中使用“use”语句。

作为并行编程的初学者,您可能会发现 OpenMP 比 MPI 更容易。我建议分阶段尝试——首先让顺序程序工作,然后考虑并行编程。

http://people 上有一些使用 lapack 的示例。 sc.fsu.edu/~jburkardt/f_src/lapack/lapack.html。 John Burkardt 可能还有其他可供您使用的示例。

One aspect: have to be sure to include the libraries when you link. This can be done with the compile command with the "-l" option to name the library. If the library is in an unusual directory you may also need the "-L" option to tell the linker where to find it. If you are using the macports gfortran and macports installed libraries, you will probably not need the "-L" option. Macports libraries will be in /opt/local/lib, so if you need the option: "-L/opt/local/lib". When you specify the name of the library with the "-l" option, the convention is that you leave of "lib" and the filetype, so "-latlas".

You may need a "use" statement in your Fortran source code for some libraries.

As a beginner at parallel programming, you will probably find OpenMP easier than MPI. I suggest trying things in stages -- get your sequential program working first, then think about parallel programming.

There are some examples of the use of lapack at http://people.sc.fsu.edu/~jburkardt/f_src/lapack/lapack.html. John Burkardt may have other examples of use to you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文