Added Windows build system.

Details:
- Added a 'windows' directory, which contains a Windows build system
  similar to that of libflame's. Thanks to Martin for getting this up
  and running.
- Spun off system header #includes into bli_system.h, which is included
  in blis.h
- Added a Windows section to bli_clock.c (similar to libflame's).
This commit is contained in:
Field G. Van Zee
2013-09-09 13:09:16 -05:00
parent 9b320e7406
commit d141f9eeb6
22 changed files with 4991 additions and 14 deletions

View File

@@ -36,21 +36,9 @@
static double gtod_ref_time_sec = 0.0;
double bli_clock()
double bli_clock( void )
{
double the_time, norm_sec;
struct timeval tv;
gettimeofday( &tv, NULL );
if ( gtod_ref_time_sec == 0.0 )
gtod_ref_time_sec = ( double ) tv.tv_sec;
norm_sec = ( double ) tv.tv_sec - gtod_ref_time_sec;
the_time = norm_sec + tv.tv_usec * 1.0e-6;
return the_time;
return bli_clock_helper();
}
double bli_clock_min_diff( double time_min, double time_start )
@@ -77,3 +65,60 @@ double bli_clock_min_diff( double time_min, double time_start )
return time_min;
}
// --- Begin Linux build definitions -------------------------------------------
#ifndef BLIS_ENABLE_WINDOWS_BUILD
double bli_clock_helper()
{
double the_time, norm_sec;
struct timeval tv;
gettimeofday( &tv, NULL );
if ( gtod_ref_time_sec == 0.0 )
gtod_ref_time_sec = ( double ) tv.tv_sec;
norm_sec = ( double ) tv.tv_sec - gtod_ref_time_sec;
the_time = norm_sec + tv.tv_usec * 1.0e-6;
return the_time;
}
// --- End Linux build definitions ---------------------------------------------
#else
// --- Begin Windows build definitions -----------------------------------------
#define WIN32_LEAN_AND_MEAN
#define VC_EXTRALEAN
#include <windows.h>
double bli_clock_helper()
{
LARGE_INTEGER clock_freq = {0};
LARGE_INTEGER clock_val;
BOOL r_val;
r_val = QueryPerformanceFrequency( &clock_freq );
if ( r_val == 0 )
{
bli_print_msg( "QueryPerformanceFrequency() failed", __FILE__, __LINE__ );
bli_abort();
}
r_val = QueryPerformanceCounter( &clock_val );
if ( r_val == 0 )
{
bli_print_msg( "QueryPerformanceCounter() failed", __FILE__, __LINE__ );
bli_abort();
}
return ( ( double) clock_val.QuadPart / ( double) clock_freq.QuadPart );
}
#endif
// --- End Windows build definitions -------------------------------------------

View File

@@ -34,4 +34,5 @@
double bli_clock( void );
double bli_clock_min_diff( double time_min, double time_start );
double bli_clock_helper( void );

View File

@@ -0,0 +1,63 @@
/*
BLIS
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2013, The University of Texas
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of The University of Texas nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BLIS_SYSTEM_H
#define BLIS_SYSTEM_H
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#ifdef BLIS_ENABLE_WINDOWS_BUILD
// Include Windows header file.
#include <windows.h>
// Undefine attribute specifiers in Windows.
#define __attribute__(x)
// Undefine restrict.
#define restrict
#endif
// gettimeofday() needs this.
#ifdef BLIS_ENABLE_WINDOWS_BUILD
#include <time.h>
#else
#include <sys/time.h>
#include <time.h>
#endif
#endif

339
windows/Makefile Normal file
View File

@@ -0,0 +1,339 @@
#
# libblis
# An object-based infrastructure for developing high-performance
# dense linear algebra libraries.
#
# Copyright (C) 2011, The University of Texas
#
# libblis is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of
# the License, or (at your option) any later version.
#
# libblis is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with libblis; if you did not receive a copy, see
# http://www.gnu.org/licenses/.
#
# For more information, please contact us at flame@cs.utexas.edu or
# send mail to:
#
# Field G. Van Zee and/or
# Robert A. van de Geijn
# The University of Texas at Austin
# Department of Computer Sciences
# 1 University Station C0500
# Austin TX 78712
#
#
# --- Include variables determined at configure-time --------------------------
#
CONFIGURE_DEFS = config\config.mk
!if exist ( $(CONFIGURE_DEFS) )
!include $(CONFIGURE_DEFS)
!else
!error nmake: $(CONFIGURE_DEFS) does not exist! Run configure.cmd first.
!endif
#
# --- Include environment- and build-specific definitions ----------------------
#
MAKE_DEFS = build\defs.mk
# Include build definitions
!if exist ( $(MAKE_DEFS) )
!include $(MAKE_DEFS)
!else
!error nmake: $(MAKE_DEFS) does not exist! Your libblis distribution may be incomplete.
!endif
#
# --- Variable modifications ---------------------------------------------------
#
#
# --- High-level rules ---------------------------------------------------------
#
all: libblis
libblis: libblis-lib
libblis-objs: $(BLIS_OBJS)
libblis-lib: $(LIB_LIBBLIS_DIRPATH)\$(LIBBLIS_LIB)
libblis-dll: $(DLL_LIBBLIS_DIRPATH)\$(LIBBLIS_DLL)
lib: libblis-lib
dll: libblis-dll
install: install-lib install-headers
install-lib: $(INSTALL_PREFIX_LIB)\$(LIBBLIS).lib
install-dll: $(INSTALL_PREFIX_DLL)\$(LIBBLIS).dll \
$(INSTALL_PREFIX_DLL)\$(LIBBLIS).lib \
$(INSTALL_PREFIX_DLL)\$(LIBBLIS).exp
install-headers: $(INSTALL_PREFIX_INC)\$(BLIS_H)
clean: clean-build clean-log
distclean: clean-config clean-build clean-log
#
# --- Source code (inference) rules --------------------------------------------
#
# --- C source files in flamec directory ---
{$(SRC_BLI_DIRPATH)}.c{$(OBJ_BLI_DIRPATH)}.obj:
!ifdef VERBOSE
if not exist $(OBJ_BLI_DIRPATH) \
( $(MKDIR) $(OBJ_BLI_DIRPATH) )
$(CC) $(CFLAGS) /c $< /Fo$@
!else
@if not exist $(OBJ_BLI_DIRPATH) \
( ( $(ECHO) nmake: Creating $(OBJ_BLI_DIRPATH) directory ) & \
( $(MKDIR) $(OBJ_BLI_DIRPATH) ) )
@$(ECHO) nmake: Compiling $<
@$(CC) $(CFLAGS) /c $< /Fo$@ >> $(CC_LOG_FILE)
!endif
#
# --- Library generation rules -------------------------------------------------
#
# --- Static library ---
$(LIB_LIBBLIS_DIRPATH)\$(LIBBLIS_LIB): libblis-objs
!ifdef VERBOSE
if not exist $(LIB_LIBBLIS_DIRPATH) \
( $(MKDIR) $(LIB_LIBBLIS_DIRPATH) )
$(COPY) $(OBJ_BLI_DIRPATH)\*.obj $(LIB_LIBBLIS_DIRPATH)
$(CD) $(LIB_LIBBLIS_DIRPATH)
$(LIB) $(LIB_OPTIONS) $(LIB_BLI_OUTPUT_ARG) $(LIB_BLI_INPUT_ARGS)
$(DEL) *.obj
$(CD) $(TOP_BUILD_DIR_ABS)
!else
@if not exist $(LIB_LIBBLIS_DIRPATH) \
( ( $(ECHO) nmake: Creating $(LIB_LIBBLIS_DIRPATH) directory ) & \
( $(MKDIR) $(LIB_LIBBLIS_DIRPATH) ) )
@$(ECHO) nmake: Creating static library $@
@$(COPY) $(OBJ_BLI_DIRPATH)\*.obj $(LIB_LIBBLIS_DIRPATH) >> $(COPY_LOG_FILE)
@$(CD) $(LIB_LIBBLIS_DIRPATH)
@$(LIB) /VERBOSE $(LIB_OPTIONS) $(LIB_BLI_OUTPUT_ARG) $(LIB_BLI_INPUT_ARGS)
@$(DEL) *.obj
@$(CD) $(TOP_BUILD_DIR_ABS)
!endif
# --- Dynamic library (object code file, import library, and export file) ---
$(DLL_LIBBLIS_DIRPATH)\$(LIBBLIS_DLL): libblis-objs
!ifdef VERBOSE
if not exist $(DLL_LIBBLIS_DIRPATH) \
( $(MKDIR) $(DLL_LIBBLIS_DIRPATH) )
$(COPY) $(OBJ_BLI_DIRPATH)\*.obj $(DLL_LIBBLIS_DIRPATH) >> $(COPY_LOG_FILE)
$(CD) $(DLL_LIBBLIS_DIRPATH)
$(DIR) /B *.obj > $(OBJ_LIST_FILE)
$(GENDLL) $(LIBBLIS) $(LIBBLIS) $(CC) $(LINKARGS_FILEPATH) $(SYM_DEF_FILEPATH) /objlist $(OBJ_LIST_FILE)
$(DEL) $(OBJ_LIST_FILE)
$(DEL) *.obj
$(CD) $(TOP_BUILD_DIR_ABS)
!else
@if not exist $(DLL_LIBBLIS_DIRPATH) \
( ( $(ECHO) nmake: Creating $(DLL_LIBBLIS_DIRPATH) directory ) & \
( $(MKDIR) $(DLL_LIBBLIS_DIRPATH) ) )
@$(ECHO) nmake: Creating dynamic library $@
@$(COPY) $(OBJ_BLI_DIRPATH)\*.obj $(DLL_LIBBLIS_DIRPATH) >> $(COPY_LOG_FILE)
@$(CD) $(DLL_LIBBLIS_DIRPATH)
@$(DIR) /B *.obj > $(OBJ_LIST_FILE)
@$(GENDLL) $(LIBBLIS) $(LIBBLIS) $(CC) $(LINKARGS_FILEPATH) $(SYM_DEF_FILEPATH) /objlist $(OBJ_LIST_FILE)
@$(DEL) $(OBJ_LIST_FILE)
@$(DEL) *.obj
@$(CD) $(TOP_BUILD_DIR_ABS)
!endif
#
# --- Install rules ------------------------------------------------------------
#
# --- Header files ---
$(INSTALL_PREFIX_INC)\$(BLIS_H): $(INC_BLI_DIRPATH)\$(BLIS_H) \
$(BUILD_DIRNAME)\$(BLI_CONFIG_H)
!ifdef VERBOSE
if not exist $(INSTALL_PREFIX_INC) \
( $(MKDIR) $(INSTALL_PREFIX_INC) )
$(COPY) $(BUILD_DIRNAME)\$(BLI_CONFIG_H) $(INSTALL_PREFIX_INC) >> $(COPY_LOG_FILE)
$(COPY) $(INC_BLI_DIRPATH)\*.h $(INSTALL_PREFIX_INC) >> $(COPY_LOG_FILE)
!else
@if not exist $(INSTALL_PREFIX_INC) \
( $(MKDIR) $(INSTALL_PREFIX_INC) )
@$(ECHO) nmake: Installing libblis header files to $(INSTALL_PREFIX_INC)
@$(COPY) $(BUILD_DIRNAME)\$(BLI_CONFIG_H) $(INSTALL_PREFIX_INC) >> $(COPY_LOG_FILE)
@$(COPY) $(INC_BLI_DIRPATH)\*.h $(INSTALL_PREFIX_INC) >> $(COPY_LOG_FILE)
!endif
# --- Static library ---
$(INSTALL_PREFIX_LIB)\$(LIBBLIS).lib: $(LIB_LIBBLIS_DIRPATH)\$(LIBBLIS).lib
!ifdef VERBOSE
if not exist $(INSTALL_PREFIX_LIB) ( $(MKDIR) $(INSTALL_PREFIX_LIB) )
if exist $(LIB_LIBBLIS_DIRPATH)\$(LIBBLIS).lib \
( $(COPY) $(LIB_LIBBLIS_DIRPATH)\$(LIBBLIS).lib $(INSTALL_PREFIX_LIB) >> $(COPY_LOG_FILE) )
!else
@if not exist $(INSTALL_PREFIX_LIB) ( $(MKDIR) $(INSTALL_PREFIX_LIB) )
@if exist $(LIB_LIBBLIS_DIRPATH)\$(LIBBLIS).lib \
( ( $(ECHO) nmake: Installing $(LIB_LIBBLIS_DIRPATH)\$(LIBBLIS).lib to $(INSTALL_PREFIX_LIB) ) & \
( $(COPY) $(LIB_LIBBLIS_DIRPATH)\$(LIBBLIS).lib $(INSTALL_PREFIX_LIB) >> $(COPY_LOG_FILE) ) )
!endif
# --- Dynamic library (object code) ---
$(INSTALL_PREFIX_DLL)\$(LIBBLIS).dll: $(DLL_LIBBLIS_DIRPATH)\$(LIBBLIS).dll
!ifdef VERBOSE
if not exist $(INSTALL_PREFIX_DLL) ( $(MKDIR) $(INSTALL_PREFIX_DLL) )
if exist $(DLL_LIBBLIS_DIRPATH)\$(LIBBLIS).dll \
( $(COPY) $(DLL_LIBBLIS_DIRPATH)\$(LIBBLIS).dll $(INSTALL_PREFIX_DLL) >> $(COPY_LOG_FILE) )
!else
@if not exist $(INSTALL_PREFIX_DLL) ( $(MKDIR) $(INSTALL_PREFIX_DLL) )
@if exist $(DLL_LIBBLIS_DIRPATH)\$(LIBBLIS).dll \
( ( $(ECHO) nmake: Installing $(DLL_LIBBLIS_DIRPATH)\$(LIBBLIS).dll to $(INSTALL_PREFIX_DLL) ) & \
( $(COPY) $(DLL_LIBBLIS_DIRPATH)\$(LIBBLIS).dll $(INSTALL_PREFIX_DLL) >> $(COPY_LOG_FILE) ) )
!endif
# --- Dynamic library (import library) ---
$(INSTALL_PREFIX_DLL)\$(LIBBLIS).lib: $(DLL_LIBBLIS_DIRPATH)\$(LIBBLIS).lib
!ifdef VERBOSE
if not exist $(INSTALL_PREFIX_DLL) ( $(MKDIR) $(INSTALL_PREFIX_DLL) )
if exist $(DLL_LIBBLIS_DIRPATH)\$(LIBBLIS).lib \
( $(COPY) $(DLL_LIBBLIS_DIRPATH)\$(LIBBLIS).lib $(INSTALL_PREFIX_DLL) >> $(COPY_LOG_FILE) )
!else
@if not exist $(INSTALL_PREFIX_DLL) ( $(MKDIR) $(INSTALL_PREFIX_DLL) )
@if exist $(DLL_LIBBLIS_DIRPATH)\$(LIBBLIS).lib \
( ( $(ECHO) nmake: Installing $(DLL_LIBBLIS_DIRPATH)\$(LIBBLIS).lib to $(INSTALL_PREFIX_DLL) ) & \
( $(COPY) $(DLL_LIBBLIS_DIRPATH)\$(LIBBLIS).lib $(INSTALL_PREFIX_DLL) >> $(COPY_LOG_FILE) ) )
!endif
# --- Dynamic library (export file) ---
$(INSTALL_PREFIX_DLL)\$(LIBBLIS).exp: $(DLL_LIBBLIS_DIRPATH)\$(LIBBLIS).exp
!ifdef VERBOSE
if not exist $(INSTALL_PREFIX_DLL) ( $(MKDIR) $(INSTALL_PREFIX_DLL) )
if exist $(DLL_LIBBLIS_DIRPATH)\$(LIBBLIS).exp \
( $(COPY) $(DLL_LIBBLIS_DIRPATH)\$(LIBBLIS).exp $(INSTALL_PREFIX_DLL) >> $(COPY_LOG_FILE) )
!else
@if not exist $(INSTALL_PREFIX_DLL) ( $(MKDIR) $(INSTALL_PREFIX_DLL) )
@if exist $(DLL_LIBBLIS_DIRPATH)\$(LIBBLIS).exp \
( ( $(ECHO) nmake: Installing $(DLL_LIBBLIS_DIRPATH)\$(LIBBLIS).exp to $(INSTALL_PREFIX_DLL) ) & \
( $(COPY) $(DLL_LIBBLIS_DIRPATH)\$(LIBBLIS).exp $(INSTALL_PREFIX_DLL) >> $(COPY_LOG_FILE) ) )
!endif
#
# --- Clean rules --------------------------------------------------------------
#
clean-log:
!ifdef VERBOSE
if exist $(CC_LOG_FILE) \
( $(DEL) $(CC_LOG_FILE) )
if exist $(FC_LOG_FILE) \
( $(DEL) $(FC_LOG_FILE) )
if exist $(COPY_LOG_FILE) \
( $(DEL) $(COPY_LOG_FILE) )
!else
@if exist $(CC_LOG_FILE) \
( ( $(ECHO) nmake: Deleting $(CC_LOG_FILE) ) & \
( $(DEL) $(CC_LOG_FILE) ) )
@if exist $(FC_LOG_FILE) \
( ( $(ECHO) nmake: Deleting $(FC_LOG_FILE) ) & \
( $(DEL) $(FC_LOG_FILE) ) )
@if exist $(COPY_LOG_FILE) \
( ( $(ECHO) nmake: Deleting $(COPY_LOG_FILE) ) & \
( $(DEL) $(COPY_LOG_FILE) ) )
!endif
clean-config:
!ifdef VERBOSE
if exist $(CNF_DIRNAME) \
( $(RMDIR) $(CNF_DIRNAME) )
if exist $(INC_DIRNAME) \
( $(RMDIR) $(INC_DIRNAME) )
if exist $(SRC_DIRNAME) \
( $(RMDIR) $(SRC_DIRNAME) )
!else
@if exist $(CNF_DIRNAME) \
( ( $(ECHO) nmake: Deleting $(CNF_DIRNAME) directory ) & \
( $(RMDIR) $(CNF_DIRNAME) ) )
@if exist $(INC_DIRNAME) \
( ( $(ECHO) nmake: Deleting $(INC_DIRNAME) directory ) & \
( $(RMDIR) $(INC_DIRNAME) ) )
@if exist $(SRC_DIRNAME) \
( ( $(ECHO) nmake: Deleting $(SRC_DIRNAME) directory ) & \
( $(RMDIR) $(SRC_DIRNAME) ) )
!endif
clean-build:
!ifdef VERBOSE
if exist $(OBJ_DIRNAME) \
( $(RMDIR) $(OBJ_DIRNAME) )
if exist $(LIB_DIRNAME) \
( $(RMDIR) $(LIB_DIRNAME) )
if exist $(DLL_DIRNAME) \
( $(RMDIR) $(DLL_DIRNAME) )
!else
@if exist $(OBJ_DIRNAME) \
( ( $(ECHO) nmake: Deleting $(OBJ_DIRNAME) directory ) & \
( $(RMDIR) $(OBJ_DIRNAME) ) )
@if exist $(LIB_DIRNAME) \
( ( $(ECHO) nmake: Deleting $(LIB_DIRNAME) directory ) & \
( $(RMDIR) $(LIB_DIRNAME) ) )
@if exist $(DLL_DIRNAME) \
( ( $(ECHO) nmake: Deleting $(DLL_DIRNAME) directory ) & \
( $(RMDIR) $(DLL_DIRNAME) ) )
!endif
# Useful for developing when all we want to do is remove the library products.
clean-lib:
!ifdef VERBOSE
if exist $(LIB_DIRNAME) \
( $(RMDIR) $(LIB_DIRNAME) )
if exist $(DLL_DIRNAME) \
( $(RMDIR) $(DLL_DIRNAME) )
!else
@if exist $(LIB_DIRNAME) \
( ( $(ECHO) nmake: Deleting $(LIB_DIRNAME) directory ) & \
( $(RMDIR) $(LIB_DIRNAME) ) )
@if exist $(DLL_DIRNAME) \
( ( $(ECHO) nmake: Deleting $(DLL_DIRNAME) directory ) & \
( $(RMDIR) $(DLL_DIRNAME) ) )
!endif
#
# --- Help target --------------------------------------------------------------
#
help:
@$(NMAKE_HELP)

145
windows/build/bli_config.h Normal file
View File

@@ -0,0 +1,145 @@
/*
BLIS
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2013, The University of Texas
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of The University of Texas nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BLIS_CONFIG_H
#define BLIS_CONFIG_H
// -- OPERATING SYSTEM ---------------------------------------------------------
// -- FLOATING-POINT PROPERTIES ------------------------------------------------
#define BLIS_NUM_FP_TYPES 4
#define BLIS_MAX_TYPE_SIZE sizeof(dcomplex)
// Enable use of built-in C99 "float complex" and "double complex" types and
// associated overloaded operations and functions? Disabling results in
// scomplex and dcomplex being defined in terms of simple structs.
//#define BLIS_ENABLE_C99_COMPLEX
// -- MULTITHREADING -----------------------------------------------------------
// The maximum number of BLIS threads that will run concurrently.
#define BLIS_MAX_NUM_THREADS 24
// -- MEMORY ALLOCATION --------------------------------------------------------
// -- Contiguous (static) memory allocator --
// The number of MC x KC, KC x NC, and MC x NC blocks to reserve in the
// contiguous memory pools.
#define BLIS_NUM_MC_X_KC_BLOCKS BLIS_MAX_NUM_THREADS
#define BLIS_NUM_KC_X_NC_BLOCKS 1
#define BLIS_NUM_MC_X_NC_BLOCKS 1
// The maximum preload byte offset is used to pad the end of the contiguous
// memory pools so that the micro-kernel, when computing with the end of the
// last block, can exceed the bounds of the usable portion of the memory
// region without causing a segmentation fault.
#define BLIS_MAX_PRELOAD_BYTE_OFFSET 128
// -- Memory alignment --
// It is sometimes useful to define the various memory alignments in terms
// of some other characteristics of the system, such as the cache line size
// and the page size.
#define BLIS_CACHE_LINE_SIZE 64
#define BLIS_PAGE_SIZE 4096
// Alignment size used to align local stack buffers within macro-kernel
// functions.
#define BLIS_STACK_BUF_ALIGN_SIZE 16
// Alignment size used when allocating memory dynamically from the operating
// system (eg: posix_memalign()). To disable heap alignment and just use
// malloc() instead, set this to 1.
#define BLIS_HEAP_ADDR_ALIGN_SIZE 16
// Alignment size used when sizing leading dimensions of dynamically
// allocated memory.
#define BLIS_HEAP_STRIDE_ALIGN_SIZE BLIS_CACHE_LINE_SIZE
// Alignment size used when allocating entire blocks of contiguous memory
// from the contiguous memory allocator.
#define BLIS_CONTIG_ADDR_ALIGN_SIZE BLIS_PAGE_SIZE
// Alignment size used when sizing strides (eg: of packed micro-panels)
// within a block of contiguous memory.
#define BLIS_CONTIG_STRIDE_ALIGN_SIZE 16
// -- MIXED DATATYPE SUPPORT ---------------------------------------------------
// Basic (homogeneous) datatype support always enabled.
// Enable mixed domain operations?
//#define BLIS_ENABLE_MIXED_DOMAIN_SUPPORT
// Enable extra mixed precision operations?
//#define BLIS_ENABLE_MIXED_PRECISION_SUPPORT
// -- MISCELLANEOUS OPTIONS ----------------------------------------------------
// Stay initialized after auto-initialization, unless and until the user
// explicitly calls bli_finalize().
#define BLIS_ENABLE_STAY_AUTO_INITIALIZED
// -- BLAS-to-BLIS COMPATIBILITY LAYER -----------------------------------------
// Enable the BLAS compatibility layer?
#define BLIS_ENABLE_BLAS2BLIS
// Enable 64-bit integers in the BLAS compatibility layer? If disabled,
// these integers will be defined as 32-bit.
#define BLIS_ENABLE_BLAS2BLIS_INT64
// Fortran-77 name-mangling macros.
#define PASTEF770(name) name ## _
#define PASTEF77(ch1,name) ch1 ## name ## _
#define PASTEF772(ch1,ch2,name) ch1 ## ch2 ## name ## _
#endif

364
windows/build/bli_kernel.h Normal file
View File

@@ -0,0 +1,364 @@
/*
BLIS
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2013, The University of Texas
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of The University of Texas nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BLIS_KERNEL_H
#define BLIS_KERNEL_H
// -- LEVEL-3 MICRO-KERNEL CONSTANTS -------------------------------------------
// -- Default cache blocksizes --
//
// Constraints:
//
// (1) MC must be a multiple of:
// (a) MR (for zero-padding purposes)
// (b) NR (for zero-padding purposes when MR and NR are "swapped")
// (2) NC must be a multiple of
// (a) NR (for zero-padding purposes)
// (b) MR (for zero-padding purposes when MR and NR are "swapped")
// (3) KC must be a multiple of
// (a) MR and
// (b) NR (for triangular operations such as trmm and trsm).
//
#define BLIS_DEFAULT_MC_S 256
#define BLIS_DEFAULT_KC_S 256
#define BLIS_DEFAULT_NC_S 8192
#define BLIS_DEFAULT_MC_D 128
#define BLIS_DEFAULT_KC_D 256
#define BLIS_DEFAULT_NC_D 4096
#define BLIS_DEFAULT_MC_C 128
#define BLIS_DEFAULT_KC_C 256
#define BLIS_DEFAULT_NC_C 4096
#define BLIS_DEFAULT_MC_Z 64
#define BLIS_DEFAULT_KC_Z 256
#define BLIS_DEFAULT_NC_Z 2048
// -- Cache blocksize extensions (for optimizing edge cases) --
// NOTE: These cache blocksize "extensions" have the same constraints as
// the corresponding default blocksizes above. When these values are
// non-zero, blocksizes used at edge cases are extended (enlarged) if
// such an extension would encompass the remaining portion of the
// matrix dimension.
#define BLIS_EXTEND_MC_S 0 //(BLIS_DEFAULT_MC_S/4)
#define BLIS_EXTEND_KC_S 0 //(BLIS_DEFAULT_KC_S/4)
#define BLIS_EXTEND_NC_S 0 //(BLIS_DEFAULT_NC_S/4)
#define BLIS_EXTEND_MC_D 0 //(BLIS_DEFAULT_MC_D/4)
#define BLIS_EXTEND_KC_D 0 //(BLIS_DEFAULT_KC_D/4)
#define BLIS_EXTEND_NC_D 0 //(BLIS_DEFAULT_NC_D/4)
#define BLIS_EXTEND_MC_C 0 //(BLIS_DEFAULT_MC_C/4)
#define BLIS_EXTEND_KC_C 0 //(BLIS_DEFAULT_KC_C/4)
#define BLIS_EXTEND_NC_C 0 //(BLIS_DEFAULT_NC_C/4)
#define BLIS_EXTEND_MC_Z 0 //(BLIS_DEFAULT_MC_Z/4)
#define BLIS_EXTEND_KC_Z 0 //(BLIS_DEFAULT_KC_Z/4)
#define BLIS_EXTEND_NC_Z 0 //(BLIS_DEFAULT_NC_Z/4)
// -- Default register blocksizes for micro-kernel --
// NOTE: When using the reference configuration, these register blocksizes
// in the m and n dimensions should all be equal to the size expected by
// the reference micro-kernel(s).
#define BLIS_DEFAULT_MR_S 8
#define BLIS_DEFAULT_NR_S 4
#define BLIS_DEFAULT_MR_D 8
#define BLIS_DEFAULT_NR_D 4
#define BLIS_DEFAULT_MR_C 8
#define BLIS_DEFAULT_NR_C 4
#define BLIS_DEFAULT_MR_Z 8
#define BLIS_DEFAULT_NR_Z 4
// NOTE: If the micro-kernel, which is typically unrolled to a factor
// of f, handles leftover edge cases (ie: when k % f > 0) then these
// register blocksizes in the k dimension can be defined to 1.
#define BLIS_DEFAULT_KR_S 1
#define BLIS_DEFAULT_KR_D 1
#define BLIS_DEFAULT_KR_C 1
#define BLIS_DEFAULT_KR_Z 1
// -- Register blocksize extensions (for packed micro-panels) --
// NOTE: These register blocksize "extensions" determine whether the
// leading dimensions used within the packed micro-panels are equal to
// or greater than their corresponding register blocksizes above.
#define BLIS_EXTEND_MR_S 0
#define BLIS_EXTEND_NR_S 0
#define BLIS_EXTEND_MR_D 0
#define BLIS_EXTEND_NR_D 0
#define BLIS_EXTEND_MR_C 0
#define BLIS_EXTEND_NR_C 0
#define BLIS_EXTEND_MR_Z 0
#define BLIS_EXTEND_NR_Z 0
// Register blocksize extensions in the k dimension are not used.
#define BLIS_EXTEND_KR_S 0
#define BLIS_EXTEND_KR_D 0
#define BLIS_EXTEND_KR_C 0
#define BLIS_EXTEND_KR_Z 0
// -- Number of elements per vector register --
// NOTE: These constants are typically only used to determine the amount
// of duplication needed when configuring level-3 macro-kernels that
// copy and duplicate elements of B to a temporary duplication buffer
// (so that element-wise vector multiplication and addition instructions
// can be used).
#define BLIS_NUM_ELEM_PER_REG_S 4
#define BLIS_NUM_ELEM_PER_REG_D 2
#define BLIS_NUM_ELEM_PER_REG_C 2
#define BLIS_NUM_ELEM_PER_REG_Z 1
// -- Default switch for duplication of B --
// NOTE: Setting these values to 1 disables duplication. Any value
// d > 1 results in a d-1 duplicates created within special macro-kernel
// buffer of dimension k x NR*d.
//#define BLIS_DEFAULT_NUM_DUPL_S BLIS_NUM_ELEM_PER_REG_S
//#define BLIS_DEFAULT_NUM_DUPL_D BLIS_NUM_ELEM_PER_REG_D
//#define BLIS_DEFAULT_NUM_DUPL_C BLIS_NUM_ELEM_PER_REG_C
//#define BLIS_DEFAULT_NUM_DUPL_Z BLIS_NUM_ELEM_PER_REG_Z
#define BLIS_DEFAULT_NUM_DUPL_S 1
#define BLIS_DEFAULT_NUM_DUPL_D 1
#define BLIS_DEFAULT_NUM_DUPL_C 1
#define BLIS_DEFAULT_NUM_DUPL_Z 1
// -- Default incremental packing blocksizes (n dimension) --
// NOTE: These incremental packing blocksizes (for the n dimension) are only
// used by certain blocked variants. But when the *are* used, they MUST be
// be an integer multiple of NR!
#define BLIS_DEFAULT_NI_FAC 16
#define BLIS_DEFAULT_NI_S (BLIS_DEFAULT_NI_FAC * BLIS_DEFAULT_NR_S)
#define BLIS_DEFAULT_NI_D (BLIS_DEFAULT_NI_FAC * BLIS_DEFAULT_NR_D)
#define BLIS_DEFAULT_NI_C (BLIS_DEFAULT_NI_FAC * BLIS_DEFAULT_NR_C)
#define BLIS_DEFAULT_NI_Z (BLIS_DEFAULT_NI_FAC * BLIS_DEFAULT_NR_Z)
// -- LEVEL-2 KERNEL CONSTANTS -------------------------------------------------
// NOTE: These values determine high-level cache blocking for level-2
// operations ONLY. So, if gemv is performed with a 2000x2000 matrix A and
// MC = NC = 1000, then a total of four unblocked (or unblocked fused)
// gemv subproblems are called. The blocked algorithms are only useful in
// that they provide the opportunity for packing vectors. (Matrices can also
// be packed here, but this tends to be much too expensive in practice to
// actually employ.)
#define BLIS_DEFAULT_L2_MC_S 1000
#define BLIS_DEFAULT_L2_NC_S 1000
#define BLIS_DEFAULT_L2_MC_D 1000
#define BLIS_DEFAULT_L2_NC_D 1000
#define BLIS_DEFAULT_L2_MC_C 1000
#define BLIS_DEFAULT_L2_NC_C 1000
#define BLIS_DEFAULT_L2_MC_Z 1000
#define BLIS_DEFAULT_L2_NC_Z 1000
// -- LEVEL-1F KERNEL CONSTANTS ------------------------------------------------
// -- Default fusing factors for level-1f operations --
// NOTE: Default fusing factors are not used by the reference implementations
// of level-1f operations. They are here only for use when these operations
// are optimized.
#define BLIS_DEFAULT_FUSING_FACTOR_S 8
#define BLIS_DEFAULT_FUSING_FACTOR_D 4
#define BLIS_DEFAULT_FUSING_FACTOR_C 4
#define BLIS_DEFAULT_FUSING_FACTOR_Z 2
// -- LEVEL-1V KERNEL CONSTANTS ------------------------------------------------
// -- Default register blocksizes for vectors --
// NOTE: Register blocksizes for vectors are used when packing
// non-contiguous vectors. Similar to that of KR, they can
// typically be set to 1.
#define BLIS_DEFAULT_VR_S 1
#define BLIS_DEFAULT_VR_D 1
#define BLIS_DEFAULT_VR_C 1
#define BLIS_DEFAULT_VR_Z 1
// -- LEVEL-3 KERNEL DEFINITIONS -----------------------------------------------
// -- dupl --
#define DUPL_KERNEL dupl_unb_var1
// -- gemm --
#define GEMM_UKERNEL gemm_ref_mxn
// -- trsm-related --
#define GEMMTRSM_L_UKERNEL gemmtrsm_l_ref_mxn
#define GEMMTRSM_U_UKERNEL gemmtrsm_u_ref_mxn
#define TRSM_L_UKERNEL trsm_l_ref_mxn
#define TRSM_U_UKERNEL trsm_u_ref_mxn
// -- LEVEL-1M KERNEL DEFINITIONS ----------------------------------------------
// -- packm --
#define PACKM_2XK_KERNEL packm_ref_2xk
#define PACKM_4XK_KERNEL packm_ref_4xk
#define PACKM_6XK_KERNEL packm_ref_6xk
#define PACKM_8XK_KERNEL packm_ref_8xk
#define PACKM_10XK_KERNEL packm_ref_10xk
#define PACKM_12XK_KERNEL packm_ref_12xk
#define PACKM_14XK_KERNEL packm_ref_14xk
#define PACKM_16XK_KERNEL packm_ref_16xk
// -- unpackm --
#define UNPACKM_2XK_KERNEL unpackm_ref_2xk
#define UNPACKM_4XK_KERNEL unpackm_ref_4xk
#define UNPACKM_6XK_KERNEL unpackm_ref_6xk
#define UNPACKM_8XK_KERNEL unpackm_ref_8xk
#define UNPACKM_10XK_KERNEL unpackm_ref_10xk
#define UNPACKM_12XK_KERNEL unpackm_ref_12xk
#define UNPACKM_14XK_KERNEL unpackm_ref_14xk
#define UNPACKM_16XK_KERNEL unpackm_ref_16xk
// -- LEVEL-1F KERNEL DEFINITIONS ----------------------------------------------
// -- axpy2v --
#define AXPY2V_KERNEL axpy2v_unb_var1
// -- dotaxpyv --
#define DOTAXPYV_KERNEL dotaxpyv_unb_var1
// -- axpyf --
#define AXPYF_KERNEL axpyf_unb_var1
// -- dotxf --
#define DOTXF_KERNEL dotxf_unb_var1
// -- dotxaxpyf --
#define DOTXAXPYF_KERNEL dotxaxpyf_unb_var1
// -- LEVEL-1V KERNEL DEFINITIONS ----------------------------------------------
// -- addv --
#define ADDV_KERNEL addv_unb_var1
// -- axpyv --
#define AXPYV_KERNEL axpyv_unb_var1
// -- copyv --
#define COPYV_KERNEL copyv_unb_var1
// -- dotv --
#define DOTV_KERNEL dotv_unb_var1
// -- dotxv --
#define DOTXV_KERNEL dotxv_unb_var1
// -- invertv --
#define INVERTV_KERNEL invertv_unb_var1
// -- scal2v --
#define SCAL2V_KERNEL scal2v_unb_var1
// -- scalv --
#define SCALV_KERNEL scalv_unb_var1
// -- setv --
#define SETV_KERNEL setv_unb_var1
// -- subv --
#define SUBV_KERNEL subv_unb_var1
// -- swapv --
#define SWAPV_KERNEL swapv_unb_var1
#endif

View File

@@ -0,0 +1,52 @@
#
#
# BLIS
# An object-based framework for developing high-performance BLAS-like
# libraries.
#
# Copyright (C) 2013, The University of Texas
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# - Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# - Neither the name of The University of Texas nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
#
# --- Configuration variable definitions ---------------------------------------
#
# Environment-related variables:
# REVISION - The code's revision number.
# PWD - The path to current working directory.
# ARCH_STR - A string to identify the requested build architecture.
# BUILD_STR - A string to identify the requested build type.
# CCOMPILER_STR - A string to identify the requested C compiler.
#
# Target-related variables:
# FLAMEC_OBJS - List of paths to flamec object files.
# LAPACK2FLAMEC_OBJS - List of paths to lapack2flamec object files.
#
# Note: these variables are not present in the .in template file. Instead, they
# are appended to the contents of the .in file by a build script and output to
# a separate file (by the same name, without the .in extension).
#

240
windows/build/defs.mk Normal file
View File

@@ -0,0 +1,240 @@
#
#
# BLIS
# An object-based framework for developing high-performance BLAS-like
# libraries.
#
# Copyright (C) 2013, The University of Texas
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# - Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# - Neither the name of The University of Texas nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
#
# --- General build system options --------------------------------------------
#
# Uncomment this for verbose output from nmake.
# VERBOSE = 1
# Assign this varible to be the full path to the directory to which you would
# like the BLIS build products to be installed upon running "nmake install".
# The nmake install target will create the install directory and all requisite
# subdirectories if they do not already exist (in which case the user must have
# permission to create these directories).
INSTALL_PREFIX = c:\field\lib
#
# --- Important build system filenames ----------------------------------------
#
# DLL link arguments. The contents of this file should be customized when
# building a dynamically-linked library. The lines of the file should contain
# linker options, library names, and library paths. Note that the library
# paths must be declared in the following form:
#
# /link /LIBPATH:<path1>
# /link /LIBPATH:<path2>
# /link /LIBPATH:<path3>
#
# where <path1>, <path2>, and <path3> are library paths to add to the list
# of paths to search when the linker attempts to locate other libraries
# listed in the file.
LINKARGS_FILENAME = linkargs.txt
LINKARGS_FILEPATH = $(PWD)\$(LINKARGS_FILENAME)
# Various log file names that capture standard output when VERBOSE is undefined.
CC_LOG_FILE = nmake-cc.log
FC_LOG_FILE = nmake-fc.log
COPY_LOG_FILE = nmake-copy.log
#
# --- General name and directory definitions -----------------------------------
#
# The relative and absolute locations of the top-level Windows build directory.
# This is the directory in which nmake is run (not the directory named "build").
TOP_BUILD_DIR_REL = .
TOP_BUILD_DIR_ABS = $(PWD)
# The revision string.
REV_STR = r$(REVISION)
# The names of the libraries.
LIBBLIS_NAME_ONLY = libblis
LIBBLIS = $(LIBBLIS_NAME_ONLY)-$(ARCH_STR)-$(REV_STR)
# Directories that reside within the top-level Windows directory.
CNF_DIRNAME = config
INC_DIRNAME = include
SRC_DIRNAME = frame
OBJ_DIRNAME = obj
LIB_DIRNAME = lib
DLL_DIRNAME = dll
# Leaves of interest for Windows.
# Relative directory paths to each of the above subdirectories.
INC_DIRPATH = $(TOP_BUILD_DIR_REL)\$(INC_DIRNAME)
SRC_DIRPATH = $(TOP_BUILD_DIR_REL)\$(SRC_DIRNAME)
OBJ_DIRPATH = $(TOP_BUILD_DIR_REL)\$(OBJ_DIRNAME)
LIB_DIRPATH = $(TOP_BUILD_DIR_REL)\$(LIB_DIRNAME)
DLL_DIRPATH = $(TOP_BUILD_DIR_REL)\$(DLL_DIRNAME)
# We only have header files for flamec leaves.
INC_BLI_DIRPATH = $(INC_DIRPATH)
# We have source code for flamec and lapack2flamec leaves.
SRC_BLI_DIRPATH = $(SRC_DIRPATH)
# And we have object file paths corresponding to those source leaves defined
# above.
OBJ_BLI_DIRPATH = $(OBJ_DIRPATH)\$(ARCH_STR)\$(BUILD_STR)
# Separate directories into which we'll move object files when we create the
# static libraries.
LIB_LIBBLIS_DIRPATH = $(LIB_DIRPATH)\$(ARCH_STR)\$(BUILD_STR)
# Separate directories into which we'll move object files when we create the
# dynamic libraries.
DLL_LIBBLIS_DIRPATH = $(DLL_DIRPATH)\$(ARCH_STR)\$(BUILD_STR)
# The install subdirectories.
INSTALL_PREFIX_LIB = $(INSTALL_PREFIX)\libblis\lib
INSTALL_PREFIX_DLL = $(INSTALL_PREFIX)\libblis\dll
INSTALL_PREFIX_INC = $(INSTALL_PREFIX)\libblis\include-$(ARCH_STR)-$(REV_STR)
# Definitions for important header files used in the install-headers rule.
BUILD_DIRNAME = build
BLIS_H = blis.h
#
# --- General shell definitions ------------------------------------------------
#
CD = cd
DIR = dir
COPY = copy
DEL = del /F /Q
MKDIR = mkdir
RMDIR = rd /S /Q
ECHO = echo
#
# --- Helper scripts -----------------------------------------------------------
#
NMAKE_HELP = .\build\nmake-help.cmd
#
# --- Compiler-related definitions ---------------------------------------------
#
!include $(VERSION_FILE)
# --- C compiler definitions ---
WINDOWS_BUILD = BLIS_ENABLE_WINDOWS_BUILD
VERS_STR = 0.0.9
VERSION = BLIS_VERSION_STRING=\"$(VERS_STR)\"
!if "$(CCOMPILER_STR)"=="icl"
!if "$(BUILD_STR)"=="debug"
CDEBUG = /Zi
COPTIM = /Od
!elseif "$(BUILD_STR)"=="release"
CDEBUG =
COPTIM = /Ox
!endif
CC = icl.exe
CMISCFLAGS = /nologo
CLANGFLAGS =
CPPROCFLAGS = /I.\build /I$(INC_BLI_DIRPATH) /D$(WINDOWS_BUILD) /D$(VERSION)
CWARNFLAGS = /w
CDBGFLAGS = $(CDEBUG)
COPTFLAGS = $(COPTIM)
CRTIMEFLAGS = /MT
CMTHREADFLAGS = /Qopenmp
CFLAGS = $(CMISCFLAGS) $(CLANGFLAGS) $(CPPROCFLAGS) $(CWARNFLAGS) \
$(CDBGFLAGS) $(COPTFLAGS) $(CRTIMEFLAGS) $(CMTHREADFLAGS)
!elseif "$(CCOMPILER_STR)"=="cl"
!if "$(BUILD_STR)"=="debug"
CDEBUG = /Zi
COPTIM = /Od
!elseif "$(BUILD_STR)"=="release"
CDEBUG =
COPTIM = /Ox
!endif
CC = cl.exe
CMISCFLAGS = /nologo
CLANGFLAGS =
CPPROCFLAGS = /I.\build /I$(INC_BLI_DIRPATH) /D$(WINDOWS_BUILD) /D$(VERSION)
CWARNFLAGS = /w
CDBGFLAGS = $(CDEBUG)
COPTFLAGS = $(COPTIM)
CRTIMEFLAGS = /MT
CMTHREADFLAGS = /openmp
CFLAGS = $(CMISCFLAGS) $(CLANGFLAGS) $(CPPROCFLAGS) $(CWARNFLAGS) \
$(CDBGFLAGS) $(COPTFLAGS) $(CRTIMEFLAGS) $(CMTHREADFLAGS)
!endif
#
# --- Library-related definitions ----------------------------------------------
#
# --- Static library definitions ---
LIBBLIS_LIB = $(LIBBLIS).lib
LIB = lib
LIB_OPTIONS = /nologo
LIB_BLI_OUTPUT_ARG = /out:$(LIBBLIS_LIB)
LIB_BLI_INPUT_ARGS = *.obj
# --- Dynamic library definitions ---
LIBBLIS_DLL = $(LIBBLIS).dll
GENDLL = $(TOP_BUILD_DIR_ABS)\gendll.cmd
OBJ_LIST_FILE = libblis-objects.txt
SYM_DEF_FILEPATH = $(TOP_BUILD_DIR_ABS)\$(BUILD_DIRNAME)\libblis-symbols.def

View File

@@ -0,0 +1,351 @@
#! /usr/bin/env python
#
# BLIS
# An object-based framework for developing high-performance BLAS-like
# libraries.
#
# Copyright (C) 2013, The University of Texas
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# - Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# - Neither the name of The University of Texas nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
# ------------------------------------------------------------------------------
# Import modules
import sys
import os
import os.path
import getopt
import shutil
import string
# Global variables for command line options, with default settings.
script_name = ""
dry_run_flag = False
verbose_flag = False
# Global constants
flat_config_dirname = "config"
flat_header_dirname = "include"
flat_source_dirname = "frame"
leaf_list_path = "build/leaf_list"
ignore_list_path = "build/ignore_list"
ignore_list_win_path = "build/ignore_list.windows"
# ------------------------------------------------------------------------------
def print_usage():
# Print help information.
print " "
print " %s" % script_name
print " "
print " Field G. Van Zee"
print " "
print " Walk the BLIS source tree and copy all sources necessary for"
print " building BLIS under Windows into a single flat directory with"
print " no subdirectory hierarchy."
print " "
print " Usage:"
print " %s [options] tree_dir flat_dir" % script_name
print " "
print " The following options are accepted:"
print " "
print " -d dry-run"
print " Go through all the motions, but don't actually copy any"
print " files."
print " -v verbose"
print " Be verbose about actions (one line of output her action)."
print " "
# Exit the script.
sys.exit()
# ------------------------------------------------------------------------------
def main():
# Extern our global veriables.
global script_name
global dry_run_flag
global verbose_flag
# Get the script name so we can use it in our output.
( script_dir, script_name ) = os.path.split( sys.argv[0] )
try:
# Get the command line options.
options, args = getopt.getopt( sys.argv[1:], "dv")
except getopt.GetoptError, err:
# print help information and exit:
print str( err ) # will print something like "option -a not recognized"
print_usage()
# Parse our expected command line options.
print 'checking options'
for o, a in options:
if o == "-d":
print 'found dry run'
dry_run_flag = True
elif o == "-v":
verbose_flag = True
else:
assert False, "unhandled option"
# Check the number of arguments after command line option processing.
n_args = len( args )
if n_args != 2:
print_usage()
# Acquire the non-optional arguments.
tree_dir = args[0]
flat_dir = args[1]
# Acquire the list of directories we will ignore.
ignore_list = read_ignore_list()
# Acquire the list of leaf-type directories we will descend into.
leaf_list = read_leaf_list()
# Create strings for each of the base subdirectories in the flat
# destination directory.
flat_config_base_dirpath = os.path.join( flat_dir, flat_config_dirname )
flat_header_base_dirpath = os.path.join( flat_dir, flat_header_dirname )
flat_source_base_dirpath = os.path.join( flat_dir, flat_source_dirname )
# Start a list of directories to create.
dirs_to_create = []
# Append the config directory. We do this outside of the for loop because
# we don't need subdirectories for each leaf type.
dirs_to_create.append( flat_config_base_dirpath )
# For each of the leaf specifications, make the full pathnames of the
# subdirectories that will reside within the root destination directory.
for leaf_spec in leaf_list:
# Unpack the leaf_spec tuple.
src_exts, hdr_exts = leaf_spec
# Append the directory path name to our list.
dirs_to_create.append( flat_header_base_dirpath )
dirs_to_create.append( flat_source_base_dirpath )
# Iterate over the directory list we just created.
for dirpath in dirs_to_create:
# Make the subdirectories within the root destination directory, but
# only if they are not existing directories.
if os.path.isdir( dirpath ) == False:
# Take action only if this is not a dry run.
if dry_run_flag == False:
# Be verbose if verbosity was requested.
if verbose_flag == True:
print "%s: creating directory %s" % ( script_name, dirpath )
# Make the directory, and parent directories, for dirpath.
os.makedirs( dirpath )
else:
# Be verbose if verbosity was requested.
if verbose_flag == True:
print "%s: (dry-run) creating directory %s" % ( script_name, dirpath )
# Walk the directory structure top-down.
for dirpath, dirnames, filenames in os.walk( tree_dir ):
# Remove directories that appear in the ignore list.
for item in ignore_list:
if item in dirnames:
dirnames.remove( item )
# Consider each leaf specification. If we find the name in the directory
# path, then copy the files with its designated extensions into the flat
# source directory.
for leaf_spec in leaf_list:
# Unpack the leaf_spec tuple.
src_exts, hdr_exts = leaf_spec
# At this point following line can probably be removed
type_dir_name = os.sep + ''
flat_source_leaf_dirpath = flat_source_base_dirpath
flat_header_leaf_dirpath = flat_header_base_dirpath
if dirpath.find( type_dir_name ) != -1:
copy_files_to_flat_subdirs( dirpath, filenames, src_exts, hdr_exts,
flat_source_leaf_dirpath,
flat_header_leaf_dirpath )
# ------------------------------------------------------------------------------
def copy_files_to_flat_subdirs( dirpath, filenames, src_exts, hdr_exts, src_dirpath, hdr_dirpath ):
# Consider all files in dirpath.
for filename in filenames:
# Construct the full file path for the current file.
filepath = os.path.join( dirpath, filename )
# Iterate over the valid source extensions for the current directory
# path.
for src_ext in src_exts:
# If the filename/filepath ends with the source extension, copy it
# to the source subdirectory within the flat destination directory.
if filepath.endswith( src_ext ):
# Take action only if this is not a dry run.
if dry_run_flag == False:
# Be verbose if verbosity was requested.
if verbose_flag == True:
print "%s: copying to %s from %s" % ( script_name, src_dirpath, filepath )
# Copy the source file to the source subdirectory.
shutil.copy2( filepath, src_dirpath )
else:
# Be verbose if verbosity was requested.
if verbose_flag == True:
print "%s: (dry-run) copying to %s from %s" % ( script_name, src_dirpath, filepath )
# Iterate over the valid header extensions for the current directory
# path.
for hdr_ext in hdr_exts:
# If the filename/filepath ends with the header extension, copy it
# to the include subdirectory within the flat destination directory.
if filepath.endswith( hdr_ext ):
# Take action only if this is not a dry run.
if dry_run_flag == False:
# Be verbose if verbosity was requested.
if verbose_flag == True:
print "%s: copying to %s from %s" % ( script_name, hdr_dirpath, filepath )
# Copy the header file to the header subdirectory.
shutil.copy2( filepath, hdr_dirpath )
else:
# Be verbose if verbosity was requested.
if verbose_flag == True:
print "%s: (dry-run) copying to %s from %s" % ( script_name, hdr_dirpath, filepath )
# ------------------------------------------------------------------------------
def read_ignore_list():
# Open the ignore list files as read-only.
ignore_file = open( ignore_list_path, 'r' )
ignore_file_win = open( ignore_list_win_path, 'r' )
# Read all lines in the ignore list files. The items in these lists contain
# newlines, which we'll strip out shortly.
raw_list = ignore_file.readlines()
raw_win_list = ignore_file_win.readlines()
# Close the files.
ignore_file.close()
ignore_file_win.close()
# Initialize an empty ignore list for the stripped version of the raw list.
ignore_list = []
# Iterate over the first raw list.
for line in raw_list:
# Append the stripped line to a new list.
ignore_list.append( line.strip() )
# Iterate over the second raw list.
for line in raw_win_list:
# Append the stripped line to a new list.
ignore_list.append( line.strip() )
# Return the list of stripped lines.
return ignore_list
# ------------------------------------------------------------------------------
def read_leaf_list():
# Open the leaf list file.
leaf_file = open( leaf_list_path, 'r' )
# Read the lines in the file.
line_list = leaf_file.readlines()
# Start with a blank list.
leaf_list = []
# Iterate over the lines.
for line in line_list:
# Split the specification by colon to separate the fields.
fields = string.split( string.strip( line ), ':' )
# Get the individual fields of the specification.
src_exts = string.split( fields[0], ',' )
hdr_exts = string.split( fields[1], ',' )
# If it's a singleton list of an empty string, make it an empty list.
if len(src_exts) == 1:
if src_exts[0] == '':
src_exts = []
# If it's a singleton list of an empty string, make it an empty list.
if len(hdr_exts) == 1:
if hdr_exts[0] == '':
hdr_exts = []
# Pack the fields into a tuple.
leaf_spec = ( src_exts, hdr_exts )
# Append the tuple to our list.
leaf_list.append( leaf_spec )
# Return the list.
return leaf_list
# ------------------------------------------------------------------------------
# Begin by executing main().
main()

View File

@@ -0,0 +1,252 @@
#! /usr/bin/env python
#
# BLIS
# An object-based framework for developing high-performance BLAS-like
# libraries.
#
# Copyright (C) 2013, The University of Texas
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# - Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# - Neither the name of The University of Texas nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
# ------------------------------------------------------------------------------
# Import modules
import sys
import os
import os.path
import getopt
# Global variables for command line options, with default settings.
script_name = ""
verbose_flag = False
# Global constants
toplevel_dirpath = "."
svn_dirname = ".svn"
entries_filename = "entries"
revision_filename = "revision"
dummy_rev_string = "unknown"
# ------------------------------------------------------------------------------
def print_usage():
# Print help information.
print " "
print " %s" % script_name
print " "
print " Field G. Van Zee"
print " "
print " This script ensures that a revision file exists so nmake can include the"
print " revision number in the subdirectory paths to the build products."
print " "
print " If a .svn directory exists, the revision file is created (or updated)"
print " to contain the revision number contained in .svn\entries file."
print " Otherwise, if a .svn directory does not exist, the revision file is"
print " left untouched if it exists, and created with a dummy value if it does"
print " not."
print " "
print " This script is typically invoked by configure.cmd, but it can also be"
print " run manually."
print " "
print " Usage:"
print " %s" % script_name
print " "
print " The following options are accepted:"
print " "
print " -v verbose"
print " Be verbose. Output what's happening."
print " "
# Exit the script.
sys.exit()
# ------------------------------------------------------------------------------
def main():
# Extern our global veriables.
global script_name
global verbose_flag
# Get the script name so we can use it in our output.
( script_dir, script_name ) = os.path.split( sys.argv[0] )
try:
# Get the command line options.
options, args = getopt.getopt( sys.argv[1:], "v")
except getopt.GetoptError, err:
# print help information and exit:
print str( err ) # will print something like "option -a not recognized"
print_usage()
# Parse our expected command line options.
for o, a in options:
if o == "-v":
verbose_flag = True
else:
assert False, "unhandled option"
# Check the number of arguments after command line option processing.
n_args = len( args )
if n_args != 0:
print_usage()
# Construct the filepaths to the entries and revision files.
entries_filepath = os.path.join( toplevel_dirpath, svn_dirname, entries_filename )
revision_filepath = os.path.join( toplevel_dirpath, revision_filename )
# Test for the existence of the entries file (and by proxy, a working copy).
entries_file_exists = file_exists( entries_filepath )
# If the entries file exists, we are in a working copy, and thus we can
# overwrite the revision file with a potentially new value.
if entries_file_exists == True:
# Read the revision number from the entries file.
rev_num_str = read_revision_from_entries( entries_filepath )
# Be verbose if verbosity was requested.
if verbose_flag == True:
print "%s: Found working copy; writing revision string \"%s\" to %s" % ( script_name, rev_num_str, revision_filepath )
# Write the revision number to the revision file.
write_revision_to_file( rev_num_str, revision_filepath )
# If we can't find the entries file, we probably are in an exported
# copy: either an official snapshot, or a copy that someone exported
# manually--hopefully (and likely) the former.
else:
# Be verbose if verbosity was requested.
if verbose_flag == True:
print "%s: Found export. Checking for revision file..." % ( script_name )
# Test for the existence of the revision file.
rev_file_exists = file_exists( revision_filepath )
# If the revision file does not exist, create a dummy file so the
# configure script has something to work with.
if rev_file_exists == False:
# Be verbose if verbosity was requested.
if verbose_flag == True:
print "%s: Revision file not found. Writing dummy revision string \"%s\" to %s" % ( script_name, dummy_rev_string, revision_filepath )
# Write the dummy string to the revision file.
write_revision_to_file( dummy_rev_string, revision_filepath )
else:
# Get the revision number from the file just for the purposes of
# being verbose, if it was requested.
rev_num_str = read_revision_file( revision_filepath )
# Be verbose if verbosity was requested.
if verbose_flag == True:
print "%s: Revision file found containing revision string \"%s\". Export is valid snapshot!" % ( script_name, rev_num_str )
# ------------------------------------------------------------------------------
def file_exists( filepath ):
# Try to open the file read-only.
try:
fp = open( filepath, 'r' )
fp.close()
exists = True
except IOError, err:
exists = False
return exists
# ------------------------------------------------------------------------------
def read_revision_from_entries( entries_filepath ):
# Open the ignore list files as read-only.
entries_file = open( entries_filepath, 'r' )
# Read all lines in the entries file.
raw_list = entries_file.readlines()
# Close the file.
entries_file.close()
# Grab the fourth line, which is where the revision number lives, and strip
# it of whitespace (probably just a newline).
rev_num_str = raw_list[3].strip()
# Return the revision number string.
return rev_num_str
# ------------------------------------------------------------------------------
def write_revision_to_file( rev_string, revision_filepath ):
# Open the revision file for writing.
revision_file = open( revision_filepath, 'w' )
# Write the revision string to the file.
revision_file.write( rev_string )
# Close the file.
revision_file.close()
# ------------------------------------------------------------------------------
def read_revision_file( revision_filepath ):
# Open the revision file.
revision_file = open( revision_filepath, 'r' )
# Read the first (and only) line.
line = revision_file.readline()
# Close the file.
revision_file.close()
# Grab the string and strip the it of whitespace (should just be a newline).
rev_num_str = line.strip()
# Return the revision number string.
return rev_num_str
# ------------------------------------------------------------------------------
# Begin by executing main().
main()

View File

@@ -0,0 +1,360 @@
#! /usr/bin/env python
#
# BLIS
# An object-based framework for developing high-performance BLAS-like
# libraries.
#
# Copyright (C) 2013, The University of Texas
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# - Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# - Neither the name of The University of Texas nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
# ------------------------------------------------------------------------------
# Import modules
import sys
import os
import os.path
import getopt
import re
import string
# Global variables for command line options, with default settings.
script_name = ""
dry_run_flag = False
verbose_flag = False
# Global constants
config_dirname = "config"
source_dirname = "frame"
object_dirname = "obj"
object_extension = ".obj"
leaf_list_path = "build/leaf_list"
revision_filename = "revision"
rev_varname = "REVISION"
pwd_varname = "PWD"
arch_varname = "ARCH_STR"
build_varname = "BUILD_STR"
ccompiler_varname = "CCOMPILER_STR"
# ------------------------------------------------------------------------------
def print_usage():
# Print help information.
print " "
print " %s" % script_name
print " "
print " Field G. Van Zee"
print " "
print " Create a config.mk file that is to be included by the nmake Makefile."
print " This config.mk file is based on a template, but also includes variable"
print " definitions that are needed for the specific build were are performing."
print " The variables which are currently appended to config.mk at runtime are:"
print " - the revision string"
print " - the path to the current working directory"
print " - the build string (e.g. debug, release)"
print " - the architecture string (e.g. x86, x64)"
print " - the C compiler to use (e.g. icl, cl)"
print " - a list of paths to the object files to be compiled"
print " The config.mk file is placed within the config subdirectory."
print " "
print " Usage:"
print " %s [options] flat_dir arch build ccompiler path\\to\\config.mk.in" % script_name
print " "
print " The following options are accepted:"
print " "
print " -d dry-run"
print " Go through all the motions, but don't actually output"
print " the nmake definition file."
print " -v verbose"
print " Be verbose about actions (one line of output her action)."
print " "
# Exit the script.
sys.exit()
# ------------------------------------------------------------------------------
def main():
# Extern our global veriables.
global script_name
global dry_run_flag
global verbose_flag
# Get the script name so we can use it in our output.
( script_dir, script_name ) = os.path.split( sys.argv[0] )
try:
# Get the command line options.
options, args = getopt.getopt( sys.argv[1:], "dv")
except getopt.GetoptError, err:
# print help information and exit:
print str( err ) # will print something like "option -a not recognized"
print_usage()
# Parse our expected command line options.
for o, a in options:
if o == "-d":
dry_run_flag = True
elif o == "-v":
verbose_flag = True
else:
assert False, "unhandled option"
# Check the number of arguments after command line option processing.
n_args = len( args )
if n_args != 5:
print_usage()
# Acquire the non-optional arguments.
flat_dir = args[0]
arch_string = args[1]
build_string = args[2]
ccompiler_string = args[3]
input_filepath = args[4]
# Acquire the list of leaf-type directories we will descend into.
leaf_list = read_leaf_list()
# Read the contents of the template file.
template_file_line_list = read_template_file( input_filepath )
# Initialize a new list for the lines to be output
output_file_line_list = template_file_line_list
# Read the revision number from the revision file.
rev_num_str = read_revision_file( revision_filename )
# Add a variable for the revision number of the code we're working with.
rev_var_value = rev_varname + " = " + rev_num_str + "\n"
output_file_line_list.append( rev_var_value )
# Add a variable for the path to the current working directory and append
# it to our list.
pwd_var_value = pwd_varname + " = " + os.getcwd() + "\n"
output_file_line_list.append( pwd_var_value )
# Add a variable for the architecture string and append it to our list.
arch_var_value = arch_varname + " = " + arch_string + "\n"
output_file_line_list.append( arch_var_value )
# Add a variable for the build type string and append it to our list.
build_var_value = build_varname + " = " + build_string + "\n"
output_file_line_list.append( build_var_value )
# Add a variable for the C compiler string and append it to our list.
ccompiler_var_value = ccompiler_varname + " = " + ccompiler_string + "\n"
output_file_line_list.append( ccompiler_var_value )
# Walk the flat subdirectories for each of the leaves.
for leaf_spec in leaf_list:
# Unpack the leaf_spec tuple.
src_exts, hdr_exts = leaf_spec
# Create the paths to the source and object subdirectories.
src_dirpath = os.path.join( flat_dir, source_dirname )
obj_dirpath = os.path.join( flat_dir, object_dirname, arch_string, build_string )
# Get a list of files from the leaf subdirectory.
src_filenames = os.listdir( src_dirpath )
# This will be the nmake variable name to which we will assign the list
# of source files.
nmake_varname = "BLIS_OBJS"
# Generate the line to output.
leaf_line = generate_object_list( nmake_varname, src_filenames, src_exts, obj_dirpath )
# Accumulate the lines.
output_file_line_list.append( leaf_line )
# Get the filename part of the input filepath.
input_filedir, input_filename = os.path.split( input_filepath )
# Remove the .in extension in the output filename.
output_filename = re.sub( '.mk.in', '.mk', input_filename )
# Construct the filepath for the output file.
output_filepath = os.path.join( flat_dir, config_dirname, output_filename )
# Write the output lines.
write_output_file( output_filepath, output_file_line_list )
# ------------------------------------------------------------------------------
def read_revision_file( filepath ):
# Try to open the revision file.
try:
revision_file = open( filepath, 'r' )
except IOError, err:
print "%s: Couldn't open revision file %s" % ( script_name, filepath )
sys.exit(1)
# Read the first (and only) line.
line = revision_file.readline()
# Close the file.
revision_file.close()
# Grab the string and strip the it of whitespace (should just be a newline).
rev_num_str = line.strip()
# Return the revision number string.
return rev_num_str
# ------------------------------------------------------------------------------
def generate_object_list( nmake_varname, src_filenames, src_exts, obj_dirpath ):
# Initialize the string as an assignment operation.
the_line = nmake_varname + " = "
# Return early if there are no source extensions for this leaf spec.
if src_exts == []:
return ""
# Construct a pattern to match any file ending with any of the source file
# extensions given. This string is going to look something like ".[cf]".
src_pattern = '\.['
for src_ext in src_exts:
src_pattern = src_pattern + src_ext
src_pattern = src_pattern + ']'
# Consider all source files.
for src_filename in src_filenames:
obj_filename = re.sub( src_pattern, '.obj', src_filename )
# Create the full path to the file.
obj_filepath = os.path.join( obj_dirpath, obj_filename )
# Be verbose if verbosity was requested.
if verbose_flag == True:
print "%s: adding file %s" % ( script_name, obj_filepath )
# And then add it to the list.
the_line = the_line + obj_filepath + " "
# Be verbose if verbosity was requested.
if verbose_flag == True:
print "%s: %s" % ( script_name, the_line )
# Append a newline to the end of the line, for file.writelines().
the_line = the_line + "\n"
# Return the new line.
return the_line
# ------------------------------------------------------------------------------
def read_template_file( template_filepath ):
# Open the template file as read-only.
template_file = open( template_filepath, 'r' )
# Read all lines in the template file.
template_file_lines = template_file.readlines()
# Close the file.
template_file.close()
# Return the list of lines in the template file.
return template_file_lines
# ------------------------------------------------------------------------------
def write_output_file( output_filepath, output_lines ):
# Take action only if this is not a dry run.
if dry_run_flag == False:
# Open the template file as writable.
output_file = open( output_filepath, 'w' )
# Write the lines.
output_file.writelines( output_lines )
# Close the file.
output_file.close()
# ------------------------------------------------------------------------------
def read_leaf_list():
# Open the leaf list file.
leaf_file = open( leaf_list_path, 'r' )
# Read the lines in the file.
line_list = leaf_file.readlines()
# Start with a blank list.
leaf_list = []
# Iterate over the lines.
for line in line_list:
# Split the specification by colon to separate the fields.
fields = string.split( string.strip( line ), ':' )
# Get the individual fields of the specification.
src_exts = string.split( fields[0], ',' )
hdr_exts = string.split( fields[1], ',' )
# If it's a singleton list of an empty string, make it an empty list.
if len(src_exts) == 1:
if src_exts[0] == '':
src_exts = []
# If it's a singleton list of an empty string, make it an empty list.
if len(hdr_exts) == 1:
if hdr_exts[0] == '':
hdr_exts = []
# Pack the fields into a tuple.
leaf_spec = ( src_exts, hdr_exts )
# Append the tuple to our list.
leaf_list.append( leaf_spec )
# Return the list.
return leaf_list
# ------------------------------------------------------------------------------
# Begin by executing main().
main()

1
windows/build/ignore_list Symbolic link
View File

@@ -0,0 +1 @@
../../build/gen-make-frags/ignore_list

View File

@@ -0,0 +1 @@
.git

1
windows/build/leaf_list Normal file
View File

@@ -0,0 +1 @@
c:h

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,72 @@
::
::
:: BLIS
:: An object-based framework for developing high-performance BLAS-like
:: libraries.
::
:: Copyright (C) 2013, The University of Texas
::
:: Redistribution and use in source and binary forms, with or without
:: modification, are permitted provided that the following conditions are
:: met:
:: - Redistributions of source code must retain the above copyright
:: notice, this list of conditions and the following disclaimer.
:: - Redistributions in binary form must reproduce the above copyright
:: notice, this list of conditions and the following disclaimer in the
:: documentation and/or other materials provided with the distribution.
:: - Neither the name of The University of Texas nor the names of its
:: contributors may be used to endorse or promote products derived
:: from this software without specific prior written permission.
::
:: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
:: "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
:: LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
:: A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
:: HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
:: SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
:: LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
:: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
:: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
:: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
:: OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
::
::
@echo off
echo.
echo Makefile
echo.
echo Field G. Van Zee
echo.
echo nmake Makefile for building BLIS for Microsoft Windows. nmake targets
echo may be invoked after running the configure.cmd script. Valid targets are:
echo.
echo all - Invoke the lib and dll targets.
echo lib - Build BLIS as a static library.
echo dll - Build BLIS as a dynamically-linked library.
echo help - Output help and usage information.
echo clean - Invoke clean-log and clean-build targets.
echo clean-log - Remove any log files present.
echo clean-config - Remove all products of configure.cmd. Namely, remove the
echo config, include, and src directories.
echo clean-build - Remove all products of the compilation portion of the build
echo process. Namely, remove the obj, lib, and dll directories.
echo distclean - Invoke clean-log, clean-config, and clean-build targets.
echo.
echo The Makefile also recognizes configuration options corresponding to the
echo following Makefile variables:
echo.
echo VERBOSE - When defined, nmake outputs the actual commands
echo executed instead of more concise one-line progress
echo indicators. (Undefined by default.)
echo.
echo Typically, these options are specified by commenting or uncommenting the
echo corresponding lines in the Makefile. However, if the Makefile currently does
echo not define one of the options, and you wish to enable the corresponding
echo feature without editing the Makefile, you may define the variable at the
echo command line when nmake is invoked. For example, you may enable verboseness
echo while invoking the lib target as follows:
echo.
echo nmake lib VERBOSE=1
echo.

87
windows/configure.cmd Normal file
View File

@@ -0,0 +1,87 @@
::
::
:: BLIS
:: An object-based framework for developing high-performance BLAS-like
:: libraries.
::
:: Copyright (C) 2013, The University of Texas
::
:: Redistribution and use in source and binary forms, with or without
:: modification, are permitted provided that the following conditions are
:: met:
:: - Redistributions of source code must retain the above copyright
:: notice, this list of conditions and the following disclaimer.
:: - Redistributions in binary form must reproduce the above copyright
:: notice, this list of conditions and the following disclaimer in the
:: documentation and/or other materials provided with the distribution.
:: - Neither the name of The University of Texas nor the names of its
:: contributors may be used to endorse or promote products derived
:: from this software without specific prior written permission.
::
:: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
:: "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
:: LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
:: A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
:: HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
:: SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
:: LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
:: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
:: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
:: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
:: OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
::
::
@echo off
:ENVIRONMENT
set GEN_CHECK_REV_FILE=.\build\gen-check-rev-file.py
set GATHER_SRC=.\build\gather-src-for-windows.py
set GEN_CONFIG_FILE=.\build\gen-config-file.py
set CONFIG_DEFS_TEMPL=.\build\config.mk.in
set SRC_TREE_DIR=..\frame
set TOP_BUILD_DIR=.
:PARAMS
if "%1"=="" (goto USAGE)
if "%2"=="" (goto USAGE)
if "%3"=="" (goto USAGE)
set ARCH=%1
set BUILD=%2
set CCOMPILER=%3
:TASK_UNIT
echo %0: Checking/updating revision file.
%GEN_CHECK_REV_FILE% -v
echo %0: Gathering source files into local flat directories.
%GATHER_SRC% %SRC_TREE_DIR% %TOP_BUILD_DIR%
echo %0: Creating configure definitions file.
%GEN_CONFIG_FILE% %TOP_BUILD_DIR% %ARCH% %BUILD% %CCOMPILER% %CONFIG_DEFS_TEMPL%
echo %0: Configuration and setup complete. You may now run nmake.
goto END
:USAGE
echo.
echo configure.cmd
echo.
echo A wrapper script for various configuration and setup scripts that need
echo. to be run before nmake when building BLIS for Microsoft Windows.
echo.
echo USAGE:
echo %0 [arch] [build] [cc]
echo.
echo arch -- The architecture string to build.
echo Supported values: {x86,x64}
echo build -- The kind of build.
echo Supported values: {debug,release}
echo cc -- The C compiler to use.
echo Supported values: {icl,cl}
echo.
echo examples:
echo %0 x86 debug icl
echo %0 x64 release cl
echo.
:END

128
windows/gendll.cmd Normal file
View File

@@ -0,0 +1,128 @@
@echo off
@setlocal enabledelayedexpansion
rem --------------------------------------------------------------------
rem Build a dll out of a set of object files specified by the
rem argument /objlist.
rem
rem The .lib file thus created is an "import" library, which one links
rem with, but the bulk of the code ends up in the associated .dll file.
rem ---------------------------------------------------------------------
set THIS_SCRIPT=%~dp0%~nx0
if "%1"=="" goto USAGE
if "%2"=="" goto USAGE
if "%3"=="" goto USAGE
if "%4"=="" goto USAGE
if "%5"=="" goto USAGE
set gd_lib_name=%1
set gd_link=%gd_lib_name%-static.link
set LINKER=%3
set LINKARGSFILE=%4
set gd_def=%5
:PARSE_ARGS
set IMPORT=
set OBJLIST=
:ARGLOOP
if "%6"=="" goto ENDARGLOOP
if /i not "%6"=="/import" goto OBJARG
set IMPORT=!IMPORT! %7
goto SHIFT
:OBJARG
if /i not "%6"=="/objlist" goto ENDARGLOOP
set OBJLIST=%7
:SHIFT
shift /4
shift /4
goto ARGLOOP
:ENDARGLOOP
if defined OBJLIST goto COMPILER_SETUP
echo Error: must supply /objlist <file with list of object names>
goto USAGE
:COMPILER_SETUP
set gd_path=%2
set gd_dll_path=%gd_path%.dll
set gd_main_c=dll_main__%gd_lib_name%.c
set gd_main_obj=dll_main__%gd_lib_name%.obj
rem create C file for dll_main
for /F "tokens=*" %%i in ("#include <windows.h>") do echo %%i >%gd_main_c%
echo. >>%gd_main_c%
echo BOOLEAN WINAPI DllMain( >>%gd_main_c%
echo HINSTANCE hDllHandle, >>%gd_main_c%
echo DWORD nReason, >>%gd_main_c%
echo LPVOID Reserved){ >>%gd_main_c%
echo. >>%gd_main_c%
echo BOOLEAN bSuccess = TRUE;>>%gd_main_c%
echo. >>%gd_main_c%
echo switch (nReason){ >>%gd_main_c%
echo case DLL_PROCESS_ATTACH: >>%gd_main_c%
echo DisableThreadLibraryCalls( hDllHandle ); >>%gd_main_c%
echo break; >>%gd_main_c%
echo case DLL_PROCESS_DETACH: >>%gd_main_c%
echo break; >>%gd_main_c%
echo. >>%gd_main_c%
echo }; >>%gd_main_c%
echo. >>%gd_main_c%
echo return bSuccess; >>%gd_main_c%
echo }; >>%gd_main_c%
echo.>>%gd_main_c%
rem set up link file by specifying dll filepath and main object
echo /Fe%gd_dll_path% > %gd_link%
echo %gd_main_obj% >> %gd_link%
rem add contents of linkargs file; most of the link argument action is
rem in this file
type %LINKARGSFILE% >> %gd_link%
rem add command-line import libraries, if any
if defined IMPORT echo !IMPORT! >> %gd_link%
rem add export specification
echo %gd_def% >> %gd_link%
rem add contents of OBJLIST file
type %OBJLIST% >> %gd_link%
rem create dll, import lib, and export file
%LINKER% /nologo /c /O2 /Fo%gd_main_obj% %gd_main_c% >> gendll-cl.log
%LINKER% @%gd_link%
:CLEANUP
del /F /Q %gd_link% %gd_main_c% %gd_main_obj% gendll-cl.log
goto END
:USAGE
echo.
echo. gendll.cmd
echo.
echo. Generate a dynamically-linked library from a set of object files
echo. specified in objlist_file.
echo.
echo. Usage:
echo. %0 dllname dllpath linker linkargs_file symbols_file {/import importlib} /objlist objlist_file
echo.
echo. dllname -- the name of the DLL being created, with no extension.
echo. dllpath -- the path to the DLL being created, with no extension.
echo. linker -- the compiler to use to link the DLL.
echo. linkargs_file -- the path to a file containing a list of all linker
echo. arguments--link options, libraries, and library paths--
echo. that that may be needed to successfully link the DLL
echo. being created.
echo. symbols_file -- the path to a file containing a list of symbols to
echo. export in the DLL.
echo. importlib -- the path to a .lib library that you wish to import into
echo. the DLL being created. Optional.
echo. objlist_file -- the path to a file containing the list of object files
echo. that make up the bulk of the DLL being created.
echo.
:END
endlocal

11
windows/linkargs.txt Normal file
View File

@@ -0,0 +1,11 @@
/nologo
/LD /MT
/LIBPATH:"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib"
/LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib"
/nodefaultlib:libcmt /nodefaultlib:libc /nodefaultlib:libmmt
msvcrt.lib
/LIBPATH:"C:\Program Files (x86)\Intel\Compiler\11.1\048\lib\ia32"
/LIBPATH:"C:\Program Files (x86)\Intel\Compiler\11.1\048\mkl\ia32\lib"
mkl_intel_c.lib
mkl_sequential.lib
mkl_core.lib

11
windows/linkargs64.txt Normal file
View File

@@ -0,0 +1,11 @@
/nologo
/LD /MT
/LIBPATH:"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\x64"
/LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\amd64"
/nodefaultlib:libcmt /nodefaultlib:libc /nodefaultlib:libmmt
msvcrt.lib
/LIBPATH:"C:\Program Files (x86)\Intel\Compiler\11.1\048\lib\intel64"
/LIBPATH:"C:\Program Files (x86)\Intel\Compiler\11.1\048\mkl\em64t\lib"
mkl_intel_lp64.lib
mkl_sequential.lib
mkl_core.lib

1
windows/revision Normal file
View File

@@ -0,0 +1 @@
unknown

BIN
windows/vc110.pdb Normal file

Binary file not shown.