icc

Intel C++ Compiler warning 167 when non-const argument is passed as const parameter [duplicate]

感情迁移 提交于 2019-12-06 04:48:45
问题 This question already has answers here : Why isn't it legal to convert “pointer to pointer to non-const” to a “pointer to pointer to const” (5 answers) Closed 6 years ago . I have a large codebase that recently moved from Microsoft's compiler to the Intel C++ Compiler. Our team's goal is compilation without warnings in the mainline. Since the switch, one instance of warning 167 has confounded me. If I compile the following code: int foo(const int pp_stuff[2][2]) { return 0; } int foo2(const

Column-major array storage in C compilers

亡梦爱人 提交于 2019-12-06 04:14:01
Are there any C compilers that have extensions to store an array in column-major order instead of the standard row-major order? Short answer is "No". Long answer is that storing an array in column-major order would break the one-to-one correspondence between array index operations and pointer arithmetics, and the way an N-dimension array is sliced into N-1 dimension arrays. Consider a 10x20 array stored in column-major order. This means that cells in adjacent columns would be next to each other in memory. On the other hand, converting a pointer to array element at i, j to an element pointer

accessing __m128 fields across compilers

我的未来我决定 提交于 2019-12-06 03:56:04
I've noticed that accessing __m128 fields by index is possible in gcc , without using the union trick. __m128 t; float r(t[0] + t[1] + t[2] + t[3]); I can also load a __m128 just like an array: __m128 t{1.f, 2.f, 3.f, 4.f}; This is all in line with gcc 's vector extensions. These, however, may not be available elsewhere. Are the loading and accessing features supported by the intel compiler and msvc? To load a __m128 , you can write _mm_setr_ps(1.f, 2.f, 3.f, 4.f) , which is supported by GCC, ICC, MSVC and clang. So far as I know, clang and recent versions of GCC support accessing __m128

How to force OpenMPI to use GCC instead of ICC? Is recompiling OpenMPI necessary?

与世无争的帅哥 提交于 2019-12-06 01:30:04
问题 I have a C-code for parallel computing written for gcc , and I want to compile it on a cluster, which apparently uses icc via mpicc . Correcting the code to be icc -friendly seems to be too time-demanding, so I wonder if I can ask OpenMPI to use gcc instead. I don't have the admin rights on that cluster, and I would actually prefer to do not mess the original configuration. If it is not possible to set in e.g. Makefile , then I could hopefully compile OpenMPI in my home directory, but I need

icpc C++11 with gcc stdlib

浪子不回头ぞ 提交于 2019-12-05 18:45:27
I am using icpc (non optional) and I am compiling with -std=c++0x so I can use lambas. However when I do so it creates havok with gcc stdlib with features that one supports that the other doesn't. I have tried defining __GXX_EXPERIMENTAL_CXX0X__ but that didn't help. So ideally what I am asking for is the ability to use the c++0x language features with the C++03 stdlib. gcc 4.6 icc 12.1] EDIT example of error: /usr/include/c++/4.6.2/type_traits(74): error: identifier "constexpr" is undefined static constexpr _Tp value = __v; ^ /usr/include/c++/4.6.2/type_traits(74): error: expected a ";"

Does ICC satisfy C99 specs for multiplication of complex numbers?

倖福魔咒の 提交于 2019-12-05 10:58:32
问题 Consider this simple code: #include <complex.h> complex float f(complex float x) { return x*x; } If you compile it with -O3 -march=core-avx2 -fp-model strict using the Intel Compiler you get: f: vmovsldup xmm1, xmm0 #3.12 vmovshdup xmm2, xmm0 #3.12 vshufps xmm3, xmm0, xmm0, 177 #3.12 vmulps xmm4, xmm1, xmm0 #3.12 vmulps xmm5, xmm2, xmm3 #3.12 vaddsubps xmm0, xmm4, xmm5 #3.12 ret This is much simpler code than you get from both gcc and clang and also much simpler than the code you will find

-O3 in ICC messes up intrinsics, fine with -O1 or -O2 or with corresponding manual assembly

点点圈 提交于 2019-12-05 07:26:21
This is a followup on this question . The code below for a 4x4 matrix multiplication C = AB compiles fine on ICC on all optimization settings. It executes correctly on -O1 and -O2, but gives an incorrect result on -O3. The problem seems to come from the _mm256_storeu_pd operation, as substituting it (and only it) with the asm statement below gives correct results after execution. Any ideas? inline void RunIntrinsics_FMA_UnalignedCopy_MultiplyMatrixByMatrix(double *A, double *B, double *C) { size_t i; /* the registers you use */ __m256d a0, a1, a2, a3, b0, b1, b2, b3, sum; // __m256d *C256 = (_

Cannot open source file “bits/c++config.h” error with icpc

痴心易碎 提交于 2019-12-05 00:51:01
I am trying to compile a program on a 64-bit machine with icpc. Unfortunately, I get an error message of catastrophic error: cannot open source file "bits/c++config.h" . I have adopded some advice from here but with no success. Also, I do not forget to run source /opt/intel/bin/compilervars.sh intel64 before hand and I'm on Ubuntu 13.10 in case this is important. Sven First, find the missing file: find /usr -name c++config.h (Headers are in /usr , most of the time.) Then, add its top dir to the include path of your compilation command, so the compiler will find "bits/c++config.h", using the -I

128-bit integers supporting +, -, *, /, and % in the Intel C Compiler?

无人久伴 提交于 2019-12-04 23:41:39
GCC and Clang have the __int128_t and __uint128_t extensions for 128-bit integer arithmetic. I was hopeful that __m128i would give something similar for the Intel C Compiler, but (if it's even possible) it looks to me like I'd have to write explicit SSE2 function calls in order to use __m128i , instead of using "built-in" operators like + , - , * , / , and % . I was hoping to do something like this (this doesn't work): #if defined(__INTEL_COMPILER) && defined(__SSE2__) #include "xmmintrin.h" typedef __u128 uint128_t; #elif defined (__GNUC__) typedef __uint128_t uint128_t; #else #error For 128

Existence of “simd reduction(:)” In GCC and MSVC?

╄→гoц情女王★ 提交于 2019-12-04 12:41:07
simd pragma can be used with icc compiler to perform a reduction operator: #pragma simd #pragma simd reduction(+:acc) #pragma ivdep for(int i( 0 ); i < N; ++i ) { acc += x[i]; } Is there any equivalent solution in msvc or/and gcc? Ref(p28): http://d3f8ykwhia686p.cloudfront.net/1live/intel/CompilerAutovectorizationGuide.pdf GCC definitely can vectorize. Suppose you have file reduc.c with contents: int foo(int *x, int N) { int acc, i; for( i = 0; i < N; ++i ) { acc += x[i]; } return acc; } Compile it (I used gcc 4.7.2) with command line: $ gcc -O3 -S reduc.c -ftree-vectorize -msse2 Now you can