-
Notifications
You must be signed in to change notification settings - Fork 374
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added 'altra', 'altramax' subconfigs. (#775)
Details: - Forward-ported 'altra' and 'altramax' subconfigurations from the older 'stable' branch lineage [1]. These subconfigs primarily target the Ampere Altra and AltraMax (ARM) processors. They also contain "QuickStart" directories with information and scripts to help use BLIS on these microarchitectures. Thanks to Jeff Diamond and Leick Robinson for developing these subconfigs and resources. - Updated kernels/armv8a/3/bli_gemm_armv8a_asm_d6x8.c according to changes in the 'stable' lineage, mostly related to re-enabling of assembly code branches that target general stride IO. [1] Note that the 'stable' branch is being used to make sure that more recent commits do not introduce unreasonable performance regressions. As such, the name should be interpreted as shorthand for "performance stable," not "API stable."
- Loading branch information
Showing
36 changed files
with
2,939 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <stdint.h> | ||
#include <stdio.h> | ||
#include <unistd.h> | ||
#include <float.h> | ||
#include <limits.h> | ||
#include "blis.h" | ||
|
||
/*################################################### | ||
// To build with openmp: | ||
// Note: Don't need the -lomp on Linux | ||
gcc -fopenmp -O2 -g -I$BLIS_HOME/include/$BLIS_ARCH TimeDGEMM.c $BLIS_HOME/lib/$BLIS_ARCH/libblis.a -lpthread -lm -o time_gemm.x | ||
|
||
// To build with pThreads | ||
source ./enable_blis.sh | ||
gcc -O2 -g -I$BLIS_HOME/include/$BLIS_ARCH TimeDGEMM.c $BLIS_HOME/lib/$BLIS_ARCH/libblis.a -lpthread -lm -o time_gemm.x | ||
|
||
// To run with QuickStart Macros... | ||
for N_CORES, S_SOCKETS | ||
|
||
blis_set_cores_and_sockets N S; $BLIS_NUMA time_gemm.x | ||
|
||
###################################################*/ | ||
|
||
#include <stdarg.h> // for Linux stdarg | ||
|
||
//################################################### | ||
// Handy blis functions | ||
//################################################### | ||
|
||
// Returns 0.0 if out ofmatrix | ||
double GetReal(obj_t *m, int row, int col) | ||
{ | ||
double im = 0, re = 0; // Imaginary component | ||
if (!m) return 0.0; | ||
|
||
bli_getijm(row, col, m, &re, &im); | ||
return re; | ||
} | ||
|
||
bool SetReal(obj_t *m, int row, int col, double dVal) | ||
{ | ||
if (!m) return 0.0; | ||
bli_setijm(dVal, 0.0, row, col, m); | ||
|
||
return true; | ||
} | ||
|
||
//################################################### | ||
// The basic meat - a one shot | ||
//################################################### | ||
|
||
bool TimeBlis(long size) | ||
{ | ||
int repeat = 3; // Best Of! | ||
double dAlpha = 1.0, dBeta = 0.0; // simplest case! | ||
|
||
//============== Allocate matrices ============= | ||
obj_t* alpha = (obj_t*) calloc(1, sizeof(obj_t)); | ||
obj_t* beta = (obj_t*) calloc(1, sizeof(obj_t)); | ||
|
||
bli_obj_create(BLIS_DOUBLE, 1, 1, 0, 0, alpha); | ||
bli_obj_create(BLIS_DOUBLE, 1, 1, 0, 0, beta); | ||
|
||
// Full gemm is alpha * A * B + beta * C | ||
bli_setsc(dAlpha, 0.0, alpha); // alpha is one | ||
bli_setsc(dBeta, 0.0, beta); // beta is zero | ||
//============================================== | ||
printf("Initializing %g GB of Matrices...\n", 8.0 * size * size * 3.0 / 1024.0 / 1024.0 / 1024.0); | ||
|
||
obj_t* a = (obj_t*) calloc(1, sizeof(obj_t)); | ||
obj_t* b = (obj_t*) calloc(1, sizeof(obj_t)); | ||
obj_t* c = (obj_t*) calloc(1, sizeof(obj_t)); | ||
|
||
bli_obj_create(BLIS_DOUBLE, size, size, size, 1, c); | ||
bli_obj_create(BLIS_DOUBLE, size, size, size, 1, a); | ||
bli_obj_create(BLIS_DOUBLE, size, size, size, 1, b); | ||
|
||
// Create Random matrices | ||
// that are well conditioned and invertible | ||
// (Note: this can be slow) | ||
// | ||
bli_randm(c); | ||
bli_randm(a); | ||
bli_randm(b); | ||
|
||
//============================================== | ||
// DO the timing, blis style... | ||
//============================================== | ||
|
||
double dBestTime = DBL_MAX; | ||
|
||
for (int i = 0; i < repeat; i++) | ||
{ | ||
printf("Performing DGEMM %d of %d\n", i + 1, repeat); fflush(stdout); | ||
double dStartTime = bli_clock(); | ||
|
||
bli_gemm(alpha, a, b, beta, c); | ||
|
||
// Always look at best of N for timing! | ||
dBestTime = bli_clock_min_diff( dBestTime, dStartTime ); | ||
} | ||
|
||
double gflops = ( 2.0 * size * size * size ) / ( dBestTime * 1.0e9 ); | ||
|
||
printf("Best DGEMM run completed in %g seconds @ size= \t %ld \t %g \t gigaflops\n", | ||
dBestTime, size, gflops); fflush(stdout); | ||
|
||
return true; | ||
} | ||
|
||
|
||
int main( int argc, char** argv ) | ||
{ | ||
long size = 0; | ||
int cores = 1, sweep_inc = 0; | ||
|
||
printf("Details of parallelism are set by environment variables.\n"); | ||
printf("Arg1 = size=M=N=K for DGEMM\n" | ||
"optional arg2 = size step for sweep.\n"); | ||
|
||
if (argc < 2) return 0; | ||
|
||
if (argc > 1) { | ||
size = atol(argv[1]); | ||
printf("User set size to %ld\n", size); | ||
} | ||
|
||
if (argc > 2) { | ||
sweep_inc = atoi(argv[3]); | ||
printf("User set sweep size inc to %d\n", sweep_inc); | ||
} | ||
|
||
if (sweep_inc == 0) TimeBlis(size); | ||
else | ||
{ | ||
for (int i = size; i >= sweep_inc; i -= sweep_inc) | ||
TimeBlis(i); | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
echo "#######################################################" | ||
echo "Building standard OpenMP BLIS..." | ||
echo "#######################################################" | ||
. ./blis_setenv.sh quiet | ||
echo "##########################################################" | ||
echo "Configuring BLIS for Altra using OpenMP for parallelism..." | ||
echo "##########################################################" | ||
. ./blis_configure_altra.sh quiet | ||
echo "Switching to directory $BLIS_HOME" | ||
pushd $BLIS_HOME > /dev/null | ||
make -j | ||
popd > /dev/null | ||
if [ "$1" != "notest" ]; then | ||
. ./blis_test.sh quiet | ||
fi | ||
. ./blis_setenv.sh | ||
echo "##########################################################" | ||
echo "...done" | ||
echo "##########################################################" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
echo "#######################################################" | ||
echo "Building pThreads version of BLIS..." | ||
echo "#######################################################" | ||
. ./blis_setenv.sh quiet | ||
echo "##########################################################" | ||
echo "Configuring BLIS for Altra using pThreads for parallelism..." | ||
echo "##########################################################" | ||
. ./blis_configure_altra_pthreads.sh quiet | ||
echo "Switching to directory $BLIS_HOME" | ||
pushd $BLIS_HOME > /dev/null | ||
make -j | ||
popd > /dev/null | ||
if [ "$1" != "notest" ]; then | ||
. ./blis_test.sh quiet | ||
fi | ||
. ./blis_setenv.sh | ||
echo "##########################################################" | ||
echo "...done" | ||
echo "##########################################################" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/bash | ||
echo "##########################################################" | ||
echo "Creating both OpenMP and pThread BLIS libraries..." | ||
echo "##########################################################" | ||
echo "First, Creating pThread library..." | ||
echo "##########################################################" | ||
. ./blis_build_altra_pthreads.sh notest | ||
|
||
echo "##########################################################" | ||
echo "Saving the pThreads build..." | ||
echo "##########################################################" | ||
# Temporarily move the pthreads build | ||
mkdir $BLIS_HOME/.tempinc | ||
mkdir $BLIS_HOME/.templib | ||
mv $BLIS_INC/* $BLIS_HOME/.tempinc/ | ||
mv $BLIS_LIB/* $BLIS_HOME/.templib/ | ||
# And rename the pthread versions of the include and library files | ||
#echo "##########################################################" | ||
pushd $BLIS_HOME/.tempinc/ > /dev/null | ||
echo "Renaming pThread-enabled blis.h -> blisP.h" | ||
mv blis.h blisP.h | ||
popd > /dev/null | ||
pushd $BLIS_HOME/.templib/ > /dev/null | ||
for f in $(ls -1); do | ||
destf=${f/blis/blisP} | ||
echo "Renaming pThread library $f -> $destf" | ||
mv "$f" "$destf" | ||
|
||
# Fix the symbolic links | ||
if [[ -L "$destf" ]]; then | ||
target=$(readlink $destf) | ||
target=${target/blis/blisP} | ||
\rm "$destf" | ||
ln -s "$target" "$destf" | ||
fi | ||
done | ||
popd > /dev/null | ||
echo "##########################################################" | ||
|
||
echo "##########################################################" | ||
echo "Second, Creating OpenMP library..." | ||
echo "##########################################################" | ||
. ./blis_build_altra.sh notest | ||
|
||
echo "##########################################################" | ||
echo "Restoring the pThreads build..." | ||
echo "##########################################################" | ||
# And move the pthread versions back | ||
mv $BLIS_HOME/.tempinc/* $BLIS_INC/ | ||
mv $BLIS_HOME/.templib/* $BLIS_LIB/ | ||
rmdir $BLIS_HOME/.tempinc | ||
rmdir $BLIS_HOME/.templib | ||
|
||
. ./blis_test.sh quiet | ||
. ./blis_setenv.sh | ||
echo "##########################################################" | ||
echo "Done creating BLIS libraries..." | ||
echo "##########################################################" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
if [ "$1" = "quiet" ]; then | ||
quiet_confopenmp="quiet" | ||
else | ||
quiet_confopenmp="" | ||
fi | ||
|
||
if [ "$quiet_confopenmp" = "" ]; then | ||
echo "##########################################################" | ||
echo "Configuring BLIS for Altra using OpenMP for parallelism..." | ||
echo "##########################################################" | ||
fi | ||
|
||
. ./blis_setenv.sh $quiet_confopenmp | ||
pushd $BLIS_HOME > /dev/null | ||
make distclean | ||
./configure -t openmp --disable-pba-pools altra | ||
popd > /dev/null | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
if [ "$1" = "quiet" ]; then | ||
quiet_confpthreads="quiet" | ||
else | ||
quiet_confpthreads="" | ||
fi | ||
|
||
if [ "$quiet_confpthreads" = "" ]; then | ||
echo "##########################################################" | ||
echo "Configuring BLIS for Altra using pThreads for parallelism..." | ||
echo "##########################################################" | ||
fi | ||
|
||
. ./blis_setenv.sh $quiet_confpthreads | ||
pushd $BLIS_HOME > /dev/null | ||
make distclean | ||
./configure -t pthreads --disable-pba-pools altra | ||
popd > /dev/null | ||
|
Oops, something went wrong.