我安装了 Intel studio,我有 Visual Studio 2013,我想编写一个使用线程的程序。我想由 Intel 编译它,我做了这些步骤:
- 我创建了一个空项目
- 我右键单击 cpp 源并选择 using Intel compiler 然后选择 using intel c++ for selected file 并在选择 All configuration 后,单击 On Ok 按钮。
- 然后我右键单击项目并从英特尔编译器项目中选择使用英特尔 c++。
- 为了确定我去属性管理器并检查配置管理器,平台必须是 X64。更多,我在 c/c++ ,优化[英特尔 c++] 或一般 [英特尔 c++] 中看到。
所以我认为所有设置都正确完成。但是当我使用 Cilk/cilk.h 编写代码时出现这些错误
这是代码
#include <stdio.h>
#include <windows.h>
#include <mmsystem.h>
#include <math.h>
#include <cilk/cilk.h>
using namespace std;
const long int VERYBIG = 100000;
// ***********************************************************************
int main(void)
{
int i;
long int j, k, sum;
double sumx, sumy, total;
DWORD starttime, elapsedtime;
// -----------------------------------------------------------------------
// Output a start message
printf("****************None Parallel Timings for %d iterations\n\n", VERYBIG);
// repeat experiment several times
// int i = 0;
cilk_for(int i = 0; i < 6; i++)
{
// get
starttime = timeGetTime();
// reset check sum & running total
sum = 0;
total = 0.0;
// Work Loop, do some work by looping VERYBIG times
cilk_for(int j = 0; j<VERYBIG; j++)
{
// increment check sum
sum += 1;
// Calculate first arithmetic series
sumx = 0.0;
for (k = 0; k<j; k++)
sumx = sumx + (double)k;
// Calculate second arithmetic series
sumy = 0.0;
for (k = j; k>0; k--)
sumy = sumy + (double)k;
if (sumx > 0.0)total = total + 1.0 / sqrt(sumx);
if (sumy > 0.0)total = total + 1.0 / sqrt(sumy);
}
// get ending time and use it to determine elapsed time
elapsedtime = timeGetTime() - starttime;
// report elapsed time
printf("Time Elapsed % 10d mSecs Total = %lf Check Sum = %ld\n",
(int)elapsedtime, total, sum);
}
// return integer as required by function header
return 0;
}
// **********************************************************************
我应该说我尝试使用 _Cilk_for 而不是 cilk_for 但问题没有解决。
谁能告诉我有什么问题?