How should "x = a[x]++" be compiled ?

It seems I either have forgotten how C works, or ICC has a very basic (and thus very serious bug).

When compiling   x = a[x]++;   ICC does not increment the array value, while GCC does (as it should).

I am using the latest ICC (14.0.2). This toy code shows this:

#include <stdio.h>

int main(void)


    int a[1] = {5}, i = 0;

    i = a[i]++;

    printf("%d %d\n", i, a[0]);

    return 0;


Most efficient way for atomic updates on Xeon Phi

I have found out that __kmpc_atomic_float4_add was used in the assembly code of the following two lines:

#pragma omp atomic

array[i] += 1.0;

Performance of this code is not good on Intel Xeon Phi when many threads are used. Is there any information about how __kmpc_atomic_float4_add is implemented? Are there any better solutions for efficient and scalable atomic updates? Is it possible to use GCC intrinsics such as __sync_add_and_fetch() in offload regions?

Can't see Intel C++ in VS 2013

I work on two projects one in VB.NET and one in C++.

I have Microsoft Visual Studio Professional 2013, which I use for the VB project, and Codelite with the GNU C++ compiler, which I use for the C++ project. For various reasons, I want to keep the C++ project free of Microsoft-specific influences.

I wanted to try the Intel C++ compiler, so I downloaded the trial version of "Intel® Parallel Studio XE for Windows" and installed it, and there are now signs of the presence of Intel C++ in VS 2013, but I can't start an Intel C++ project because VS defaults to Microsoft C++.

How to

for example, I have

#pragma offload nocopy(a)
  a = malloc(sizeof(double)*ny*nx);

And now I want to initialize its first k lines from the data from Host

I can do something like:

inout = malloc(sizeof(double)*k*nx);
memcpy(inout, a, k*nx*sizeof(double));
#pragma offload in(inout: length(k*nx) alloc_if(1) free_if(1)) nocopy(a) in(nx, k)
 memcpy(a, inout, k * nx * sizeof(double));

Is there any way to avoid the temporary pointer `inout' ?



MIC linking issues

I am getting the incompatibility error while linking a library using -mmic flag. I dont know how to make the piece of code compatible with native mic compilation.

x86_64-k1om-linux-ld: i386:x86-64 architecture of input file `libMisc.a(clock_time.o)' is incompatible with k1om output

//clock_time.c code

#include <time.h>

double MPI_Wtime(void);

double clock_time_()


  return MPI_Wtime();



Suscribirse a C/C++