This is Google's cache of http://www.kevinsheppard.org/research/MatlabAtlas/default.aspx. It is a snapshot of the page as it appeared on 20 May 2008 09:33:47 GMT. The current page could have changed in the meantime. Learn more »

Text-only version
These search terms are highlighted: kevin sheppard matlab atlas  

Kevin K. Sheppard

Instructions for Creating an Atlas DLL for Matlab 6.x in Windows NT/2000/XP

 

The purpose of this page is the give detailed instructions on how to make you own Atlas BLAS for use in Matlab.  The ones the MathWorks have provided with Matlab are no longer current and under perform.  This is true even for Matlab 6.5.  The provided DLL creation script also produces an import library if you're interested in linking your own code to Atlas.

 

Index

Setup

Building Atlas

Precompiled Atlas Binaries

 

 

 

Setup

Perform the following:

  • install Cygwin (typically to c:\cygwin)

    I complete set of (minimal and known to work) packages including installer are available here.

    Make sure to add c:\cygwin\bin to the path and add the ntsec flag to the CYGWIN environment variable.   These steps are discussed in the "Setting Up Cygwin" section of the cygwin user's guide.  Adding c:\cygwin\bin to the path is part of the standard Cygwin installation.  Setting ntsec is necessary for chmod to work under Cygwin, and chmod is critical for building Atlas.  The Atlas makefiles build a number of executables to probe for various processor features and have to chmod +x them before the probes can be run.  As noted in the Cygwin User's Manual, Cygwin's chmod doesn't work under Windows 95 and 98 since Windows 9x cannot emulate Unix permissions.

    The latest (as of 1.15.2004) cygwin is fully capable of building the library on PIIIs, P4s, and Athlon XPs (Sorry, these are all I have).

    Note for those using a Windows login which is not part of the local Windows domain:

    The Cygwin installer sets /etc/passwd and /etc/groups to the output of mkpasswd -l and mkgroup -l, respectively.  This should work fine if you are using a local Windows login, but chmod will not work out of the box if you are using a login from something besides the local domain.  This is because chmod can't find the login in the default /etc/passwd.  To fix this, do something like "mkpasswd -u user -d domain >> /etc/passwd", where user and domain are the Windows username and domain name you're using.

     

  • download the bash script for creating Atlas DLLs
  • alternatively, download the new and inproved script which uses gcc instead of dllwrap (which is now depricated). This script can also make libraries compatible with MSVC6 by removing certain comment markers. With a tiny bit of editing, it would also be possible to make it compatible with MSVC7 (or 7.1)

    These are available from the link below.

     

You'll need the following:

 

  • bash script for creating Atlas DLLs using GCC (recommended, for version 6.5 and 6.5.1)

    bash script for creating Atlas DLLs using GCC (recommended for version 6.1/6.0)

    This does all the work in transforming the statically linked library produced into by the Atlas build process into a shared DLL but uses GCC. It can also make libraries which export the C references and work with both GCC and MSVC6.  The different build scripts are needed because TWM exports different subsets of ATLAS in different builds.

  • Atlas

    You need either a development snapshot or a stable release.  If you use the stable, please read the erratta and make any corrections appropriate to your platform. It is strongly recommended that you use the stable (and fix the erratta) as the development builds often won't build on cygwin. 

    I have applied the errata fixes for both 3.4.2 and 3.6.0.  Click to downloaded the pre-patched source.

  • Cygwin

    You need the entire base distribution, as well as these packages (some may not actually be needed, but I know this set-up works)

    • devel

      autoconf

      binutils

      gcc

      gcc-g++

      gcc-g77

      gcc-mingw

      gcc-mingw-g++

      gcc-mingw-g77

      make

      mktemp

    • interpreters

      gawk

      m4

      perl

    • libs

      libncurses5

      libncurses6

      mingw-runtime

      ncurses

      termcap

      win32api

      zlib

 

 

Building Atlas

If convenient, log in to the Windows box you're using as a local administrator (occasional problems have been encountered when trying to build Atlas withou administrator priviledges).   Place the atlasX.Y.Z.tgz distribution you've downloaded in c:\cygwin.  Launch a Cygwin bash shell and type the following commands in order:

mkdir atlas

cd atlas

gunzip /atlasX.Y.Z.tgz -OR- bzip2 -s /atlasX.Y.Z.bz2

tar -xvf /atlasX.Y.Z.tar

cd ATLAS

make config

gcc will be called to build Atlas's xconfig program and xconfig will be run.

 

You will get a series of questions from xconfig.  Here are typical answers:

Enter Number at Top left of Screen[0]: <Enter>

Are you ready to continue? [y] :<Enter>

Are you using a cross-compiler? [n]: <Enter>

Enter machine number [1]: [Enter the number of the type of processor you have]

Enter compiler number [1]: 3 (Unless you have Compaq Visual Fortran)

use express setup? [y]: <Enter>

Enter Architecture name (ARCH) [WinNT_P4SSE2]: <Enter> (or you can rename it)

Enter Maximum cache size (KB) [512]: <Enter>

Enter File creation delay in seconds [0]:<Enter>

Use supplied default values for install? [y]:<Enter>

xconfig will probe for a BLAS and complain about not finding one.  This is fine.

 

At the bottom of the output from xconfig, you will see something like this:

make install arch=WinNT_P4SSE2

Enter this at the command prompt to start building Atlas.  Go have a beer.  The build should take around 35 minutes on a 2GHz processor. NOTE: Building with gcc 3.3.1 works fine now.

 

For CPUs not listed by Atlas's xconfig, you can experiment.  Here are Kevin's recommendations:

 

CPU Target
Athlon, Duron AMD Athlon
Celeron PII
Pentium - M (Centrino) Pentium 4
Pentium 4 Pentium 4
Opteron, Athlon64 PIII (or AMD Opteron 32 bit if trying 3.5.x)
Pentium 4 based Celeron Pentium 4
Celeron II PIII
K6, K6-2, K6-2+, K6-3 Either Unknown, PII, or Pentium Pro
Pentium Either Unknown, PII, or Pentium Pro
Cyrix (all types) Either Unknown, PII, or Pentium Pro

 

Atlas's maximum cache size has a significant effect on performance.  Depending on your system, the type of workload, and the version of Atlas, Atlas's default cache size setting may or may not provide optimum performance.  The best alternate choice appears to be roughly double the processor's cache size.  Cache sizes and alternate settings for recent processors are listed below.  Builds from gcc 2.95.3-10 and gcc 3.2 appear very close in performance, with gcc 2.95 being perhaps a small fraction of a percent faster than 3.2.

 

AMD cache size, kB alternate Atlas setting, kB
Opteron (depends on on model) 512 - 2048 1024 - 4096
Athlon XP (Barton) 512 1024
Athlon XP 256 512
Athlon Thunderbird 256 512
Athlon Classic 512 512
Duron II (Morgan) 128+64 256
Duron 128+64 256
K6 64+motherboard 1024
K6-2 64+motherboard 1024
K6-2+ 128+motherboard 1024
K6-3 256+motherboard 1024
     
Intel cache size, kB alternate Atlas setting, kB
Pentium - M (Centrino) 1024 2048
P4 Northwood or Xeon (512kb) 512 1024
P4 Willamette (256kb) 256 512
PIII Tulatin-S (512kb) 512 1024
PIII Tulatin 256 512
PIII Coppermine (256kb) 256 512
PIII Katami 512 1024
PII 512 1024
Pentium Pro 256(usual) 512
Pentium 32+ motherboard 1024

 

After the build finishes, extract the bash script for creating Atlas DLLs to c:\cygwin\home\<user name>\3.2.1\Atlas\lib\<ARCH>\ where <user name> is your username and <ARCH> is the name you chose in step 6 (WinNT_P4SSE2, or whatever).

 

Type:

cd lib

cd <ARCH>

./linkAtlasGCC.bash

-OR-

cd lib

cd <ARCH>

./buildMatlabAtlas.bash

You will see text saying

Linking Dll...

When it's finished you will have a DLL named atlas_local.dll and an import library named atlas_local.lib.  Copy the DLL to your <MATLAB_ROOT>\bin\win32 directory.

 

Copy of <MATLAB_ROOT>\bin\win32\blas.spec to blas.spec.old.  Open blas.spec in notepad or any text editor.  Edit the line which specified your CPU, replacing atlas_CPUNAME.dll with atlas_local.dll.  Finished.  Fire up Matlab.

 

 

 

Precompiled Atlas Binaries

Below is a set of pre-complied libraries.  These are provided for entertainment only and with no warrantee.  They should not be used if someone life may depend on the calculations.  That said, the performance from them is better then the MathWorks supplied ATLAS, esp the 3.3.x series (still under development, up to 50% faster, more on P4s).  Select your processor to download the appropriate DLL.  If you use one of these, you need to edit your blas.spec(step 12), replacing atlas_local.dll with the name of the file extracted from the zip (PIII-512.3.3.13.dll for instance).

 

 

Download if you have 6.0 or 6.1

 

3.4.2 (stable, mature) 3.6.0 (stable, but newer)
PIII 512kB Cache PIII 512kB Cache
PIII 256kB Cache PIII 256kB Cache
Duron XP 64kB Cache (Older, classic Duron here) Duron XP 64kB Cache (Older, classic Duron here)
AthlonXP 256kB Cache AthlonXP 256kB Cache
AthlonXP 512kB Cache AthlonXP 512kB Cache
P4 256kB Cache P4 256kB Cache
P4 512kB Cache P4 512kB Cache
Pentium-M (centrino) 1MB cache Pentium-M (centrino) 1MB cache
Opteron/AthlonFX 1MB Cache Opteron/AthlonFX 1MB Cache
Athlon64 512kB cache Athlon64 512kB cache

 

 

Download if you have 6.5 or 6.5.1

 

3.4.2 (stable, mature) 3.6.0 (stable, but newer)
PIII 512kB Cache PIII 512kB Cache
PIII 256kB Cache PIII 256kB Cache
Duron 64kB Cache (Older, classic Duron here) Duron 64kB Cache (Older, classic Duron here)
AthlonXP 256kB Cache AthlonXP 256kB Cache
AthlonXP 512kB Cache AthlonXP 512kB Cache
P4 256kB Cache P4 256kB Cache
P4 512kB Cache P4 512kB Cache
Pentium-M (centrino) 1MB cache Pentium-M (centrino) 1MB cache
Opteron/AthlonFX 1MB Cache Opteron/AthlonFX 1MB Cache
Athlon64 512kB cache Athlon64 512kB cache

 

Note: These libraries are probably under the GNU Public License (I think they statically link to some GPL'd code).  The source is fully liked from this page (Atlas, Cygwin, and the bash script).

 

 

Kevin Sheppard and Todd West

last updated 5.19.2002