Initial commit of LINALG build scripts.
authorJianzhongXu <a0869574@ti.com>
Fri, 6 Feb 2015 15:29:35 +0000 (10:29 -0500)
committerJianzhongXu <a0869574@ti.com>
Fri, 6 Feb 2015 15:29:35 +0000 (10:29 -0500)
build/tar_files_list.txt [new file with mode: 0644]
build/version.txt [new file with mode: 0644]
build_linalg.sh [new file with mode: 0755]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/rules [new file with mode: 0644]
debian/ti-linalg.install [new file with mode: 0644]
make.inc [new file with mode: 0644]
makefile [new file with mode: 0644]

diff --git a/build/tar_files_list.txt b/build/tar_files_list.txt
new file mode 100644 (file)
index 0000000..b79ebe2
--- /dev/null
@@ -0,0 +1,35 @@
+make.inc
+makefile
+debian
+blis/build
+blis/CHANGELOG
+blis/config
+blis/configure
+blis/CREDITS
+blis/frame
+blis/install
+blis/INSTALL
+blis/kernels
+blis/lib
+blis/LICENSE
+blis/Makefile
+blis/mpi_test
+blis/README
+blis/test
+blis/testsuite
+blis/version
+blasblisacc/lib
+blasblisacc/Makefile
+blasblisacc/src
+cblas/examples
+cblas/include
+cblas/lib
+cblas/Makefile
+cblas/Makefile.ARM
+cblas/Makefile.C66
+cblas/Makefile.in
+cblas/README
+cblas/README.TI
+cblas/src
+cblas/testing
+
diff --git a/build/version.txt b/build/version.txt
new file mode 100644 (file)
index 0000000..bd2666a
--- /dev/null
@@ -0,0 +1 @@
+1.0.0.0
\ No newline at end of file
diff --git a/build_linalg.sh b/build_linalg.sh
new file mode 100755 (executable)
index 0000000..21efb36
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/bash
+set -e
+
+################################################################################
+#BLIS-BLAS specific: 
+# C6X_GEN:c6000_7.6.0
+# TI_OCL_INSTALL_DIR=/opt/ti/mcsdk-hpc_03_00_01_04/ti-opencl_0.14.0/
+# need to set up the following before running this script:
+#    export TARGET_ROOTDIR=/evmk2h_nfs
+#    export TI_INSTALL_DIR=~/ti
+################################################################################
+
+if [ $# -ne 3 ]; then
+  echo "Usage: $0 <linalg_base_dir> <mcsdk_hpc_dir> <output_dir>";
+  exit 1;
+fi
+
+cd $1
+LINALG_BASE_DIR=`pwd`
+cd - 
+
+cd $2
+MCSDK_HPC_DIR=`pwd`
+cd -
+
+cd $3
+OUTPUT_DIR=`pwd`
+cd -
+
+[ ! -z $MCSDK_HPC_DIR ] || { echo "Error: $MCSDK_HPC_DIR not set!"; exit 1; }
+[ ! -z $LINALG_BASE_DIR ] || { echo "Error: $LINALG_BASE_DIR not set!"; exit 1; }
+[ ! -z $OUTPUT_DIR ] || { echo "Error: $OUTPUT_DIR not set!"; exit 1; }
+
+cd $MCSDK_HPC_DIR/scripts
+set +e
+. setup_hpc_env.sh -s $TI_INSTALL_DIR:$TI_INSTALL_DIR/linaro -t $TARGET_ROOTDIR
+set -e
+
+export TI_OCL_INSTALL_DIR=/opt/ti/mcsdk-hpc_03_00_01_04/ti-opencl_0.14.0/
+
+echo "env" 
+env
+
+####################### buidling LINALG  ########################
+cd $LINALG_BASE_DIR
+make linalg
+echo "Generating Debian package ..."
+LINALG_VER=`cat build/version.txt`
+tar -czf linalg_$LINALG_VER.tar.gz --exclude='*.git' --exclude="*.obj" --exclude="*.o" --files-from=build/tar_files_list.txt
+####################### end of buidling LINALG  ########################
+
+cp -v linalg_$LINALG_VER.tar.gz $OUTPUT_DIR
+
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..2999a94
--- /dev/null
@@ -0,0 +1,5 @@
+ti-linalg (01.00.00.00-0ubuntu0~ppa1) trusty; urgency=high\r
+\r
+  * Initial release with BLIS based BLAS.\r
+\r
+ -- TI Keystone PPA <ti-keystone-ppa@list.ti.com>  Wed, 4 Feb 2015 \r
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..3b0923b
--- /dev/null
@@ -0,0 +1 @@
+9\r
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..f26cdf6
--- /dev/null
@@ -0,0 +1,20 @@
+Source: ti-linalg\r
+Section: partner/libs\r
+Priority: extra\r
+Maintainer: TI Keystone PPA <ti-keystone-ppa@list.ti.com>\r
+Build-Depends: debhelper (>= 9), \r
+               ti-opencl (>= 0.12.0), \r
+Standards-Version: 3.9.5\r
+\r
+Package: ti-linalg\r
+Depends: ${misc:Depends}, \r
+         ti-opencl (>= 0.12.0), \r
+         ti-cgt-c6x (>= 8.0.0)\r
+Architecture: all\r
+Description: linalg (BLAS and LAPACK) for TI Keystone II\r
+  The Texas Instruments LINALG contains BLAS and LAPACK optimized for K2H \r
+  ARM+DSP platforms.\r
+  \r
+  Using these routines assures execution speeds considerably faster than\r
+  equivalent code written in standard ANSI C language.\r
+  \r
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..00c45f8
--- /dev/null
@@ -0,0 +1,34 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/\r
+Upstream-Name: LINALG\r
+\r
+Files: *\r
+Copyright: 2015 Texas Instruments Inc.\r
+License: BSD-3-clause\r
+ Redistribution and use in source and binary forms, with or without\r
+ modification, are permitted provided that the following conditions\r
+ are met:\r
+ .\r
+ Redistributions of source code must retain the above copyright\r
+ notice, this list of conditions and the following disclaimer.\r
+ .\r
+ Redistributions in binary form must reproduce the above copyright\r
+ notice, this list of conditions and the following disclaimer in the \r
+ documentation and/or other materials provided with the   \r
+ distribution.\r
+ .\r
+ Neither the name of Texas Instruments Incorporated nor the names of\r
+ its contributors may be used to endorse or promote products derived\r
+ from this software without specific prior written permission.\r
+ .\r
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \r
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT \r
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT \r
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, \r
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT \r
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \r
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE \r
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\r
diff --git a/debian/rules b/debian/rules
new file mode 100644 (file)
index 0000000..8c3ad8e
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/make -f\r
+\r
+%:\r
+       dh $@ \r
diff --git a/debian/ti-linalg.install b/debian/ti-linalg.install
new file mode 100644 (file)
index 0000000..1196c25
--- /dev/null
@@ -0,0 +1,4 @@
+usr/lib/xyz.a\r
+usr/bin\r
+usr/include\r
+usr/share\r
diff --git a/make.inc b/make.inc
new file mode 100644 (file)
index 0000000..b8d88d9
--- /dev/null
+++ b/make.inc
@@ -0,0 +1,66 @@
+DSP_INCLUDE  = -I$(TI_OCL_CGT_INSTALL)/include 
+DSP_INCLUDE += -I$(TARGET_ROOTDIR)/usr/share/ti/cgt-c6x/include
+DSP_INCLUDE += -I$(TARGET_ROOTDIR)/usr/share/ti/opencl
+
+CPP   = g++
+CL6X  = cl6x -mv6600 --abi=eabi $(DSP_INCLUDE)
+CLOCL = clocl
+
+LIBS  = -lOpenCL -locl_util #-lstdc++ -lrt 
+
+UNAME_M :=$(shell uname -m)
+
+
+ifneq (,$(findstring 86, $(UNAME_M)))
+    .DEFAULT_GOAL := cross
+
+    # In a cross compile environment we are assuming that the EVM file system
+    # is located on the build host and necessary ARM libraries are installed
+    # on that file system. 
+    ifneq ($(MAKECMDGOALS),clean)
+       ifeq ($(TARGET_ROOTDIR),)
+         $(error Environment variable TARGET_ROOTDIR must be defined. Set it to point at the EVM root file system)
+       endif
+    endif
+
+    # gcc ARM cross compiler will not, by default, search the host's
+    # /usr/include.  Explicitly specify here to find dependent vendor headers
+    cross: override CPP = arm-linux-gnueabihf-g++
+    cross: CPP_FLAGS += -I$(TARGET_ROOTDIR)/usr/include -idirafter /usr/include
+
+    # If cross-compilineg, provide path to dependent ARM libraries on the 
+    # target filesystem
+    cross: LD_FLAGS = -L$(TARGET_ROOTDIR)/lib -L$(TARGET_ROOTDIR)/usr/lib -Wl,-rpath-link,$(TARGET_ROOTDIR)/lib -Wl,-rpath-link,$(TARGET_ROOTDIR)/usr/lib 
+endif
+
+%.o: %.cpp
+       @echo Compiling $<
+       @$(CPP) -c $(CPP_FLAGS) $<
+
+%.o: %.c
+       @echo Compiling $<
+       @$(CPP) -c $(CPP_FLAGS) $<
+
+%.obj: %.c
+       @echo Compiling $<
+       @$(CL6X) -c $(CL6X_FLAGS) $<
+
+%.out: %.cl
+       @echo Compiling $< 
+       @$(CLOCL) $(CLOCL_FLAGS) $^
+
+%.dsp_h: %.cl
+       @echo Compiling $< 
+       @$(CLOCL) -t $(CLOCL_FLAGS) $^
+
+$(EXE):
+
+cross: $(EXE)
+
+clean::
+       @rm -f $(EXE) *.o *.obj *.out *.asm *.if *.opt *.bc *.objc *.map *.bin *.dsp_h
+
+test: clean $(EXE)
+       @echo Running   $(EXE)
+       @./$(EXE) >> /dev/null
+       @if [ $$? -ne 0 ] ; then echo "FAILED !!!" ; fi
diff --git a/makefile b/makefile
new file mode 100644 (file)
index 0000000..ae34f69
--- /dev/null
+++ b/makefile
@@ -0,0 +1,30 @@
+
+.PHONY: clean linalg_ARMonly linalg install build
+
+LINALG_BUILD_DIR    = build
+LINALG_BLIS_DIR     = blis
+LINALG_CBLAS_DIR    = cblas
+LINALG_BLISACC_DIR  = blasblisacc
+
+build: linalg_ARMonly
+
+linalg:
+       cd $(LINALG_CBLAS_DIR); make arch=ARM alllib; make arch=C66 alllib; \
+       cd ../$(LINALG_BLIS_DIR); ./configure -p install/c66x c66x; make -j8; make install; \
+       ./configure -p install/arm cortex-a15; make -j8; make install; \
+       cd ../$(LINALG_BLISACC_DIR); make cross; \
+       cd ../$(LINALG_BLIS_DIR)/testsuite; make lib=OpenCLCBLAS -j8
+
+linalg_ARMonly: 
+       cd $(LINALG_CBLAS_DIR); make arch=ARM alllib; \
+       cd ../$(LINALG_BLIS_DIR); ./configure -p install/arm cortex-a15; make -j8; make install; \
+       cd ../$(LINALG_BLISACC_DIR); make cross; \
+       cd ../$(LINALG_BLIS_DIR)/testsuite; make lib=OpenCLCBLAS -j8
+
+clean:
+       cd $(LINALG_CBLAS_DIR); make arch=ARM clean; make arch=C66 clean; \
+       cd ../$(LINALG_BLIS_DIR); ./configure -p install/c66x c66x; make clean; \
+       ./configure -p install/arm cortex-a15; make clean; \
+       cd ../$(LINALG_BLISACC_DIR); make clean; \
+       cd ../$(LINALG_BLIS_DIR)/testsuite; make clean
+