I installed Intel studio and I have Visual studio 2013 , I want to write a program that uses thread . I want to compile it by Intel , I did these steps:
So I think all setting are done correctly.but I have these errors when I write a code using Cilk/cilk.h
and this is the code
#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;
}
// **********************************************************************
I should say that I try to use _Cilk_for instead of cilk_for but the problem wasn't solved.
Could anybody tell me what is the problem ?
For the __imp_timeGetTime
function, referenced from ...cilk_for
... you need to link winmm.lib
(see e.g. https://www.gamedev.net/topic/109957-unresolved-external-symbol-__imp__timegettime0/ or https://groups.google.com/forum/#!topic/v8-users/WsJYEcp_siY)