How to set CUDA compiler flags in Visual Studio 2010?

You can select the options for the GPU Code Generation in this dialog: In this case “compute_20” means that i am compiling for the virtual compute architecture 2.0 – virtual architecture influences the PTX generation stage. The second part that comes after the coma is “sm_21”.This influences the CUBIN generation stage. It defines the real … Read more

How can I mitigate the impact of the Intel jcc erratum on gcc?

By compiler: GCC: -Wa,-mbranches-within-32B-boundaries clang (10+): -mbranches-within-32B-boundaries compiler option directly, not -Wa. MSVC: /QIntel-jcc-erratum See Intel JCC Erratum – what is the effect of prefixes used for mitigation? ICC: TODO, look for docs. The GNU toolchain does mitigation in the assembler, with as -mbranches-within-32B-boundaries, which enables (GAS manual: x86 options): -malign-branch-boundary=32 (care about 32-byte boundaries). … Read more

What are the useful GCC flags for C?

Here are mine: -Wextra, -Wall: essential. -Wfloat-equal: useful because usually testing floating-point numbers for equality is bad. -Wundef: warn if an uninitialized identifier is evaluated in an #if directive. -Wshadow: warn whenever a local variable shadows another local variable, parameter or global variable or whenever a built-in function is shadowed. -Wpointer-arith: warn if anything depends … Read more

Difference between -pthread and -lpthread while compiling

-pthread tells the compiler to link in the pthread library as well as configure the compilation for threads. For example, the following shows the macros that get defined when the -pthread option gets used on the GCC package installed on my Ubuntu machine: $ gcc -pthread -E -dM test.c > dm.pthread.txt $ gcc -E -dM … Read more