1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
|
INSTALL Guide
Version 1.2.4, May 11, 2015
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
Version 0.1, March 28, 2009
COMPILING JBLAS (JAVA PART)
===========================
Prerequisites:
- java JDK
- ant
- maven
- ruby
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.2.4.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-1.2.0.jar
and copy it somewhere where it can be found.
For Linux, use LD_LIBRARY_PATH, for Windows, PATH
ANT BUILD
---------
(Ant build is only used for historical purposes, and to trigger the
regeneration of Float variants from Double files)
Running "ant clean jar" should do the job ;)
"ant jar" collects all static JNI libraries. Other build targets are:
- ant dynamic-lean-jar
Build a jar file with the JNI libraries, but without the ATLAS libraries
built in for only the current platform.
- ant static-lean-jar
Build a jar file with the JNI and ATLAS libraries only for the current
platform.
- ant minimal-jar
Build a jar file without the JNI and ATLAS libraries. Both must be
installed in the usual library locations.
COMPILING THE NATIVE PART
=========================
I assume that you already have a built of lapack-lite or ATLAS based
on the lapack-lite libraries. That build process is quite
involved. You can find some information about it in
BUILDING_ATLAS. You can also use the atlas libraries which come with
your distribution.
The build goes like this:
- run ./configure with options (see below)
- run "make clean all" to build the JNI library
- run "mvn clean package" to package the library into the jar file
BUILD OPTIONS
-------------
Dynamic vs. Static
Basically, you can build with "dynamic" binding or "static" binding,
which means that either the JNI library is dynamically loading the
lapack libraries, or they are already linked into it. The latter case
("static") is better for standalone cases, but the resulting jar file
is bigger.
The default is dynamic binding, otherwise pass the option
"--static-libs" to the configure script.
This option also affects what libraries "ant jar" packs into the jar file.
LAPACK build vs. ATLAS build
You can either build against LAPACK only, or against the ATLAS
libraries. LAPACK is somewhat slower, but probably easier to
compile. To compile against LAPACK, pass the "--lapack-build"
option. I also recommend to use the "--libpath" option to specify
exactly where the libraries are.
CONFIGURE FLAGS SUMMARY
The configure script understands the following options:
--lapack=DIR
Location where the LAPACK and BLAS sources can be found. Location of
the extracted lapack-lite files. Otherwise it is assumed that they
can be found in the jblas directory
--lapack-build
Build only against LAPACK and BLAS, not ATLAS. Note that depending on
your configuration, you might still get an ATLAS version (for example, when
you compile under debian and ATLAS is installed). Use --static-libs then.
--download-lapack
Download and unpack lapack-lite here if not found.
--static-libs
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
--libpath=DIR1:DIR2:...
Specify the directory where the files will lie
--build-type=TYPE
Tweak the libraries to look for. TYPE is one of atlas, lapack, openblas, and nvblas
--libs=LIB1,LIB2,...
Building against different versions of LAPACK and BLAS libraries. In principle,
using these flags you can fully specify which libraries to try in which directories.
The configure script will then go through those libraries in the specified directories
and look whether it can find a few core methods.
The --built-type flag presets the libraries a bit, but otherwise doesn't change much.
Once configured with the --static-libs flag, "make all" links against the libraries
and copies the resulting shared library to the corresponding directory to be included
with the resulting jar file.
SOME INTERNAL NOTES
-------------------
Here is some of the stuff that happens
- configure executes the Ruby scripts in the config directory to generate
configure.out
- configure.out is used by the Makefile to set the right variables
- make clean all also reconstructs the files using "ant javah" to generate
the headers
- maven can be used to compile the Java portion of Java, but it calls into
ant which runs the ruby scripsts class_to_float.rb and static_class_to_float.rb
to construct Float variants of many Double classes, or fill in float based
code in classes like org.jblas.Eigen
- last time I checked, I needed to build the final libs on an older version of
CentOS so that it runs on Linux 2.6
|