http://www.ilkda.com/compile/Static_Versus_Dynamic.htm
Creating .so and .a in Unix
http://stackoverflow.com/questions/1648215/creating-so-and-a-in-unix
Showing posts with label Compiler Optimization. Show all posts
Showing posts with label Compiler Optimization. Show all posts
Tuesday, August 20, 2013
Tuesday, July 30, 2013
Difference between const & const volatile
An object marked as
const volatile will not be permitted to be changed by the code (an error will be raised due to the const qualifier) - at least through that particular name/pointer.
The
volatile part of the qualifier means that the compiler cannot optimize or reorder access to the object.
In an embedded system, this is typically used to access hardware registers that can be read and are updated by the hardware, but make no sense to write to (or might be an error to write to).
unsigned int const volatile *status_reg; // assume these are assigned to point to the
unsigned char const volatile *recv_reg; // correct hardware addresses
#define UART_CHAR_READY 0x00000001
int get_next_char()
{
while ((*status_reg & UART_CHAR_READY) == 0) {
// do nothing but spin
}
return *recv_reg;
}
If these pointers were not marked as being volatile, a couple problems might occur:
- the while loop test might read the status register only once, since the compiler could assume that whatever it pointed to would never change (there's nothing in the while loop test or loop itself that could change it). If you entered the function when there was no character waiting in UART hardware, you might end up in an infinite loop that never stopped even when a character was received.
- the read of the receive register could be moved by the compiler to before the while loop - again because there's nothing in the function that indicates that
*recv_reg is changed by the loop, there's no reason it can't be read before entering the loop.
The volatile qualifiers ensures that these optimizations are not performed by the compiler.
Friday, July 19, 2013
Tuesday, July 16, 2013
Error: Unterminated character constant beginning at (1)
http://gcc.gnu.org/ml/fortran/2007-12/msg00212.html
Error: Unterminated character constant beginning at (1)
aaa.f:4.72:
print *, 'Try one of "Skip", "Test", "Verbosity" or "Cleanup"
1
Warning: Line truncated at (1)
Fixed-form Fortran has only 72 characters per line. What happens with
longer lines is implementation dependent. However, many
programmers/programs assume that everything after column 72 is ignored
(which gfortran does).
Solution: Fix the program by splitting the line or by using the
-ffixed-line-length-n (n is a non-negative integer).
Sunday, May 26, 2013
OOP in Matlab: basics /Tutorial
Software from Kelvin Murphy and Students (UBC)
http://www.cs.ubc.ca/~murphyk/Software/matlabTutorial/html/objectOriented.html#53
A more professional guide to Matlab
https://code.google.com/p/yagtom/
Suggestion:
The danger of premature optimization
Before spending a lot of time optimizing your code, you should first identify the key bottlenecks using the profiler. The usual pattern is that 80% of the the time is spent in 20% of the code, so you can focus your efforts accordingly. Also, remember that correctness is more important than speed!Tuesday, April 16, 2013
using valgrind to check memory leak
http://cs.ecs.baylor.edu/~donahoo/tools/valgrind/
valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./test
Wednesday, February 27, 2013
Tuesday, February 26, 2013
Sunday, October 28, 2012
Wednesday, April 18, 2012
GPU: architecture and programming (NYU Course)
http://cs.nyu.edu/courses/spring12/CSCI-GA.3033-012/index.html
Contains some interesting links for GPU tools from webpage above
Multi2Sim Simulation Framework
http://www.multi2sim.org/
GPUocelot
http://code.google.com/p/gpuocelot/
Dynamic Compilation for PTX
Short CUDA tutorial of Colorado School of Mines
http://geco.mines.edu/tesla/cuda_tutorial_mio/index.html
Contains some interesting links for GPU tools from webpage above
Multi2Sim Simulation Framework
http://www.multi2sim.org/
GPUocelot
http://code.google.com/p/gpuocelot/
Dynamic Compilation for PTX
Short CUDA tutorial of Colorado School of Mines
http://geco.mines.edu/tesla/cuda_tutorial_mio/index.html
Labels:
compiler,
Compiler Optimization,
Courses,
CUDA,
GPU,
Programming
Saturday, January 14, 2012
Subscribe to:
Posts (Atom)