Skip to content

Commit

Permalink
Merge branch 'migrate-to-maven'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikio L. Braun committed Jan 7, 2011
2 parents ecf1dea + b24f1a1 commit 43038ea
Show file tree
Hide file tree
Showing 106 changed files with 6,053 additions and 411 deletions.
9 changes: 0 additions & 9 deletions .classpath

This file was deleted.

23 changes: 0 additions & 23 deletions .project

This file was deleted.

4 changes: 3 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ Mikio L. Braun
Additional Programming and Contributions:

Johannes Schaback
Jan Saputra Müller
Jan Saputra Müller (exponential matrix multiplication, decomposition)
Matthias L. Jugel (packaging)
Nicolas Oury (generalized eigenvectors)
82 changes: 55 additions & 27 deletions BUILDING_ATLAS
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,29 @@ git clone git://github.com/mikiobraun/jblas.git

The general steps are as follows:

* Compile lapack. Lapack uses blas for its low-level computations. ATLAS also
implements a subset of Lapack, but not all routines. But you can build ATLAS
to include the Lapack routines it does not implement, and this is what we're
going to do.
* Compile lapack. Lapack uses blas for its low-level
computations. ATLAS also implements a subset of Lapack, but not all
routines. But you can build ATLAS to include the Lapack routines it
does not implement, and this is what we're going to do.

* Compile ATLAS.

* Compile the native part of jblas with "make".

* Compile the java part of jblas with "ant".
* Compile the java part of jblas with "ant" or maven.

The ATLAS build process is a bit, well, unusual, coming with compiled (not scripted)
configuration scripts. ATLAS has prebuilt configurations which result in much
faster compilation times. If it doesn't find such a profile for your computer,
it will perform a large number of timing experiments to find the best combination
(hence the name "Automatically Tuned...").
The ATLAS build process is a bit, well, unusual, coming with compiled
(not scripted) configuration scripts. ATLAS has prebuilt
configurations which result in much faster compilation times. If it
doesn't find such a profile for your computer, it will perform a large
number of timing experiments to find the best combination (hence the
name "Automatically Tuned...").

Finally, some older processors don't support the SSE3 command set. Some tweaking
is necessary to compile ATLAS for SSE2, namely configuring as for SSE3, and
then going into the file "Make.inc", and replacing SSE2 by SSE3 or removing -DATL_SSE3
from the compiler directives.
Finally, some older processors don't support the SSE3 command
set. Some tweaking is necessary to compile ATLAS for SSE2, namely
configuring as for SSE3, and then going into the file "Make.inc", and
replacing SSE2 by SSE3 or removing -DATL_SSE3 from the compiler
directives.

For reference, here is a list of the main ATLAS options.

Expand Down Expand Up @@ -129,7 +131,8 @@ ATLAS Operating System Options: (-O)
LAPACK
------

Copy make.inc.LINUX from INSTALL directory, update options in the file like this:
Copy make.inc.LINUX from INSTALL directory, update options in the file
like this:

FORTRAN = gfortran
OPTS = -O2 -fPIC
Expand Down Expand Up @@ -218,15 +221,17 @@ It's important to set the 32bit flag. Otherwise, it seems to construct
5. Windows XP (32bit)
=====================

I'm describing here using cygwin. For some reason, the gcc4 version in cygwin
does not support compiling to mingw, but using the cygwin version leads
to some address spaces clashes with Java (at least, the last time I checked),
leading to a crash as soon as the cygwin compiled code is loaded.
I'm describing here using cygwin. For some reason, the gcc4 version in
cygwin does not support compiling to mingw, but using the cygwin
version leads to some address spaces clashes with Java (at least, the
last time I checked), leading to a crash as soon as the cygwin
compiled code is loaded.

What all of this means is that you should use the old gcc3 "legacy" compilers.
What all of this means is that you should use the old gcc3 "legacy"
compilers.

Also watch out for directory names with spaces in them, ATLAS does not like
them.
Also watch out for directory names with spaces in them, ATLAS does not
like them.

LAPACK
------
Expand All @@ -245,8 +250,31 @@ compiler explicitly to "g77" (and the bit numbers to 32):
64-bit
------

Unfortunately, there is no support for 64bit under Windows right now,
mainly because there is no 64bit mingw compiler in cygwin. There
exists the mingw-w64 bit project
(http://sourceforge.net/projects/mingw-w64/), but I didn't managed to
compile ATLAS using those.
Unfortunately, it is currently not possible to compile ATLAS for 64bit
under windows, mainly because cygwin is 32bit. There exists the
ming-w64 bit project (http://sourceforge.net/projects/mingw-w64/),
which provides 64bit compiler for the MINGW environment (a subset of
the UNIX- like environment cygwin provides, unfortunately insufficient
to build ATLAS).

What you can do, though,

Pure LAPACK-build on Windows 64 bit
-----------------------------------

Install the x86_64-w64-mingw32 compilers (just about everything except
for ada and objective C) ;)

In order to run fortran files, you might need to put

x86_64-w64-mingw32/sys-root/mingw/bin/

into your PATH.

Then, go into lapack-lite, and edit make.inc such that gfortran is
replaced by x86_64-w64-mingw32-gfortran everywhere. You should also
include the -funroll-all-loops -O3 options.

Compile using "make -k blaslib lapacklib" as usual, and rename the
results to libblas.a and liblapack.a. Then, do a normal lapack build.

24 changes: 22 additions & 2 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
INSTALL Guide

Version 1.2.0, January 7, 2011
Version 1.0, December 22, 2009
Version 0.3, September 17, 2009
Version 0.2, May 8, 2009
Expand All @@ -22,6 +23,9 @@ If you are only adding code on the Java side, then you can work with
the supplied build.xml ant script. Simply type "ant jar" to compile
the new jar file.

Starting with version 1.2.0, you can also use maven to compile the project.
Both alternatives exist in parallel.

If you want to access further functions from LAPACK, you need to
recompile the native part. This procedure is a bit more involved, see
below.
Expand All @@ -33,8 +37,12 @@ COMPILING JBLAS (JAVA PART)
Prerequisites:
- java JDK
- ant
- maven
- ruby

ANT BUILD
---------

Running "ant clean jar" should do the job ;)

"ant jar" collects all static JNI libraries. Other build targets are:
Expand All @@ -54,14 +62,20 @@ Running "ant clean jar" should do the job ;)
Build a jar file without the JNI and ATLAS libraries. Both must be
installed in the usual library locations.

MAVEN BUILD
-----------

Just the usual "mvn clean install" builds everything and installs the jar
file in your local repository.

INSTALLING JBLAS
----------------

1. Add "jblas-1.0.jar" to your CLASSPATH
1. Add "jblas-1.2.0.jar" to your CLASSPATH

2. By default, the dynamic libraries are extracted from the jar file
to the default temporary directory and loaded from there. If you
don't want to do this, extract the dynamic library from jblas-0.2.jar
don't want to do this, extract the dynamic library from jblas-1.2.0.jar
and copy it somewhere where it can be found.

For Linux, use LD_LIBRARY_PATH, for Windows, PATH
Expand Down Expand Up @@ -130,6 +144,12 @@ The configure script understands the following options:
Searches for static libraries only. Resulting jblas will not depend on
shared LAPACK/BLAS/ATLAS libraries. Default for Windows XP.

--ptatlas
Uses multithreaded versions of the ATLAS libraries. AFAIK, these should
be compiled on the target computer to have the right number of threads.
This means you have to recompile ATLAS, but it is certainly worth
the effort, performance improvements are really huge!

--help
print help

Expand Down
38 changes: 24 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
## --- END LICENSE BLOCK ---

VERSION=1.1.1
VERSION=1.2.0

######################################################################
#
Expand All @@ -54,11 +54,18 @@ PACKAGE=org.jblas
# generate path from package name
PACKAGE_PATH=$(subst .,/,$(PACKAGE))

LIB_PATH=native-libs/$(LINKAGE_TYPE)/$(OS_NAME)/$(OS_ARCH)
FULL_LIB_PATH=native-libs/$(LINKAGE_TYPE)/$(OS_NAME)/$(OS_ARCH_WITH_FLAVOR)
SRC=src/main
SRC_JAVA=$(SRC)/java
SRC_C=$(SRC)/c
RESOURCES=$(SRC)/resources

GENERATED_SOURCES=src/$(PACKAGE_PATH)/NativeBlas.java native/NativeBlas.c
GENERATED_HEADERS=include/org_jblas_NativeBlas.h include/org_jblas_util_ArchFlavor.h
TARGET_C=target/c

LIB_PATH=$(RESOURCES)/lib/$(LINKAGE_TYPE)/$(OS_NAME)/$(OS_ARCH)
FULL_LIB_PATH=$(RESOURCES)/lib/$(LINKAGE_TYPE)/$(OS_NAME)/$(OS_ARCH_WITH_FLAVOR)

GENERATED_SOURCES=$(SRC_JAVA)/$(PACKAGE_PATH)/NativeBlas.java $(SRC_C)/NativeBlas.c
GENERATED_HEADERS=$(SRC_C)/org_jblas_NativeBlas.h $(SRC_C)/org_jblas_util_ArchFlavor.h
SHARED_LIBS=$(FULL_LIB_PATH)/$(LIB)jblas.$(SO) $(LIB_PATH)/$(LIB)jblas_arch_flavor.$(SO)

#######################################################################
Expand Down Expand Up @@ -91,7 +98,7 @@ generate-wrapper: $(GENERATED_SOURCES) $(GENERATED_HEADERS)

# Clean all object files
clean:
rm -f native/*.o native/*.$(SO) $(LIB_PATH)/*.$(SO) $(FULL_LIB_PATH)/*.$(SO) src/$(PACKAGE_PATH)/NativeBlas.java generated-sources
rm -f native/*.o native/*.$(SO) $(LIB_PATH)/*.$(SO) $(FULL_LIB_PATH)/*.$(SO) $(SRC_JAVA)/$(PACKAGE_PATH)/NativeBlas.java $(SRC_C)/NativeBlas.c generated-sources

# Full clean, including information extracted from the fortranwrappers.
# You will need the original fortran sources in order to rebuild
Expand All @@ -110,7 +117,7 @@ endif
generated-sources: \
scripts/fortranwrapper.rb scripts/fortran/types.rb \
scripts/fortran/java.rb scripts/java-class.java scripts/java-impl.c \
src/org/jblas/util/ArchFlavor.java #src/org/jblas/NativeBlas.java
$(SRC_JAVA)/org/jblas/util/ArchFlavor.java #src/org/jblas/NativeBlas.java
$(RUBY) scripts/fortranwrapper.rb --complexcc $(CCC) $(PACKAGE) NativeBlas \
$(BLAS)/[sdcz]copy.f \
$(BLAS)/[sdcz]swap.f \
Expand All @@ -137,20 +144,23 @@ generated-sources: \
ant javah
touch $@

native/NativeBlas.c: generated-sources
$(SRC_C)/NativeBlas.c: generated-sources

$(TARGET_C):
mkdir $(TARGET_C)

native/NativeBlas.o: native/NativeBlas.c
$(CC) $(CFLAGS) $(INCDIRS) -c native/NativeBlas.c -o $@
$(TARGET_C)/NativeBlas.o: $(SRC_C)/NativeBlas.c $(TARGET_C)
$(CC) $(CFLAGS) $(INCDIRS) -c $(SRC_C)/NativeBlas.c -o $@

native/jblas_arch_flavor.o: generated-sources
$(CC) $(CFLAGS) $(INCDIRS) -c native/jblas_arch_flavor.c -o $@
$(TARGET_C)/jblas_arch_flavor.o: generated-sources
$(CC) $(CFLAGS) $(INCDIRS) -c $(SRC_C)/jblas_arch_flavor.c -o $@

# Move the compile library to the machine specific directory.
$(FULL_LIB_PATH)/$(LIB)jblas.$(SO) : native/NativeBlas.$(SO)
$(FULL_LIB_PATH)/$(LIB)jblas.$(SO) : $(TARGET_C)/NativeBlas.$(SO)
mkdir -p $(FULL_LIB_PATH)
mv "$<" "$@"

$(LIB_PATH)/$(LIB)jblas_arch_flavor.$(SO): native/jblas_arch_flavor.$(SO)
$(LIB_PATH)/$(LIB)jblas_arch_flavor.$(SO): $(SRC_C)/jblas_arch_flavor.$(SO)
mkdir -p $(LIB_PATH)
mv "$<" "$@"

Expand Down
16 changes: 9 additions & 7 deletions README
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
jblas is a matrix library for Java which uses existing high
performance BLAS and LAPACK libraries like ATLAS.

Version 1.2.0, January 7, 2011
Version 1.1.1
Version 1.1, August 16, 2010
Version 1.0.2, February 26, 2010
Expand All @@ -16,8 +17,8 @@ Homepage: http://jblas.org

INSTALL

In principle, all you need is the jblas-1.1,jar in your
classpath. jblas-1.1.jar will then automagically extract your platform
In principle, all you need is the jblas-1.2.0,jar in your
classpath. jblas-1.2.0.jar will then automagically extract your platform
dependent native library to a tempfile and load it from there. You can
also put that file somewhere in your load path ($LD_LIBRARY_PATH for
Linux, %PATH for Windows).
Expand All @@ -39,22 +40,23 @@ with either plain lapack, or ATLAS
sources for BLAS and LAPACK, available, for example from
http://www.netlib.org/lapack/lapack-lite-3.1.1.tgz.

If you still want to build the source your own, see INSTALL for further
details.
If you still want to build the source your own, see INSTALL for
further details.


HOW TO GET STARTED

Have a look at javadoc/index.html and javadoc/org/jblas/DoubleMatrix.html
Have a look at javadoc/index.html and
javadoc/org/jblas/DoubleMatrix.html

If you want to validate your installation and get some performance
numbers, try "java -server -jar jblas-1.1.jar", or drop the server
numbers, try "java -server -jar jblas-1.2.0.jar", or drop the server
in case, you only have the "client" JVM installed.


LICENSE

jblas is distributed under a BSD-style license. See the file LICENSE
jblas is distributed under a BSD-style license. See the file COPYING
for more information.


Expand Down
26 changes: 26 additions & 0 deletions RELEASE_NOTES
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
Release 1.2.0 - January 7, 2011

- Added Generalized Eigenvalues for symmetric matrices (which you
need, for example, for Canoncial Correlation Analysis). See
org.jblas.Eigen.

- Added pure-LAPACK build to Windows 64. Not as nearly as fast as
ATLAS, but still 50% over pure Java implementation (for example, for
DGEMM).

- Changed build system to maven. Actually, the build.xml from the ant
file still exists and can also be used, but now you also have a
pom.xml.

- As a side effect of the change to maven, test suites are now
actually run during the build ;)

Some bugs:

- Fortran functions returning floats (e.g. SDOT) returned 0.0. Fixed
now.

- Bug in some complex numbers routines.

---------------------------------------------------------------------

Release 1.1.1

Mostly bug fixes
Expand Down
Loading

0 comments on commit 43038ea

Please sign in to comment.