Skip to content

Commit

Permalink
Various changes to treatment of integers.
Browse files Browse the repository at this point in the history
Details:
- Added a new cpp macro in bli_config.h, BLIS_INT_TYPE_SIZE, which can be
  assigned values of 32, 64, or some other value. The former two result in
  defining gint_t/guint_t in terms of 32- or 64-bit integers, while the latter
  causes integers to be defined in terms of a default type (e.g. long int).
- Updated bli_config.h in reference and clarksville configurations according
  to above changes.
- Updated test drivers in test and testsuite to avoid type warnings associated
  with format specifiers not matching the types of their arguments to printf()
  and scanf().
- Inserted missing #include "bli_system.h" into blis.h (which was slated for
  inclusion in d141f9e).
- Added explicit typecasting of dim_t and inc_t to macros in
  bli_blas_macro_defs.h (which are used in BLAS compatibility layer).
- Slight changes to CREDITS and INSTALL files.
- Slight tweaks to Windows build system, mostly in the form of switching to
  Windows-style CRLF newlines for certain files.
  • Loading branch information
fgvanzee committed Sep 10, 2013
1 parent 0684377 commit 7ae4d7a
Show file tree
Hide file tree
Showing 70 changed files with 3,344 additions and 3,281 deletions.
1 change: 1 addition & 0 deletions CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ but many others have contributed input and feedback, including:
Devin Matthews (The University of Texas at Austin)
Tze Meng Low (The University of Texas at Austin)
Mikhail Smelyanskiy (Intel, Parallel Computing Lab)
Tyler Smith (The University of Texas at Austin)
Rhys Ulerich (The University of Texas at Austin)
Robert van de Geijn (The University of Texas at Austin)
Zhang Xianyi (Chinese Academy of Sciences)
Expand Down
8 changes: 4 additions & 4 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ located at the BLIS project's official website:
http://code.google.com/p/blis/wiki/BuildSystem

This document will always contain the most up-to-date information related
to instantiating a BLIS library from the framework source code. If you
have any further questions or wish to provide feedback, please contact the
BLIS community by posting your message to the general user mailing list:
to instantiating a BLIS library from the framework source code. If you have
any further questions or wish to provide feedback, please contact the BLIS
community by posting your message to the BLIS developer's mailing list:

https://groups.google.com/d/forum/blis-discuss
https://groups.google.com/d/forum/blis-devel

Thanks for your interest in the BLIS framework!

Expand Down
22 changes: 19 additions & 3 deletions config/clarksville/bli_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@



// -- INTEGER PROPERTIES -------------------------------------------------------

// The bit size of the integer type used to track values such as dimensions,
// strides, diagonal offsets. A value of 32 results in BLIS using 32-bit signed
// integers while 64 results in 64-bit integers. Any other value results in use
// of the C99 type "long int". Note that this ONLY affects integers used
// internally within BLIS as well as those exposed in the native BLAS-like BLIS
// interface.
#define BLIS_INT_TYPE_SIZE 64



// -- FLOATING-POINT PROPERTIES ------------------------------------------------

#define BLIS_NUM_FP_TYPES 4
Expand Down Expand Up @@ -131,9 +143,13 @@
// 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
// The bit size of the integer type used to track values such as dimensions and
// leading dimensions (ie: column strides) within the BLAS compatibility layer.
// A value of 32 results in the compatibility layer using 32-bit signed integers
// while 64 results in 64-bit integers. Any other value results in use of the
// C99 type "long int". Note that this ONLY affects integers used within the
// BLAS compatibility layer.
#define BLIS_BLAS2BLIS_INT_TYPE_SIZE 64

// Fortran-77 name-mangling macros.
#define PASTEF770(name) name ## _
Expand Down
24 changes: 20 additions & 4 deletions config/reference/bli_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@



// -- INTEGER PROPERTIES -------------------------------------------------------

// The bit size of the integer type used to track values such as dimensions,
// strides, diagonal offsets. A value of 32 results in BLIS using 32-bit signed
// integers while 64 results in 64-bit integers. Any other value results in use
// of the C99 type "long int". Note that this ONLY affects integers used
// internally within BLIS as well as those exposed in the native BLAS-like BLIS
// interface.
#define BLIS_INT_TYPE_SIZE 32



// -- FLOATING-POINT PROPERTIES ------------------------------------------------

#define BLIS_NUM_FP_TYPES 4
Expand All @@ -55,7 +67,7 @@
// -- MULTITHREADING -----------------------------------------------------------

// The maximum number of BLIS threads that will run concurrently.
#define BLIS_MAX_NUM_THREADS 24
#define BLIS_MAX_NUM_THREADS 1



Expand Down Expand Up @@ -131,9 +143,13 @@
// 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
// The bit size of the integer type used to track values such as dimensions and
// leading dimensions (ie: column strides) within the BLAS compatibility layer.
// A value of 32 results in the compatibility layer using 32-bit signed integers
// while 64 results in 64-bit integers. Any other value results in use of the
// C99 type "long int". Note that this ONLY affects integers used within the
// BLAS compatibility layer.
#define BLIS_BLAS2BLIS_INT_TYPE_SIZE 32

// Fortran-77 name-mangling macros.
#define PASTEF770(name) name ## _
Expand Down
8 changes: 4 additions & 4 deletions frame/include/bli_blas_macro_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@

#define bli_convert_blas_dim1( n_blas, n_blis )\
{ \
if ( n_blas < 0 ) n_blis = 0; \
else n_blis = n_blas; \
if ( n_blas < 0 ) n_blis = ( dim_t )0; \
else n_blis = ( dim_t )n_blas; \
}

// Macro to reposition vector pointers and flip signs of increments
Expand All @@ -54,12 +54,12 @@
if ( incx_blas < 0 ) \
{ \
x_blis = (x_blas) + (n-1) * (incx_blas); \
incx_blis = -(incx_blas); \
incx_blis = ( inc_t )(-incx_blas); \
} \
else \
{ \
x_blis = (x_blas); \
incx_blis = (incx_blas); \
incx_blis = ( inc_t )(incx_blas); \
} \
}

Expand Down
57 changes: 30 additions & 27 deletions frame/include/bli_type_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,48 +48,46 @@
#include <stdint.h>
#else
// When stdint.h is not available, manually typedef the types we will use.
#if 0
typedef signed long int int64_t;
typedef unsigned long int uint64_t;
#ifdef _WIN32
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
typedef signed long int int32_t;
typedef unsigned long int uint32_t;
#error "Attempting to compile on pre-C99 system without stdint.h."
#endif
#endif

// -- General-purpose integers --

// NOTE: Here we define our general-purpose integers in terms of the C types,
// rather than stdint types, because some systems will need larger integers
// than others, and "long int" seems to be interpreted to the correct size
// on most of our systems.
//#if 0
//typedef int64_t gint_t; // general signed integer
//typedef uint64_t guint_t; // general unsigned integer
//#else
//typedef int32_t gint_t; // general signed integer
//typedef uint32_t guint_t; // general unsigned integer
//#endif
typedef signed long int gint_t; // general signed integer
typedef unsigned long int guint_t; // general unsigned integer
// Define integer types depending on what size integer was requested.
#if BLIS_INT_TYPE_SIZE == 32
typedef int32_t gint_t;
typedef uint32_t guint_t;
#elif BLIS_INT_TYPE_SIZE == 64
typedef int64_t gint_t;
typedef uint64_t guint_t;
#else
typedef signed long int gint_t;
typedef unsigned long int guint_t;
#endif

// -- Boolean type --

typedef gint_t bool_t;
typedef gint_t bool_t;

// -- Special-purpose integers --

// This cpp guard provides a temporary hack to allow libflame
// interoperability with BLIS.
#ifndef _DEFINED_DIM_T
#define _DEFINED_DIM_T
//typedef unsigned long int dim_t; // dimension type
typedef guint_t dim_t; // dimension type
typedef guint_t dim_t; // dimension type
#endif
typedef guint_t inc_t; // increment/stride type
typedef gint_t doff_t; // diagonal offset type
typedef guint_t siz_t; // byte size type
typedef guint_t info_t; // object information bit field
typedef guint_t inc_t; // increment/stride type
typedef gint_t doff_t; // diagonal offset type
typedef guint_t siz_t; // byte size type
typedef guint_t info_t; // object information bit field

// -- Complex types --

Expand Down Expand Up @@ -143,11 +141,16 @@ typedef dcomplex atom_t;
// Note: These types are typically only used by BLAS compatibility layer, but
// we must define them even when the compatibility layer isn't being built
// because they also occur in bli_slamch() and bli_dlamch().
#ifdef BLIS_ENABLE_BLAS2BLIS_INT64

// Define f77_int depending on what size of integer was requested.
#if BLIS_BLAS2BLIS_INT_TYPE_SIZE == 32
typedef int32_t f77_int;
#elif BLIS_BLAS2BLIS_INT_TYPE_SIZE == 64
typedef int64_t f77_int;
#else
typedef int32_t f77_int;
typedef long int f77_int;
#endif

typedef char f77_char;
typedef float f77_float;
typedef double f77_double;
Expand Down
8 changes: 1 addition & 7 deletions frame/include/blis.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,7 @@ extern "C" {

// -- System headers --

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

// gettimeofday() needs this.
#include <sys/time.h>
#include <time.h>
#include "bli_system.h"


// -- BLIS definitions --
Expand Down
8 changes: 4 additions & 4 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ TEST_OBJS := $(patsubst $(TEST_SRC_PATH)/%.c, \
CFLAGS += -I$(BLIS_INC_PATH) -I$(TEST_SRC_PATH)

LINKER := $(CC)
LDFLAGS := -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2 -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -lgfortranbegin -lgfortran -lm
LDFLAGS += -lpthread
#LDFLAGS := -L/usr/lib/gcc/i486-linux-gnu/4.4.3 -L/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/i486-linux-gnu/4.4.3/../../.. -L/usr/lib/i486-linux-gnu -lgfortranbegin -lgfortran -lm
#LDFLAGS := -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2 -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -lgfortranbegin -lgfortran -lm
#LDFLAGS += -lpthread
LDFLAGS := -L/usr/lib/gcc/i486-linux-gnu/4.4.3 -L/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/i486-linux-gnu/4.4.3/../../.. -L/usr/lib/i486-linux-gnu -lgfortranbegin -lgfortran -lm



Expand Down Expand Up @@ -274,5 +274,5 @@ test_%_blis.x: test_%_blis.o $(BLIS_LIB)
clean: cleanx

cleanx:
- $(RM_F) *.x
- $(RM_F) *.o *.x

7 changes: 5 additions & 2 deletions test/test_gemm.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,11 @@ int main( int argc, char** argv )
#else
printf( "data_gemm_%s", BLAS );
#endif
printf( "( %2ld, 1:5 ) = [ %4lu %4lu %4lu %10.3e %6.3f ];\n",
(p - p_begin + 1)/p_inc + 1, m, k, n, dtime_save, gflops );
printf( "( %2lu, 1:5 ) = [ %4lu %4lu %4lu %10.3e %6.3f ];\n",
( unsigned long )(p - p_begin + 1)/p_inc + 1,
( unsigned long )m,
( unsigned long )k,
( unsigned long )n, dtime_save, gflops );

#if 0
bli_obj_release_pack( &a_pack );
Expand Down
6 changes: 4 additions & 2 deletions test/test_gemv.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,10 @@ int main( int argc, char** argv )
#else
printf( "data_gemv_%s", BLAS );
#endif
printf( "( %2ld, 1:4 ) = [ %4lu %4lu %10.3e %6.3f ];\n",
(p - p_begin + 1)/p_inc + 1, m, n, dtime_save, gflops );
printf( "( %2lu, 1:4 ) = [ %4lu %4lu %10.3e %6.3f ];\n",
( unsigned long )(p - p_begin + 1)/p_inc + 1,
( unsigned long )m,
( unsigned long )n, dtime_save, gflops );

bli_obj_free( &alpha );
bli_obj_free( &beta );
Expand Down
6 changes: 4 additions & 2 deletions test/test_ger.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,10 @@ int main( int argc, char** argv )
#else
printf( "data_ger_%s", BLAS );
#endif
printf( "( %2ld, 1:4 ) = [ %4lu %4lu %10.3e %6.3f ];\n",
(p - p_begin + 1)/p_inc + 1, m, n, dtime_save, gflops );
printf( "( %2lu, 1:4 ) = [ %4lu %4lu %10.3e %6.3f ];\n",
( unsigned long )(p - p_begin + 1)/p_inc + 1,
( unsigned long )m,
( unsigned long )n, dtime_save, gflops );

bli_obj_free( &alpha );

Expand Down
6 changes: 4 additions & 2 deletions test/test_hemm.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,10 @@ int main( int argc, char** argv )
#else
printf( "data_hemm_%s", BLAS );
#endif
printf( "( %2ld, 1:4 ) = [ %4lu %4lu %10.3e %6.3f ];\n",
(p - p_begin + 1)/p_inc + 1, m, n, dtime_save, gflops );
printf( "( %2lu, 1:4 ) = [ %4lu %4lu %10.3e %6.3f ];\n",
( unsigned long )(p - p_begin + 1)/p_inc + 1,
( unsigned long )m,
( unsigned long )n, dtime_save, gflops );

#if 0
bli_blksz_obj_free( mr );
Expand Down
5 changes: 3 additions & 2 deletions test/test_hemv.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,9 @@ int main( int argc, char** argv )
#else
printf( "data_hemv_%s", BLAS );
#endif
printf( "( %2ld, 1:3 ) = [ %4lu %10.3e %6.3f ];\n",
(p - p_begin + 1)/p_inc + 1, m, dtime_save, gflops );
printf( "( %2lu, 1:3 ) = [ %4lu %10.3e %6.3f ];\n",
( unsigned long )(p - p_begin + 1)/p_inc + 1,
( unsigned long )m, dtime_save, gflops );

bli_obj_free( &alpha );
bli_obj_free( &beta );
Expand Down
5 changes: 3 additions & 2 deletions test/test_her.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,9 @@ int main( int argc, char** argv )
#else
printf( "data_her_%s", BLAS );
#endif
printf( "( %2ld, 1:3 ) = [ %4lu %10.3e %6.3f ];\n",
(p - p_begin + 1)/p_inc + 1, m, dtime_save, gflops );
printf( "( %2lu, 1:3 ) = [ %4lu %10.3e %6.3f ];\n",
( unsigned long )(p - p_begin + 1)/p_inc + 1,
( unsigned long )m, dtime_save, gflops );

bli_obj_free( &alpha );

Expand Down
5 changes: 3 additions & 2 deletions test/test_her2.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,9 @@ int main( int argc, char** argv )
#else
printf( "data_her2_%s", BLAS );
#endif
printf( "( %2ld, 1:3 ) = [ %4lu %10.3e %6.3f ];\n",
(p - p_begin + 1)/p_inc + 1, m, dtime_save, gflops );
printf( "( %2lu, 1:3 ) = [ %4lu %10.3e %6.3f ];\n",
( unsigned long )(p - p_begin + 1)/p_inc + 1,
( unsigned long )m, dtime_save, gflops );

bli_obj_free( &alpha );

Expand Down
8 changes: 5 additions & 3 deletions test/test_her2k.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ int main( int argc, char** argv )
bli_obj_create( dt_beta, 1, 1, 0, 0, &beta );

bli_obj_create( dt_a, m, k, 0, 0, &a );
bli_obj_create( dt_a, m, k, 0, 0, &b );
bli_obj_create( dt_b, m, k, 0, 0, &b );
bli_obj_create( dt_c, m, m, 0, 0, &c );
bli_obj_create( dt_c, m, m, 0, 0, &c_save );

Expand Down Expand Up @@ -286,8 +286,10 @@ int main( int argc, char** argv )
#else
printf( "data_her2k_%s", BLAS );
#endif
printf( "( %2ld, 1:4 ) = [ %4lu %4lu %10.3e %6.3f ];\n",
(p - p_begin + 1)/p_inc + 1, m, k, dtime_save, gflops );
printf( "( %2lu, 1:4 ) = [ %4lu %4lu %10.3e %6.3f ];\n",
( unsigned long )(p - p_begin + 1)/p_inc + 1,
( unsigned long )m,
( unsigned long )k, dtime_save, gflops );

#if 0
bli_blksz_obj_free( mr );
Expand Down
9 changes: 5 additions & 4 deletions test/test_herk.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ int main( int argc, char** argv )
dim_t p;
dim_t p_begin, p_end, p_inc;
int m_input, k_input;
num_t dt_a, dt_b, dt_c;
num_t dt_a, dt_c;
num_t dt_alpha, dt_beta;
int r, n_repeats;

Expand Down Expand Up @@ -98,7 +98,6 @@ int main( int argc, char** argv )
#endif

dt_a = BLIS_DOUBLE;
dt_b = BLIS_DOUBLE;
dt_c = BLIS_DOUBLE;
dt_alpha = BLIS_DOUBLE;
dt_beta = BLIS_DOUBLE;
Expand Down Expand Up @@ -278,8 +277,10 @@ int main( int argc, char** argv )
#else
printf( "data_herk_%s", BLAS );
#endif
printf( "( %2ld, 1:4 ) = [ %4lu %4lu %10.3e %6.3f ];\n",
(p - p_begin + 1)/p_inc + 1, m, k, dtime_save, gflops );
printf( "( %2lu, 1:4 ) = [ %4lu %4lu %10.3e %6.3f ];\n",
( unsigned long )(p - p_begin + 1)/p_inc + 1,
( unsigned long )m,
( unsigned long )k, dtime_save, gflops );

#if 0
bli_blksz_obj_free( mr );
Expand Down
Loading

0 comments on commit 7ae4d7a

Please sign in to comment.