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