c34203
From 14e717c4367c04570863220c3faf5ce41dabbf05 Mon Sep 17 00:00:00 2001
c34203
From: Andreas Arnez <arnez@linux.ibm.com>
c34203
Date: Wed, 29 May 2019 17:51:34 +0200
c34203
Subject: [PATCH 7/8] Enable "cross-compile"
c34203
c34203
This adds support for building ATLAS without running any target code.  In
c34203
order for this to work, the archdefs must contain some additional files
c34203
that would otherwise be built during various tuning steps; see the new
c34203
targets extra_get and extra_put in "CONFIG/ARCHS/Makefile".
c34203
c34203
Even if the archdefs contain these additional files, cross compilation
c34203
is *not* automatically enabled.  To activate it and disable tuning at
c34203
build time, add the option "-Si archdef 2" when running "configure".
c34203
---
c34203
 CONFIG/ARCHS/Makefile | 24 ++++++++++++++++++++++++
c34203
 bin/atlas_install.c   |  2 ++
c34203
 makes/Make.aux        | 10 +++++-----
c34203
 makes/Make.bin        | 22 ++++++++++++++++++++++
c34203
 makes/Make.l3tune     |  6 ++++++
c34203
 makes/Make.sysinfo    |  8 +++++++-
c34203
 6 files changed, 66 insertions(+), 6 deletions(-)
c34203
c34203
diff --git a/CONFIG/ARCHS/Makefile b/CONFIG/ARCHS/Makefile
c34203
index 321e05c..e61b5a0 100644
c34203
--- a/CONFIG/ARCHS/Makefile
c34203
+++ b/CONFIG/ARCHS/Makefile
c34203
@@ -211,3 +211,27 @@ ArchNew : $(mach) xnegflt
c34203
 	- cp $(BLDdir)/bin/INSTALL_LOG/?PerfSumm.txt $(adefd)/.
c34203
 	rm -f xnegflt
c34203
 archput : sys_put kern_put gemm_put la_put
c34203
+
c34203
+ifdef ATL_NOTUNE
c34203
+
c34203
+# To avoid tuning, some extra files are needed.
c34203
+
c34203
+extra_get :
c34203
+	- cp $(INCAdir)/atlas_type.h $(adefd)/kern/
c34203
+	- cp $(INCAdir)/atlas_[sdcz]sysinfo.h $(adefd)/kern/
c34203
+	- cp $(INCAdir)/atlas_[sd]lamch.h $(adefd)/kern/
c34203
+	- cp $(INCAdir)/atlas_[sdcz]trsmXover.h $(adefd)/kern/
c34203
+	- cp $(INCAdir)/atlas_[sdcz]syr*NX.h $(adefd)/kern/
c34203
+
c34203
+extra_put :
c34203
+	- cp $(adefd)/kern/atlas_type.h $(INCAdir)/.
c34203
+	- cp $(adefd)/kern/atlas_[sdcz]sysinfo.h $(INCAdir)/.
c34203
+	- cp $(adefd)/kern/atlas_[sd]lamch.h $(INCAdir)/.
c34203
+	- cp $(adefd)/kern/atlas_[sdcz]trsmXover.h $(INCAdir)/.
c34203
+	- cp $(adefd)/kern/atlas_[sdcz]syr*NX.h  $(INCAdir)/.
c34203
+
c34203
+ArchNew : extra_get
c34203
+
c34203
+archput : extra_put
c34203
+
c34203
+endif
c34203
diff --git a/bin/atlas_install.c b/bin/atlas_install.c
c34203
index de3eb3a..3c811e6 100644
c34203
--- a/bin/atlas_install.c
c34203
+++ b/bin/atlas_install.c
c34203
@@ -697,6 +697,8 @@ void GoToTown(int ARCHDEF, int L1DEF, int TuneLA)
c34203
       ATL_Cassert(system("make IBozoL1.grd\n")==0,
c34203
                   "USING BOZO L1 DEFAULTS", NULL);
c34203
    }
c34203
+   if (ARCHDEF >= 2)
c34203
+      setenv("ATL_NOTUNE", "1", 1);
c34203
    if (ARCHDEF)
c34203
       DefInstall = !system("make IArchDef.grd\n");
c34203
 
c34203
diff --git a/makes/Make.aux b/makes/Make.aux
c34203
index 1f769c8..c793028 100644
c34203
--- a/makes/Make.aux
c34203
+++ b/makes/Make.aux
c34203
@@ -113,23 +113,23 @@ clean :
c34203
 
c34203
 $(ATLFWAIT) :
c34203
 	cd $(BINdir) ; $(MAKE) xatlas_waitfile
c34203
-$(INCAdir)/atlas_type.h : $(ATLFWAIT)
c34203
+$(INCAdir)/atlas_type.h : | $(ATLFWAIT)
c34203
 	cd $(SYSdir) ; $(MAKE) $(INCAdir)/atlas_type.h
c34203
 	$(ATLFWAIT) -f $(INCAdir)/atlas_type.h
c34203
 sINCdep = $(INCAdir)/atlas_ssysinfo.h $(INCAdir)/atlas_type.h 
c34203
-$(INCAdir)/atlas_ssysinfo.h : $(ATLFWAIT)
c34203
+$(INCAdir)/atlas_ssysinfo.h : | $(ATLFWAIT)
c34203
 	cd $(SYSdir) ; $(MAKE) $(INCAdir)/atlas_ssysinfo.h
c34203
 	$(ATLFWAIT) -f $(INCAdir)/atlas_ssysinfo.h
c34203
 dINCdep = $(INCAdir)/atlas_dsysinfo.h $(INCAdir)/atlas_type.h 
c34203
-$(INCAdir)/atlas_dsysinfo.h : $(ATLFWAIT)
c34203
+$(INCAdir)/atlas_dsysinfo.h : | $(ATLFWAIT)
c34203
 	cd $(SYSdir) ; $(MAKE) $(INCAdir)/atlas_dsysinfo.h
c34203
 	$(ATLFWAIT) -f $(INCAdir)/atlas_dsysinfo.h
c34203
 cINCdep = $(INCAdir)/atlas_csysinfo.h $(INCAdir)/atlas_type.h 
c34203
-$(INCAdir)/atlas_csysinfo.h : $(ATLFWAIT)
c34203
+$(INCAdir)/atlas_csysinfo.h : | $(ATLFWAIT)
c34203
 	cd $(SYSdir) ; $(MAKE) $(INCAdir)/atlas_csysinfo.h
c34203
 	$(ATLFWAIT) -f $(INCAdir)/atlas_csysinfo.h
c34203
 zINCdep = $(INCAdir)/atlas_zsysinfo.h $(INCAdir)/atlas_type.h 
c34203
-$(INCAdir)/atlas_zsysinfo.h : $(ATLFWAIT)
c34203
+$(INCAdir)/atlas_zsysinfo.h : | $(ATLFWAIT)
c34203
 	cd $(SYSdir) ; $(MAKE) $(INCAdir)/atlas_zsysinfo.h
c34203
 	$(ATLFWAIT) -f $(INCAdir)/atlas_zsysinfo.h
c34203
 
c34203
diff --git a/makes/Make.bin b/makes/Make.bin
c34203
index 1035cb9..acad578 100644
c34203
--- a/makes/Make.bin
c34203
+++ b/makes/Make.bin
c34203
@@ -163,7 +163,9 @@ IRunMADef :
c34203
 	cd $(SYSdir) ; $(MAKE) RunMADef pre=$(pre)
c34203
 
c34203
 IRunMMDef :
c34203
+ifndef ATL_NOTUNE
c34203
 	cd $(MMTdir) ; $(MAKE) RunMMDef pre=$(pre)
c34203
+endif
c34203
 	cd $(MMTdir) ; ./xemit_mm  -p $(pre) -R -2
c34203
 	cd $(MMTdir) ; $(MAKE) install pre=$(pre)
c34203
 IKillL1 : force_build
c34203
@@ -303,22 +305,42 @@ INSTALL_LOG/$(pre)bestTT_$(nb)x$(nb)x$(nb) : \
c34203
 	cp $(MMTdir)/res/$(pre)bestTT_$(nb)x$(nb)x$(nb) INSTALL_LOG/.
c34203
 
c34203
 $(R1Tdir)/res/$(pre)R2K.sum : $(R1Tdir)/res/$(pre)R1K.sum force_build
c34203
+ifdef ATL_NOTUNE
c34203
+	cd $(R1Tdir) ; $(MAKE) $(pre)r2install
c34203
+else
c34203
 	cd $(R1Tdir) ; $(MAKE) res/$(pre)R2K.sum pre=$(pre)
c34203
+endif
c34203
 $(R1Tdir)/res/$(pre)R1K.sum : force_build
c34203
+ifdef ATL_NOTUNE
c34203
+	cd $(R1Tdir) ; $(MAKE) $(pre)r1install
c34203
+else
c34203
 	cd $(R1Tdir) ; $(MAKE) res/$(pre)R1K.sum pre=$(pre)
c34203
+endif
c34203
 INSTALL_LOG/$(pre)R1K.sum : $(R1Tdir)/res/$(pre)R1K.sum
c34203
 	cp $(R1Tdir)/res/$(pre)R1K.sum INSTALL_LOG/.
c34203
 INSTALL_LOG/$(pre)R2K.sum : INSTALL_LOG/$(pre)R1K.sum \
c34203
    $(R1Tdir)/res/$(pre)R2K.sum
c34203
 	cp $(R1Tdir)/res/$(pre)R2K.sum INSTALL_LOG/.
c34203
+ifndef ATL_NOTUNE
c34203
 	cd $(R1Tdir) ; $(MAKE) $(pre)nxtune
c34203
+else
c34203
+	cd $(BLDdir)/src/blas/reference/level2 ; make $(pre)lib
c34203
+endif
c34203
 
c34203
 $(MVTdir)/res/$(pre)MVNK.sum : force_build
c34203
+ifdef ATL_NOTUNE
c34203
+	cd $(MVTdir) ; $(MAKE) $(pre)mvninstall
c34203
+else
c34203
 	cd $(MVTdir) ; $(MAKE) res/$(pre)MVNK.sum pre=$(pre)
c34203
+endif
c34203
 INSTALL_LOG/$(pre)MVNK.sum : $(MVTdir)/res/$(pre)MVNK.sum
c34203
 	cp $(MVTdir)/res/$(pre)MVNK.sum INSTALL_LOG/.
c34203
 $(MVTdir)/res/$(pre)MVTK.sum : force_build
c34203
+ifdef ATL_NOTUNE
c34203
+	cd $(MVTdir) ; $(MAKE) $(pre)mvtinstall
c34203
+else
c34203
 	cd $(MVTdir) ; $(MAKE) res/$(pre)MVTK.sum pre=$(pre)
c34203
+endif
c34203
 INSTALL_LOG/$(pre)MVTK.sum : $(MVTdir)/res/$(pre)MVTK.sum
c34203
 	cp $(MVTdir)/res/$(pre)MVTK.sum INSTALL_LOG/.
c34203
 
c34203
diff --git a/makes/Make.l3tune b/makes/Make.l3tune
c34203
index eaf7d7d..cd7f5f1 100644
c34203
--- a/makes/Make.l3tune
c34203
+++ b/makes/Make.l3tune
c34203
@@ -118,6 +118,7 @@ res/atlas_strsmXover.h :
c34203
 	cp $(strsmXover) res/.
c34203
 
c34203
 stsmfc :
c34203
+ifndef ATL_NOTUNE
c34203
 	rm -f $(strsmXover)
c34203
 	cd $(L3Bdir) ; $(MAKE) slib
c34203
 	$(MAKE) xstsmfc2 pre=s typ=SREAL side=$(side) uplo=Upper_ \
c34203
@@ -128,6 +129,7 @@ stsmfc :
c34203
                 tran=NoTranspose_ diag=$(diag)
c34203
 	$(MAKE) xstsmfc2 pre=s typ=SREAL side=$(side) uplo=Lower_ \
c34203
                 tran=Transpose_ diag=$(diag)
c34203
+endif
c34203
 	cd $(L3Bdir) ; $(MAKE) slib
c34203
 dtrsmXover = $(INCAdir)/atlas_dtrsmXover.h
c34203
 
c34203
@@ -138,6 +140,7 @@ res/atlas_dtrsmXover.h :
c34203
 	cp $(dtrsmXover) res/.
c34203
 
c34203
 dtsmfc :
c34203
+ifndef ATL_NOTUNE
c34203
 	rm -f $(dtrsmXover)
c34203
 	cd $(L3Bdir) ; $(MAKE) dlib
c34203
 	$(MAKE) xdtsmfc2 pre=d typ=DREAL side=$(side) uplo=Upper_ \
c34203
@@ -148,6 +151,7 @@ dtsmfc :
c34203
                 tran=NoTranspose_ diag=$(diag)
c34203
 	$(MAKE) xdtsmfc2 pre=d typ=DREAL side=$(side) uplo=Lower_ \
c34203
                 tran=Transpose_ diag=$(diag)
c34203
+endif
c34203
 	cd $(L3Bdir) ; $(MAKE) dlib
c34203
 qtrsmXover = $(INCAdir)/atlas_qtrsmXover.h
c34203
 
c34203
@@ -158,6 +162,7 @@ res/atlas_qtrsmXover.h :
c34203
 	cp $(qtrsmXover) res/.
c34203
 
c34203
 qtsmfc :
c34203
+ifndef ATL_NOTUNE
c34203
 	rm -f $(qtrsmXover)
c34203
 	cd $(L3Bdir) ; $(MAKE) qlib
c34203
 	$(MAKE) xqtsmfc2 pre=q typ=QREAL side=$(side) uplo=Upper_ \
c34203
@@ -168,6 +173,7 @@ qtsmfc :
c34203
                 tran=NoTranspose_ diag=$(diag)
c34203
 	$(MAKE) xqtsmfc2 pre=q typ=QREAL side=$(side) uplo=Lower_ \
c34203
                 tran=Transpose_ diag=$(diag)
c34203
+endif
c34203
 	cd $(L3Bdir) ; $(MAKE) qlib
c34203
 
c34203
 $(pre)tsmfc.o : force_build
c34203
diff --git a/makes/Make.sysinfo b/makes/Make.sysinfo
c34203
index 2b7dfdc..8e5dab2 100644
c34203
--- a/makes/Make.sysinfo
c34203
+++ b/makes/Make.sysinfo
c34203
@@ -5,6 +5,7 @@ maxlat=6
c34203
 mflop=200
c34203
 flags=
c34203
 
c34203
+ifndef ATL_NOTUNE
c34203
 sTestFlags : force_build
c34203
 	$(MAKE) srbob `cat res/sBEST` pre='s' type=float
c34203
 
c34203
@@ -85,12 +86,14 @@ RunLamch : xemit_lamch
c34203
 	cp res/atlas_?lamch.h $(INCAdir)/.
c34203
 RunTyp: xemit_typ
c34203
 	$(ATLRUN) $(SYSdir) xemit_typ > $(INCAdir)/atlas_type.h
c34203
+endif
c34203
 
c34203
 xemit_buildinfo : emit_buildinfo.o
c34203
 	$(XCC) $(XCCFLAGS) -o $@ emit_buildinfo.o
c34203
 xsyssum : GetSysSum.o
c34203
 	$(XCC) $(XCCFLAGS) -o $@ GetSysSum.o
c34203
 
c34203
+ifndef ATL_NOTUNE
c34203
 xL1 : time.o L1CacheSize.o
c34203
 	$(KC) $(KCFLAGS) -o $@ L1CacheSize.o time.o
c34203
 
c34203
@@ -125,6 +128,7 @@ smatime.o : $(mySRCdir)/matime.c
c34203
 	$(KC) -c $(KCFLAGS) -DSREAL $(mySRCdir)/matime.c
c34203
 xmasrch : $(mySRCdir)/masrch.c
c34203
 	$(XCC) $(XCCFLAGS) -o $@ $(mySRCdir)/masrch.c
c34203
+endif
c34203
 
c34203
 ATL_cputime.c : 
c34203
 	cp $(mySRCdir)/ATL_cputime.c .
c34203
@@ -143,6 +147,8 @@ emit_buildinfo.o : $(mySRCdir)/emit_buildinfo.c
c34203
 	$(XCC) -c $(XCCFLAGS) $(mySRCdir)/emit_buildinfo.c
c34203
 GetSysSum.o : $(INCAdir)/atlas_type.h $(mySRCdir)/GetSysSum.c
c34203
 	$(XCC) -c $(XCCFLAGS) $(mySRCdir)/GetSysSum.c
c34203
+
c34203
+ifndef ATL_NOTUNE
c34203
 time.o : $(mySRCdir)/time.c
c34203
 	$(KC) -c $(KCFLAGS) -I./ $(mySRCdir)/time.c
c34203
 emit_lamch.o : $(mySRCdir)/emit_lamch.c
c34203
@@ -155,7 +161,7 @@ findNT.o : $(mySRCdir)/findNT.c
c34203
 	$(KC) -c $(KCFLAGS) $(mySRCdir)/findNT.c
c34203
 tlb.o : $(mySRCdir)/tlb.c
c34203
 	$(KC) -c $(KCFLAGS) $(mySRCdir)/tlb.c
c34203
-
c34203
+endif
c34203
 
c34203
 
c34203
 force_build :
c34203
-- 
c34203
2.23.0
c34203