0

我试图在虚拟机中运行的 Ubuntu 11.04 中实现 OpenMP。这些是我遵循的步骤:

第一步=> sudo apt-get install build-essential

第二步=> sudo apt-get install gcc 4.5

现在,当我运行用于实现 OpenMP 的命令时(如果这不是正确的命令,请告诉我)输出是:

**ubuntu@ubuntu:~$ gcc -fopenmp foo.c

gcc: foo.c: 没有这样的文件或目录

gcc:没有输入文件**

4

2 回答 2

0

您似乎对“实施” OpenMP 所涉及的内容有一个模糊的概念。您需要编写一个使用 OpenMP(foo.c占位符)的程序才能使用该库。

于 2012-06-02T20:01:56.770 回答
0

To make use of OpenMP in your C code, there are two steps:

  1. Use one of OpenMP's #pragma statements in your code where appropriate.
  2. Compile with -fopenmp.

Also, I can't help but notice that your installation line is a bit sketchy - to install gcc, you only need to do sudo apt-get install gcc (this will pull a recent version for you), and to install OpenMP, you would need to do sudo apt-get install libgomp1. If you want a specific version, you would have to make sure that gcc-4.5 is in Ubuntu 11.04's repositories, which I'm not 100% sure it is.

于 2012-06-02T20:03:39.137 回答