Intel studio をインストールし、Visual Studio 2013 を使用しています。thread を使用するプログラムを作成したいと考えています。Intel でコンパイルしたいので、次の手順を実行しました。
- 空のプロジェクトを作成します
- cpp ソースを右クリックして Intel コンパイラの使用を選択し、選択したファイルに Intel C++ の使用を選択し、 All configuration を選択した後、On Ok ボタンをクリックします。
- 次に、プロジェクトを右クリックし、Intel Compiler Item から Intel c++ を使用して選択します。
- 念のため、プロパティ マネージャーに移動して構成マネージャーを確認します。プラットフォームは X64 である必要があります。さらに、私は c/c++ 、最適化 [Intel c++] または一般的な [Intel 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 を使用しようとしましたが、問題は解決しませんでした。
誰が問題が何であるか教えてもらえますか?