Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devel merge with Master #44

Merged
merged 28 commits into from
Oct 31, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
cac4e9e
PCA implementation using SVD
pakozm Oct 21, 2013
550723a
Updated PCA, solving minor problems and errors
pakozm Oct 22, 2013
d8d7c61
Removed useless files
pakozm Oct 22, 2013
c46bf78
Solved compilation problems in macosx
pakozm Oct 22, 2013
f9d47ff
Solved problem with binding, stopping Lua garbage collector in C/C++ …
pakozm Oct 23, 2013
7bbc70e
Solved compilation problem with debug
pakozm Oct 23, 2013
c96e043
Solved compilation problem with debug
pakozm Oct 23, 2013
7957152
Merge branch 'master' into pako-devel
pakozm Oct 24, 2013
a0e53d9
Solved problems with loadable modules in macosx
pakozm Oct 25, 2013
17792c5
Added verbose print to HMM training
pakozm Oct 25, 2013
e5c6091
Merge branch 'master' into pako-devel
pakozm Oct 25, 2013
9edad4e
Modified configure.sh and Lua makefiles
pakozm Oct 26, 2013
4111e17
rlcompleter problems solved
pakozm Oct 26, 2013
925b139
mend
pakozm Oct 26, 2013
b0a2e9e
Added matrix syntactic sugar for slice method
pakozm Oct 28, 2013
7af762a
Added matrix syntactic sugar for slice method
pakozm Oct 28, 2013
b67d0c7
Added dependency installers
pakozm Oct 28, 2013
7697ac5
Added dependency installers
pakozm Oct 28, 2013
b6509a0
Added dependencies installer
pakozm Oct 28, 2013
38a9048
Added lua5.2 as dependency for linux
pakozm Oct 28, 2013
2cab045
Updated README with denpendencies installer info
pakozm Oct 28, 2013
a752937
Updated README with denpendencies installer info
pakozm Oct 28, 2013
54cbb9c
Updated README with denpendencies installer info
pakozm Oct 28, 2013
9dc3b77
Added research papers to readme file
pakozm Oct 28, 2013
af3b6a7
Solved bug when reading files from C++
pakozm Oct 30, 2013
a6f9ff8
Solved bug when reading files from C++, added to CHANGESLIST
pakozm Oct 30, 2013
d258ac2
Solved bug at C++ SlidingWindow::setAtWindow method
pakozm Oct 30, 2013
bb9d5d3
Solved bug at matrix select method
pakozm Oct 30, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGELIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ ChangeList
Master branch release
---------------------

- Solved bug at `Matrix<T>::select(...)` C++ method. The matrix offset wasn't be
added to the resulting matrix offset.
- Solved bug at `SlidingWindow::setAtWindow(...)` C++ method. The matrix offset
wasn't be added to the computed window position.
- Solved bug at `buffered_memory.h`. Such bug introduces an early stop when
reading matrices, ignoring the last lines of files.
- Added `DEPENDENCIES-INSTALLER.sh`.
- Added syntactic sugar for `matrix:slice(...)` method: `m("1:2","3:4")` or
`m({1,2},{3,4})`, like in Matlab or Octave.
- Solved problem with `rlcompleter`, which didn't work properly when loaded as a
Lua module.
- Modified `configure.sh` to inform about any error during Lua building.
- Loadable modules are working on MacOs X.
- Added `matrix.svd` and `matrix.diagonalize`.
- Added `stats.pca`, `stats.mean_centered`, `stats.pca_whitening`.

v0.3.0-beta relase
------------------

Expand Down
32 changes: 32 additions & 0 deletions DEPENDENCIES-INSTALLER.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
UNAME=`uname`
echo "System: $UNAME"
if [ $UNAME = "Linux" ]; then
if [ `which apt-get` ]; then
apt-get install libz-dev libreadline-dev libblas-dev libatlas-dev libpng12-dev libtiff-dev liblua5.2-dev ||
(echo "ERROR INSTALLING DEPENDENCIES" && exit 10)
else
echo "Error, impossible to install dependencies, this script only works with apt-get"
exit 10
fi
elif [ $UNAME = "Darwin" ]; then
if [ `which port` ]; then
port install zlib readline libpng tiff findutils ||
(echo "ERROR INSTALLING DEPENDENCIES" && exit 10)
echo "This script will change the default system BSD find by GNU find"
echo "BSD find will be renamed as bfind"
if [ ! -e /usr/find/bfind ]; then
mv /usr/bin/find /usr/find/bfind
else
rm -f /usr/bin/find
fi
ln -s `which gfind` /usr/bin/find
else
echo "Error, impossible to install dependencies, this scripts needs MacPorts"
exit 10
fi
else
echo "Error, impossible to install dependencies, not recognized system: $UNAME"
exit 10
fi
exit 0
52 changes: 44 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ April-ANN
Requirements
------------

Requires the following libraries. Versions are only orientative, it could work with older and newer versions.
Requires the following libraries. Versions are only orientative, it could work
with older and newer versions whenver the API was compatible.

- GNU C++ compiler (g++): v 4.7.2
- Only in Linux systems: Lua 5.2 headers to tell April-ANN the default system path for Lua modules (`lua5.2-deb-multiarch.h` header).
- BLAS implementation: ATLAS (v. 3), Intel MKL (v. 10.3.6), MacOS Accelerate Framework
- Threads posix (pthread)
- Readline (libreadline)
Expand All @@ -21,6 +23,11 @@ The following libreries are recommended, but optional:
For perform computation on GPU, this optional library:
- [OPTIONAL] CUDA and CUBLAS: release 4.2.6

It is possible to install dependencies in Linux (via apt-get) and in MacOS X
(via MacPorts) running:

- `$ sudo ./DEPENDENCIES-INSTALLER.sh`

Compilation
-----------

Expand Down Expand Up @@ -141,12 +148,33 @@ you can use this bibitem:

```bibtex
@misc{aprilann,
Author = {Francisco Zamora-Mart\'inez and Salvador Espa\~na-Boquera and Jorge Gorbe-Moya and Joan Pastor-Pellicer and Adrian Palacios},
Note = {{https://github.com/pakozm/april-ann}},
Title = {{April-ANN toolkit, A Pattern Recognizer In Lua with Artificial Neural Networks}},
Year = {2013}}
Author = {Francisco Zamora-Mart\'inez and Salvador Espa\~na-Boquera and
Jorge Gorbe-Moya and Joan Pastor-Pellicer and Adrian Palacios},
Note = {{https://github.com/pakozm/april-ann}},
Title = {{April-ANN toolkit, A Pattern Recognizer In Lua with Artificial Neural Networks}},
Year = {2013}}
```

Publications
------------

List of research papers which uses this tool:

- Francisco Zamora-Martínez, Pablo Romeu, Paloma Botella-Rocamora, and Juan
Pardo. [Towards Energy Efficiency: Forecasting Indoor Temperature via Multivariate Analysis](http://www.mdpi.com/1996-1073/6/9/4639).
*Energies*, 6(9):4639-4659, 2013.

- Pablo Romeu, Francisco Zamora-Martinez, Paloma Botella, and Juan Pardo.
[Time-Series Forecasting of Indoor Temperature Using Pre-trained Deep Neural Networks](http://dx.doi.org/10.1007/978-3-642-40728-4_57).
In *ICANN*, pages 451-458. 2013.

- Joan Pastor-Pellicer, Francisco Zamora-Martinez, Salvador España-Boquera, and M.J. Castro-Bleda.
[F-Measure as the error function to train Neural Networks](http://dx.doi.org/10.1007/978-3-642-38679-4).
In *Advances in Computational Intelligence, IWANN, part I*, LNCS, pages 376-384. Springer, 2013.

- F. Zamora-Martínez, Pablo Romeu, Juan Pardo, and Daniel Tormo.
Some empirical evaluations of a temperature forecasting module based on Artificial Neural Networks for a domotic home environment.
In *IC3K - KDIR*, pages 206-211, 2012.

Packages
--------
Expand Down Expand Up @@ -193,10 +221,18 @@ Doxygen documentation
LINUX installation
------------------

Install g++, libatlas-dev, libreadline-dev, libpng-dev, libtiff-dev, libz-dev, libopenmp-dev.
Install g++, libatlas-dev, libreadline-dev, libpng-dev, libtiff-dev, libz-dev,
libopenmp-dev or execute: `$ sudo ./DEPENDENCIES-INSTALLER.sh`

MAC OS X installation
---------------------

- Install libpng, from (sourceforge)[http://sourceforge.net/projects/libpng/files/]. Follow INSTALL information.
- Install findutils, from (GNU)[http://ftp.gnu.org/pub/gnu/findutils/]. Follow INSTALL instructions. Execute `./configure --prefix=/usr` in order to substitute BSD find of your MacOS.
Via MacPorts:

- Install [MacPorts](http://www.macports.org/)
- Execute `$ sudo ./DEPENDENCIES-INSTALLER.sh`

Or manually:

- Install libpng, from [sourceforge](http://sourceforge.net/projects/libpng/files/). Follow INSTALL information.
- Install findutils, from [GNU](http://ftp.gnu.org/pub/gnu/findutils/). Follow INSTALL instructions. Execute `./configure --prefix=/usr` in order to substitute BSD find of your MacOS.
20 changes: 20 additions & 0 deletions binding/bind_templates/luabind_template.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ void lua_push$$ClassName$$(lua_State *L, $$ClassName$$ *obj){
#include "luabindmacros.h"

int lua_new_$$ClassName$$_$$FILENAME2$$(lua_State *L) {
// stops garbage collector to avoid problems with reference counting
lua_gc(L, LUA_GCSTOP, 0);
lua_remove(L,1); // primer parametro es la metatabla __call(table,...)
$$ClassName$$ UNUSED *obj = 0;
DEBUG("lua_new_$$ClassName$$ (begin)");
Expand All @@ -184,10 +186,14 @@ int lua_new_$$ClassName$$_$$FILENAME2$$(lua_State *L) {
if (luabind_num_returned_values != 1) {
LUABIND_ERROR("constructors must return 1 (and only 1) value");
}
// restart the garbage collector
lua_gc(L, LUA_GCRESTART, 0);
return luabind_num_returned_values;
}

int lua_delete_$$ClassName$$_$$FILENAME2$$(lua_State *L){
// stops garbage collector to avoid problems with reference counting
lua_gc(L, LUA_GCSTOP, 0);
$$ClassName$$ *obj = lua_rawget$$ClassName$$_$$FILENAME2$$(L,1);
if (obj != 0) {
DEBUG_OBJ("lua_delete_$$ClassName$$ (begin)",obj);
Expand All @@ -202,6 +208,8 @@ int lua_delete_$$ClassName$$_$$FILENAME2$$(lua_State *L){
else {
DEBUG_OBJ("lua_delete_$$ClassName$$ WARNING!! NULL pointer", obj);
}
// restart the garbage collector
lua_gc(L, LUA_GCRESTART, 0);
return 0;
}

Expand Down Expand Up @@ -374,6 +382,8 @@ void bindluaopen_$$ClassName$$_$$FILENAME2$$(lua_State *L){
#include "luabindmacros.h"

int lua_call_$$ClassName$$_$$MethodName$$(lua_State *L){
// stops garbage collector to avoid problems with reference counting
lua_gc(L, LUA_GCSTOP, 0);
//Comprobamos que el primer elemento sea el userdata que esperamos
if (!lua_is$$ClassName$$(L,1)) {
lua_pushstring(L, "First argument of $$MethodName$$ must be of type "
Expand All @@ -389,6 +399,8 @@ int lua_call_$$ClassName$$_$$MethodName$$(lua_State *L){
$$code$$
}
DEBUG_OBJ("lua_call_$$ClassName$$_$$MethodName$$ (end)", obj);
// restart the garbage collector
lua_gc(L, LUA_GCRESTART, 0);
return luabind_num_returned_values;
}
//LUA end
Expand All @@ -401,11 +413,15 @@ int lua_call_$$ClassName$$_$$MethodName$$(lua_State *L){
int lua_call_class_$$ClassName$$_$$ClassMethodName$$(lua_State *L){

DEBUG("lua_call_class_$$ClassName$$_$$ClassMethodName$$");
// stops garbage collector to avoid problems with reference counting
lua_gc(L, LUA_GCSTOP, 0);
int luabind_num_returned_values = 0;
// CODE:
{
$$code$$
}
// restart the garbage collector
lua_gc(L, LUA_GCRESTART, 0);
return luabind_num_returned_values;
}
//LUA end
Expand All @@ -419,10 +435,14 @@ int lua_call_class_$$ClassName$$_$$ClassMethodName$$(lua_State *L){
#include "luabindmacros.h"

static int lua_call_$$string.gsub(func_name,"%p","_")$$(lua_State *L){
// stops garbage collector to avoid problems with reference counting
lua_gc(L, LUA_GCSTOP, 0);
lua_remove(L,1); // primer parametro es la metatabla __call(table,...)
DEBUG("lua_call_$$string.gsub(func_name,"%p","_")$$ (begin)");
int luabind_num_returned_values = 0;
$$code$$
// restart the garbage collector
lua_gc(L, LUA_GCRESTART, 0);
DEBUG("lua_call_$$string.gsub(func_name,"%p","_")$$ (end)");
return luabind_num_returned_values;
}
Expand Down
2 changes: 1 addition & 1 deletion binding/formiga.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ formiga = {
CPPcompiler = os.getenv("CXX") or "g++",
Ccompiler = os.getenv("CC") or "gcc",
extra_libs = {"-ldl"},
shared_extra_libs = {"-shared"},
shared_extra_libs = { },
extra_flags = { string.format("-DGIT_COMMIT=%d", commit_count), },
language_by_extension = {
c = "c", cc = "c++", cxx = "c++", CC = "c++", cpp = "c++",
Expand Down
1 change: 1 addition & 0 deletions build_NOBLAS_debug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ luapkg{
"-Wl,-E -ldl"
},
shared_extra_libs={
"-shared",
"-llua5.2",
},
},
Expand Down
1 change: 1 addition & 0 deletions build_NOBLAS_release.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ luapkg{
"-Wl,-E -ldl"
},
shared_extra_libs={
"-shared",
"-llua5.2",
},
},
Expand Down
9 changes: 9 additions & 0 deletions build_cuda_and_mkl_debug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ luapkg{
program_name = "april-ann.debug",
verbosity_level = 0, -- 0 => NONE, 1 => ONLY TARGETS, 2 => ALL
packages = packages,
version_flags = dofile "VERSION.lua",
disclaimer_strings = dofile "DISCLAIMER.lua",
global_flags = {
debug="yes",
use_lstrip = "no",
Expand All @@ -24,11 +26,14 @@ luapkg{
"-msse",
"-pg",
"-DNO_POOL",
"-DNO_OMP",
"-fPIC",
-- For CUDA
"-I/usr/local/cuda/include",
"-L/usr/local/cuda/lib",
},
extra_libs={
"-fPIC",
"-pg",
"-lpthread",
"-rdynamic",
Expand All @@ -43,6 +48,10 @@ luapkg{
-- For CUBLAS
"-lcublas",
},
shared_extra_libs={
"-shared",
"-llua5.2",
},
},

main_package = package{
Expand Down
9 changes: 9 additions & 0 deletions build_cuda_and_mkl_release.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ luapkg{
program_name = "april-ann",
verbosity_level = 0, -- 0 => NONE, 1 => ONLY TARGETS, 2 => ALL
packages = packages,
version_flags = dofile "VERSION.lua",
disclaimer_strings = dofile "DISCLAIMER.lua",
global_flags = {
debug="no",
use_lstrip = "yes",
Expand All @@ -24,11 +26,14 @@ luapkg{
"-msse",
"-DNDEBUG",
"-DNO_POOL",
"-DNO_OMP",
"-fPIC",
-- For CUDA
"-I/usr/local/cuda/include",
"-L/usr/local/cuda/lib",
},
extra_libs={
"-fPIC",
"-lpthread",
"-rdynamic",
-- For Intel MKL :)
Expand All @@ -42,6 +47,10 @@ luapkg{
-- For CUBLAS
"-lcublas",
},
shared_extra_libs={
"-shared",
"-llua5.2",
},
},

main_package = package{
Expand Down
1 change: 1 addition & 0 deletions build_debug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ luapkg{
"-llapack_atlas",
},
shared_extra_libs={
"-shared",
"-llua5.2",
},
},
Expand Down
2 changes: 2 additions & 0 deletions build_debug_macosx.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ luapkg{
"-fPIC",
},
shared_extra_libs={
"-flat_namespace",
"-bundle",
assert(io.popen("pkg-config --libs 'lua >= 5.2'"):read("*l"))
},
},
Expand Down
1 change: 1 addition & 0 deletions build_mkl_debug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ luapkg{
"-liomp5"
},
shared_extra_libs={
"-shared",
"-llua5.2",
},
},
Expand Down
1 change: 1 addition & 0 deletions build_mkl_release.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ luapkg{
"-liomp5",
},
shared_extra_libs={
"-shared",
"-llua5.2",
},
},
Expand Down
1 change: 1 addition & 0 deletions build_release.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ luapkg{
"-llapack_atlas",
},
shared_extra_libs={
"-shared",
"-llua5.2",
},
},
Expand Down
2 changes: 2 additions & 0 deletions build_release_macosx.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ luapkg{
"-fPIC",
},
shared_extra_libs={
"-flat_namespace",
"-bundle",
assert(io.popen("pkg-config --libs 'lua >= 5.2'"):read("*l"))
},
},
Expand Down
1 change: 1 addition & 0 deletions build_release_pi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ luapkg{
"-llapack_atlas",
},
shared_extra_libs={
"-shared",
"-llua5.2",
},
},
Expand Down
7 changes: 4 additions & 3 deletions configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ if [ -z $APRILANN_CONFIGURED ]; then
#export LUA_PATH="`pwd`""/binding/?.lua;?"
fi
export LUA_DIR="`pwd`"/lua/lua-5.2.2
make -C $LUA_DIR
make -C $LUA_DIR install
make -C "`pwd`"/lua/lstrip
(make -C $LUA_DIR &&
make -C $LUA_DIR install &&
make -C "`pwd`"/lua/lstrip) ||
(echo "Error building Lua!!!" && exit -1)
if [ -z $APRIL_EXEC ]; then
export APRIL_EXEC=`pwd`/bin/april-ann
fi
Expand Down
2 changes: 1 addition & 1 deletion lua/lua-5.2.2/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ ALL_A= $(LUA_A)

# Targets start here.
DetectOS:
-@make $(UNAME)
@make $(UNAME)

Linux: linux

Expand Down
Loading