AR(1) Time series process:
http://www.math.utah.edu/~zhorvath/ar1.pdf
Auto regressive analysis (code)
http://paulbourke.net/miscellaneous/ar/
How to generate AR(1) data
https://mailman.cae.wisc.edu/pipermail/help-octave/2003-July/010288.html
CMU AR(1) document
http://bertha.tepper.cmu.edu/telmerc/phd_07/Pages%20from%20mscf_notes_main-2.pdf
Wednesday, January 25, 2012
AT&T assembly homework
How to write assembly under Linux.
http://asm.sourceforge.net/intro/
-- nasm
foo : no name, fill with your own name here.
GCC inline asm:
http://ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html
for homework 1
http://cs.njit.edu/~sohna/cs680/hw1.html
Introduction to UNIX assembly programming
http://asm.sourceforge.net/intro/hello.html
lea (AT&T assembly)
Load-effective-address
Intel Pentium Instruction Set Reference (Basic Architecture Overview)
http://faydoc.tripod.com/cpu/
Trick:
Using lea instruction to compute certain products.
The trick is to use the scaled index addressing modes.
http://webster.cs.ucr.edu/AoA/Windows/HTML/IntegerArithmetic3.html
What is scaled index addressing modes.
Addressing modes:
http://en.wikipedia.org/wiki/Addressing_mode
scaled addressing modes:
http://en.wikipedia.org/wiki/Addressing_mode#Scaled
http://asm.sourceforge.net/intro/
-- nasm
foo : no name, fill with your own name here.
GCC inline asm:
http://ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html
for homework 1
http://cs.njit.edu/~sohna/cs680/hw1.html
Introduction to UNIX assembly programming
http://asm.sourceforge.net/intro/hello.html
lea (AT&T assembly)
Load-effective-address
Intel Pentium Instruction Set Reference (Basic Architecture Overview)
http://faydoc.tripod.com/cpu/
Trick:
Using lea instruction to compute certain products.
The trick is to use the scaled index addressing modes.
http://webster.cs.ucr.edu/AoA/Windows/HTML/IntegerArithmetic3.html
What is scaled index addressing modes.
Addressing modes:
http://en.wikipedia.org/wiki/Addressing_mode
scaled addressing modes:
http://en.wikipedia.org/wiki/Addressing_mode#Scaled
Monday, January 23, 2012
Learning through reading Common.mk (CUDA)
# Compilers
CXX := g++ -fPIC
http://www.fpx.de/fp/Software/tcl-c++/tcl-c++.html
Shared Library may be mapped into memory at different locations each time it is loaded, addresses within the library would be variable, therefore, all addresses inside the library are stored zero-based, relative to the beginning of the library. A register is then set aside to contain that address, so that all references in the library can be easily computed at runtime.
To compile a file for position-independence, you have to add custom switches to the compiler's command line. For example, gcc/egcs uses the `-fPIC switch.
g++?
http://forums.macrumors.com/showthread.php?t=132393
http://stackoverflow.com/questions/172587/what-is-the-difference-between-g-and-gcc
CXX := g++ -fPIC
http://www.fpx.de/fp/Software/tcl-c++/tcl-c++.html
Shared Library may be mapped into memory at different locations each time it is loaded, addresses within the library would be variable, therefore, all addresses inside the library are stored zero-based, relative to the beginning of the library. A register is then set aside to contain that address, so that all references in the library can be easily computed at runtime.
To compile a file for position-independence, you have to add custom switches to the compiler's command line. For example, gcc/egcs uses the `-fPIC switch.
g++?
http://forums.macrumors.com/showthread.php?t=132393
http://stackoverflow.com/questions/172587/what-is-the-difference-between-g-and-gcc
Wednesday, January 18, 2012
Tuesday, January 17, 2012
Reading: Entry Point, Main Function argv and argc
All from wikipedia:
Entry point:
http://en.wikipedia.org/wiki/Entry_point
Main function:
http://en.wikipedia.org/wiki/Main_function
http://pages.cs.wisc.edu/~cs354-1/onyourown/C.argv.html
Entry point:
http://en.wikipedia.org/wiki/Entry_point
Main function:
http://en.wikipedia.org/wiki/Main_function
http://pages.cs.wisc.edu/~cs354-1/onyourown/C.argv.html
Sunday, January 15, 2012
Page locked memory allocation
To quantify the communication bandwidth difference on your system between paged-locked and non-page-locked memory, one can run the bandwidthTest program that comes with the CUDA sdk.
MAGMA 1.0.0 + Geforce 9300GS
BLAS:
GotoBLAS2
MAGMA (utk) 1.0.0:
Instruction guide:
http://www.pavanky.com/installing-magma-with-gotoblas2/
Relative threads:
http://icl.cs.utk.edu/magma/forum/viewtopic.php?f=2&t=278
http://icl.cs.utk.edu/magma/forum/viewtopic.php?f=2&t=365&sid=0852dd45caa60d4d29ee0e02fa260be1
sizeptr.c
Modify interface function.
zdotc
cdotc
Testing:
Error:
CUDA: Cannot create the context
(Possible: running out of memory)
Looking for source:
http://icl.cs.utk.edu/magma/docs/control_2init_8cpp_source.html
cuCtxCreate
Document:
http://developer.download.nvidia.com/compute/cuda/2_3/toolkit/docs/online/group__CUCTX_g02b31a192b32043c0787696292f1ffbe.html
Tool:
nvidia-smi
GotoBLAS2
MAGMA (utk) 1.0.0:
Instruction guide:
http://www.pavanky.com/installing-magma-with-gotoblas2/
Relative threads:
http://icl.cs.utk.edu/magma/forum/viewtopic.php?f=2&t=278
http://icl.cs.utk.edu/magma/forum/viewtopic.php?f=2&t=365&sid=0852dd45caa60d4d29ee0e02fa260be1
sizeptr.c
Modify interface function.
zdotc
cdotc
Testing:
Error:
CUDA: Cannot create the context
(Possible: running out of memory)
Looking for source:
http://icl.cs.utk.edu/magma/docs/control_2init_8cpp_source.html
cuCtxCreate
Document:
http://developer.download.nvidia.com/compute/cuda/2_3/toolkit/docs/online/group__CUCTX_g02b31a192b32043c0787696292f1ffbe.html
Tool:
nvidia-smi
Saturday, January 14, 2012
Segmentation fault and trouble shooting
From MIT:
Other numerical tips from same course resource:
How to check convergence:
Thursday, January 12, 2012
sh can't open script? Quartus ii 11 + ubuntu 10.10
xx@xx-XXXXX:~/Quartus$ sh ./11.0sp1_quartus_free_linux.sh
sh: Can't open ./11.0sp1_quartus_free_linux.sh
Solution:
http://ubuntuforums.org/showthread.php?t=1885162
bash ./11.0sp1_quartus_free_linux.sh
other problems report:
http://www.alteraforum.com/forum/showthread.php?t=31426
Installation guide:
http://fpga4u.epfl.ch/wiki/Install_Quartus_II#Download_the_Installer_2
Other installation problem:
./quartus: error while loading shared libraries: libsys_ictq.so: cannot open shared object file: No such file or directory
Cannot start the program:
Solution:
Repair broken link:
Add /opt/altera/version_number/quartus/linux(64)/
to ld.so.conf
Reference:
Lugman
Installation guide in PDF:
http://www.ece.auckland.ac.nz/~sinnen/QuartusII-on-UbuntuLinux.pdf
10.04 + Quartus 10
http://www.philpem.me.uk/elec/fpga/quartus-ubuntu/
Altera Wiki:
http://www.alterawiki.com/wiki/Quartus_for_Linux
Installation Manual from Altera official
http://www.altera.com/literature/manual/quartus_install.pdf
Right path to run program:
quartus/bin
http://alterauserforums.net/forum/showthread.php?p=117571
Make sure PATH point to quartus/bin
Install USB-Blaster Driver:
Please reference
Writing udev rules
http://www.reactivated.net/writing_udev_rules.html#syntax
Altera provides little support for the USB-Blaster drivers, only Red Hat is officially supported. Depending on your Linux distribution you will have to work a little to make it work. We will progressively add in the following subsections the information to install the USB-Blaster for each distribution. It will be difficult for us to test every distribution of Linux, so if your distribution is not listed there but one of the solution worked or if you had to look for a solution elsewhere, we encourage you to contribute to these subsections by sharing your experience.
To let users use the USB-Blaster device, you need to give them the right to. On Gentoo, you must add your user to the usb group (in /etc/group) to be able to program the device. On other distributions, you need to have write access to /proc/bus/usb/bus/id.
Here is an example for Ubuntu:
- Create a new rule file with your favorite text editor (like vim):
sudo vim /etc/udev/rules.d/51-usbblaster.rules
- Insert the following lines
# Altera USB-Blaster rule to set mode to 666. SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6001", MODE="0666", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", RUN+="/bin/chmod 0666 %c"
- Load this new rule by typing:
sudo udevadm control --reload-rules
http://blog.codingwell.net/2011/03/quartus-programmer-linux.html
solve permission problem
We need to patch the JTAG server to look for devices in /sys/kernel/debug/usb/devices instead of /proc/bus/usb/devices, and in /dev/bus/usb/.../.../ instead of /proc/bus/usb/.../.../.
As the former won't fit in the string placeholder of the binary file, we choose to create a soft link.
sudo ln -s /sys/kernel/debug/usb/devices /dev/bus/usb/devices
This soft link will disappear on reboot, so if you don't want to type it every time, add this line in a script or in your /etc/rc.local file (without the sudo).
Now we will use sed to replace the paths that the JTAG server is looking at. There are 2 sets of commands, one for 32-bit OS and the other one for 64-bit. Select the set corresponding to your system. If you have a doubt, it won't harm to patch both files. Before executing the commands, replace<installation path> by your installation path (e.g., /opt/altera/10.0). Note that these commands will create a backup copy of the JTAG server (jtagd.bak).
For 32-bit OS:
sudo sed -i.bak 's/\/proc\/bus\/usb\/%03u\/%03u/\/dev\/bus\/usb\/%03u\/%03u\d0/g' <installation path>/quartus/linux/jtagd sudo sed -i 's/\/proc\/bus\/usb\/devices/\/dev\/bus\/usb\/devices\d0/g' <installation path>/quartus/linux/jtag
sed
Search and Replace
Discussion on how to set up usb-blaster under ubuntu
http://www.alteraforum.com/forum/showthread.php?t=5893&page=7
USB configuration under debian:
http://www.eecg.toronto.edu/~laforest/USB-Blaster-Debian.html
Wednesday, January 4, 2012
Difference of orthogonal and orthonormal ?
Orthonormality
In linear algebra, two vectors in an inner product space are orthonormal if they are orthogonal and both of unit length. A set of vectors form an orthonormal set if all vectors in the set are mutually orthogonal and all of unit length. An orthonormal set which forms a basis is called an orthonormal basis.Orthogonal mean that the dot product is null.
Orthonormal mean that the dot product is null and the norm is equal to 1.
If two or more vectors are orthonormal they are also orthogonal but the inverse is not true.
http://www.edaboard.com/thread147364.html
Tuesday, January 3, 2012
stack overflow
Several related concept:
Subroutines:
In computer science, a subroutine (also called procedure, function, routine, method, or subprogram) is a portion of code within a larger program that performs a specific task and is relatively independent of the remaining code.
Most modern implementations use a call stack, a special case of the stack data structure, to implement subroutine calls and returns. Each procedure call creates a new entry, called a stack frame, at the top of the stack; when the procedure returns, its stack frame is deleted from the stack, and its space may be used for other procedure calls. Each stack frame contains the private data of the corresponding call, which typically includes the procedure's parameters and internal variables, and the return address.
The call stack is usually implemented as a contiguous area of memory. It is an arbitrary design choice whether the bottom of the stack is the lowest or highest address within this area, so that the stack may grow forwards or backwards in memory; however, many architectures chose the latter.[citation needed]
Subroutines:
In computer science, a subroutine (also called procedure, function, routine, method, or subprogram) is a portion of code within a larger program that performs a specific task and is relatively independent of the remaining code.
Most modern implementations use a call stack, a special case of the stack data structure, to implement subroutine calls and returns. Each procedure call creates a new entry, called a stack frame, at the top of the stack; when the procedure returns, its stack frame is deleted from the stack, and its space may be used for other procedure calls. Each stack frame contains the private data of the corresponding call, which typically includes the procedure's parameters and internal variables, and the return address.
The call stack is usually implemented as a contiguous area of memory. It is an arbitrary design choice whether the bottom of the stack is the lowest or highest address within this area, so that the stack may grow forwards or backwards in memory; however, many architectures chose the latter.[citation needed]
Very large stack variables
The other major cause of a stack overflow results from an attempt to allocate more memory on the stack than will fit. This is usually the result of creating local array variables that are far too large. For this reason arrays larger than a few kilobytes should be allocated dynamically instead of as a local variable.[5]
An example of a very large stack variable in C:
int foo() { double x[1000000]; }
The declared array consumes 8 megabytes of data (assuming each double is 8 bytes); if this is more memory than is available on the stack, a stack overflow will occur.[further explanation needed]
Stack overflows are made worse by anything that reduces the effective stack size of a given program. For example, the same program being run without multiple threads might work fine, but as soon as multi-threading is enabled the program will crash. This is because most programs with threads have less stack space per thread than a program with no threading support. Similarly, people new to kernel development are usually discouraged from using recursive algorithms or large stack buffers.[6][7]
Possible solution:
http://stackoverflow.com/questions/3718528/how-to-allocate-more-memory-to-your-program-gcc
under GCC:
C dynamic memory allocation
http://en.wikipedia.org/wiki/C_dynamic_memory_allocation
Type Safety, Casting?
Possible solution:
http://stackoverflow.com/questions/3718528/how-to-allocate-more-memory-to-your-program-gcc
under GCC:
C dynamic memory allocation
http://en.wikipedia.org/wiki/C_dynamic_memory_allocation
/* Allocate space for an array with ten elements of type int. */ int *ptr = (int *) malloc(10 * sizeof (int)); if (ptr == NULL) { /* Memory could not be allocated, the program should handle the error here as appropriate. */ } else { /* Allocation succeeded. Do something. */ free(ptr); /* We are done with the int objects, and free the associated pointer. */ ptr = NULL; /* The pointed-to-data must not be used again, unless re-assigned by using malloc again. */ }
Type Safety, Casting?
Subscribe to:
Posts (Atom)