icc

Why does Intel's compiler prefer NEG+ADD over SUB?

你说的曾经没有我的故事 提交于 2019-12-03 04:06:21
问题 In examining the output of various compilers for a variety of code snippets, I've noticed that Intel's C compiler (ICC) has a strong tendency to prefer emitting a pair of NEG + ADD instructions where other compilers would use a single SUB instruction. As a simple example, consider the following C code: uint64_t Mod3(uint64_t value) { return (value % 3); } ICC translates this to the following machine code (regardless of optimization level): mov rcx, 0xaaaaaaaaaaaaaaab mov rax, rdi mul rcx shr

PdfBox - PDColorSpaceFactory.createColorSpace(document, iccColorSpace) throws nullpointerexception

匿名 (未验证) 提交于 2019-12-03 02:33:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to create a PDF which has a single image on a single page. The tricky part is to use a custom (defined in a separate file) CMYK color space. I've tried to call PDColorSpaceFactory.createColorSpace(document, iccColorSpace) but keep getting nullpointerexception. I've managed to track the issue up to the constructor: public PDICCBased( PDDocument doc ) { array = new COSArray(); array.add( COSName.ICCBASED ); array.add( new PDStream( doc ) ); } The PDICCBased object has stream field and it's obviously not set. Thus when it's called at

How to set icc color profile in Java and change colorspace

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: First, I would like to say I'm not an image processing specialist. I would like to convert image colorspace from one to another, and change icc color profile at the same time. I managed to do it using JMagick (the ImageMagick Java port), but no way in pure Java (even using JAI). 回答1: Use ColorConvertOp , this will do the color space conversion. You have several options to set a icc color profile. Either you use a predefined profile by using getInstance with the correct color space constant or you can specify a file, which contains a profile.

Pass lambda expression to lambda argument c++11

时光总嘲笑我的痴心妄想 提交于 2019-12-02 22:32:34
I would like to do something like this: int main() { auto f = [/*some variables*/](/*take lambda function*/) {/*something with lambda function*/}; f([/*other variables*/](/*variables to be decided by f()*/) {/*something with variables*/}); } I know that it is possible to pass a lambda to a function, as well as to a lambda. The following works: int main() { int x=0; int y=0; auto f = [x,y](double (func)(int)) -> double {func(0); return 0.0;}; f([](int i) -> double {return 0.0;}); } But the following does not work (as soon as i change the scope variables to add [x]) int main() { int x=0; int y=0

Does gcc, icc, or Microsoft's C/C++ compiler support or know anything about NUMA?

二次信任 提交于 2019-12-02 21:02:17
If I have a multi-processor board that has cache-coherent non-uniform memory access ( NUMA ) , i.e. separate "northbridges" with separate RAM for each processor, does any compiler know how to automatically spread the data across the different memory systems such that processes working on local threads are mostly retrieving their data from the RAM associated with the processor the thread is running on? I have a setup where 1 GB is attached to processor 0, 1 GB is attached to processor 1, et c. up to 4 processors. In the coherent memory space the physical memory for the RAM on the 1st processor

GCC optimizes fixed range-based for loop as if it had longer, variable length

ぃ、小莉子 提交于 2019-12-02 17:32:25
I have an array of POD structs and am trying to sum across one field. Here's a minimal example: struct Item { int x = 0; int y = 0; }; typedef Item Items[2]; struct ItemArray { Items items; int sum_x1() const; int sum_x2() const; }; int ItemArray::sum_x1() const { int total = 0; for (unsigned ii = 0; ii < 2; ++ii) { total += items[ii].x; } return total; } int ItemArray::sum_x2() const { int total = 0; for (const Item& item : items) { total += item.x; } return total; } The two sum functions do the same thing. Clang compiles them identically. But GCC 6 with -O3 on x86_64 does not. Here's sum_x1(

Why does Intel's compiler prefer NEG+ADD over SUB?

末鹿安然 提交于 2019-12-02 17:25:07
In examining the output of various compilers for a variety of code snippets, I've noticed that Intel's C compiler (ICC) has a strong tendency to prefer emitting a pair of NEG + ADD instructions where other compilers would use a single SUB instruction. As a simple example, consider the following C code: uint64_t Mod3(uint64_t value) { return (value % 3); } ICC translates this to the following machine code (regardless of optimization level): mov rcx, 0xaaaaaaaaaaaaaaab mov rax, rdi mul rcx shr rdx, 1 lea rsi, QWORD PTR [rdx+rdx*2] neg rsi ; \ equivalent to: add rdi, rsi ; / sub rdi, rsi mov rax,

OpenMP and Thread Local Storage identifier with icc

霸气de小男生 提交于 2019-12-02 05:36:03
问题 This is a simple test code: #include <stdlib.h> __thread int a = 0; int main() { #pragma omp parallel default(none) { a = 1; } return 0; } gcc compiles this without any problems with -fopenmp , but icc (ICC) 12.0.2 20110112 with -openmp complains with test.c(7): error: "a" must be specified in a variable list at enclosing OpenMP parallel pragma #pragma omp parallel default(none) I have no clue which paradigm (i.e. shared , private , threadprivate ) applies to this type of variables. Which one

Atomic test-and-set in x86: inline asm or compiler-generated lock bts?

混江龙づ霸主 提交于 2019-12-01 21:51:19
The below code when compiled for a xeon phi throws Error: cmovc is not supported on k1om . But it does compile properly for a regular xeon processor. #include<stdio.h> int main() { int in=5; int bit=1; int x=0, y=1; int& inRef = in; printf("in=%d\n",in); asm("lock bts %2,%0\ncmovc %3,%1" : "+m" (inRef), "+r"(y) : "r" (bit), "r"(x)); printf("in=%d\n",in); } Compiler - icc (ICC) 13.1.0 20130121 Related question: bit test and set (BTS) on a tbb atomic variable Peter Cordes IIRC, first-gen Xeon Phi is based on P5 cores (Pentium, and Pentium MMX). cmov wasn't introduced until P6 (aka Pentium Pro).

g++ and boost linker error on Ubuntu oneiric

怎甘沉沦 提交于 2019-12-01 11:36:22
问题 I am getting the following errors after an upgrade. I cannot figure what is wrong with it. It should work as far as I can see. $ make 2>&1 | head g++ -o prog -ansi -O2 -Wall -I/usr/include/boost -L/usr/lib -lboost_program_options -lboost_thread -lstdc++ ./YYY.o ./main.o ./myClass.o ./YYY.o: In function `void boost::call_once<void (*)()>(boost::once_flag&, void (*)())': YYY.cc:(.text._ZN5boost9call_onceIPFvvEEEvRNS_9once_flagET_[void boost::call_once<void (*)()>(boost::once_flag&, void (*)())]