From a35a1a9ae7e03e7c2f64347cd8134575dc9636b7 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Wed, 7 May 2014 11:33:02 +0200 Subject: [PATCH 01/70] changed makefiles for lapack development --- Makefile.system | 1 + driver/others/Makefile | 2 +- lapack-netlib/SRC/Makefile | 78 ++++++++++++++++++-------------------- lapack/Makefile | 3 +- make.inc | 6 +-- 5 files changed, 43 insertions(+), 47 deletions(-) diff --git a/Makefile.system b/Makefile.system index 7ba45f2e1..bbd7e5621 100644 --- a/Makefile.system +++ b/Makefile.system @@ -158,6 +158,7 @@ endif ifeq ($(OSNAME), Linux) EXTRALIB += -lm +NO_EXPRECISION = 1 endif ifeq ($(OSNAME), AIX) diff --git a/driver/others/Makefile b/driver/others/Makefile index d7a965c9a..ca05c5129 100644 --- a/driver/others/Makefile +++ b/driver/others/Makefile @@ -3,7 +3,7 @@ include ../../Makefile.system COMMONOBJS = memory.$(SUFFIX) xerbla.$(SUFFIX) c_abs.$(SUFFIX) z_abs.$(SUFFIX) openblas_set_num_threads.$(SUFFIX) openblas_get_config.$(SUFFIX) openblas_get_parallel.$(SUFFIX) openblas_error_handle.$(SUFFIX) -COMMONOBJS += slamch.$(SUFFIX) slamc3.$(SUFFIX) dlamch.$(SUFFIX) dlamc3.$(SUFFIX) +#COMMONOBJS += slamch.$(SUFFIX) slamc3.$(SUFFIX) dlamch.$(SUFFIX) dlamc3.$(SUFFIX) ifdef SMP COMMONOBJS += blas_server.$(SUFFIX) divtable.$(SUFFIX) blasL1thread.$(SUFFIX) diff --git a/lapack-netlib/SRC/Makefile b/lapack-netlib/SRC/Makefile index 85154280f..46a3f7881 100644 --- a/lapack-netlib/SRC/Makefile +++ b/lapack-netlib/SRC/Makefile @@ -54,9 +54,9 @@ include ../make.inc # ####################################################################### -ALLAUX = ilaenv.o ieeeck.o lsamen.o xerbla_array.o iparmq.o \ +ALLAUX = ilaenv.o ieeeck.o lsamen.o xerbla.o xerbla_array.o iparmq.o \ ilaprec.o ilatrans.o ilauplo.o iladiag.o chla_transtype.o \ - ../INSTALL/ilaver.o + ../INSTALL/ilaver.o ../INSTALL/lsame.o ../INSTALL/slamch.o SCLAUX = \ sbdsdc.o \ @@ -92,7 +92,7 @@ DZLAUX = \ dlasr.o dlasrt.o dlassq.o dlasv2.o dpttrf.o dstebz.o dstedc.o \ dsteqr.o dsterf.o dlaisnan.o disnan.o \ dlartgp.o dlartgs.o \ - ../INSTALL/dsecnd_$(TIMER).o + ../INSTALL/dlamch.o ../INSTALL/dsecnd_$(TIMER).o SLASRC = \ sgbbrd.o sgbcon.o sgbequ.o sgbrfs.o sgbsv.o \ @@ -102,7 +102,7 @@ SLASRC = \ sgels.o sgelsd.o sgelss.o sgelsx.o sgelsy.o sgeql2.o sgeqlf.o \ sgeqp3.o sgeqpf.o sgeqr2.o sgeqr2p.o sgeqrf.o sgeqrfp.o sgerfs.o \ sgerq2.o sgerqf.o sgesc2.o sgesdd.o sgesv.o sgesvd.o sgesvx.o \ - sgetc2.o sgetri.o \ + sgetc2.o sgetf2.o sgetri.o \ sggbak.o sggbal.o sgges.o sggesx.o sggev.o sggevx.o \ sggglm.o sgghrd.o sgglse.o sggqrf.o \ sggrqf.o sggsvd.o sggsvp.o sgtcon.o sgtrfs.o sgtsv.o \ @@ -118,16 +118,16 @@ SLASRC = \ slaqtr.o slar1v.o slar2v.o ilaslr.o ilaslc.o \ slarf.o slarfb.o slarfg.o slarfgp.o slarft.o slarfx.o slargv.o \ slarrv.o slartv.o \ - slarz.o slarzb.o slarzt.o slasy2.o slasyf.o slasyf_rook.o \ + slarz.o slarzb.o slarzt.o slaswp.o slasy2.o slasyf.o slasyf_rook.o \ slatbs.o slatdf.o slatps.o slatrd.o slatrs.o slatrz.o slatzm.o \ - sopgtr.o sopmtr.o sorg2l.o sorg2r.o \ + slauu2.o slauum.o sopgtr.o sopmtr.o sorg2l.o sorg2r.o \ sorgbr.o sorghr.o sorgl2.o sorglq.o sorgql.o sorgqr.o sorgr2.o \ sorgrq.o sorgtr.o sorm2l.o sorm2r.o \ sormbr.o sormhr.o sorml2.o sormlq.o sormql.o sormqr.o sormr2.o \ sormr3.o sormrq.o sormrz.o sormtr.o spbcon.o spbequ.o spbrfs.o \ spbstf.o spbsv.o spbsvx.o \ spbtf2.o spbtrf.o spbtrs.o spocon.o spoequ.o sporfs.o sposv.o \ - sposvx.o spotri.o spstrf.o spstf2.o \ + sposvx.o spotf2.o spotri.o spstrf.o spstf2.o \ sppcon.o sppequ.o \ spprfs.o sppsv.o sppsvx.o spptrf.o spptri.o spptrs.o sptcon.o \ spteqr.o sptrfs.o sptsv.o sptsvx.o spttrs.o sptts2.o srscl.o \ @@ -147,7 +147,7 @@ SLASRC = \ stgsja.o stgsna.o stgsy2.o stgsyl.o stpcon.o stprfs.o stptri.o \ stptrs.o \ strcon.o strevc.o strexc.o strrfs.o strsen.o strsna.o strsyl.o \ - strtrs.o stzrqf.o stzrzf.o sstemr.o \ + strti2.o strtri.o strtrs.o stzrqf.o stzrzf.o sstemr.o \ slansf.o spftrf.o spftri.o spftrs.o ssfrk.o stfsm.o stftri.o stfttp.o \ stfttr.o stpttf.o stpttr.o strttf.o strttp.o \ sgejsv.o sgesvj.o sgsvj0.o sgsvj1.o \ @@ -157,7 +157,7 @@ SLASRC = \ sgeqrt.o sgeqrt2.o sgeqrt3.o sgemqrt.o \ stpqrt.o stpqrt2.o stpmqrt.o stprfb.o -DSLASRC = spotrs.o +DSLASRC = spotrs.o sgetrs.o spotrf.o sgetrf.o ifdef USEXBLAS SXLASRC = sgesvxx.o sgerfsx.o sla_gerfsx_extended.o sla_geamv.o \ @@ -177,7 +177,7 @@ CLASRC = \ cgels.o cgelsd.o cgelss.o cgelsx.o cgelsy.o cgeql2.o cgeqlf.o cgeqp3.o \ cgeqpf.o cgeqr2.o cgeqr2p.o cgeqrf.o cgeqrfp.o cgerfs.o \ cgerq2.o cgerqf.o cgesc2.o cgesdd.o cgesv.o cgesvd.o \ - cgesvx.o cgetc2.o cgetri.o \ + cgesvx.o cgetc2.o cgetf2.o cgetri.o \ cggbak.o cggbal.o cgges.o cggesx.o cggev.o cggevx.o cggglm.o \ cgghrd.o cgglse.o cggqrf.o cggrqf.o \ cggsvd.o cggsvp.o \ @@ -207,10 +207,10 @@ CLASRC = \ clarf.o clarfb.o clarfg.o clarft.o clarfgp.o \ clarfx.o clargv.o clarnv.o clarrv.o clartg.o clartv.o \ clarz.o clarzb.o clarzt.o clascl.o claset.o clasr.o classq.o \ - clasyf.o clasyf_rook.o clatbs.o clatdf.o clatps.o clatrd.o clatrs.o clatrz.o \ - clatzm.o cpbcon.o cpbequ.o cpbrfs.o cpbstf.o cpbsv.o \ + claswp.o clasyf.o clasyf_rook.o clatbs.o clatdf.o clatps.o clatrd.o clatrs.o clatrz.o \ + clatzm.o clauu2.o clauum.o cpbcon.o cpbequ.o cpbrfs.o cpbstf.o cpbsv.o \ cpbsvx.o cpbtf2.o cpbtrf.o cpbtrs.o cpocon.o cpoequ.o cporfs.o \ - cposv.o cposvx.o cpotri.o cpstrf.o cpstf2.o \ + cposv.o cposvx.o cpotf2.o cpotri.o cpstrf.o cpstf2.o \ cppcon.o cppequ.o cpprfs.o cppsv.o cppsvx.o cpptrf.o cpptri.o cpptrs.o \ cptcon.o cpteqr.o cptrfs.o cptsv.o cptsvx.o cpttrf.o cpttrs.o cptts2.o \ crot.o cspcon.o cspmv.o cspr.o csprfs.o cspsv.o \ @@ -225,7 +225,7 @@ CLASRC = \ ctgexc.o ctgsen.o ctgsja.o ctgsna.o ctgsy2.o ctgsyl.o ctpcon.o \ ctprfs.o ctptri.o \ ctptrs.o ctrcon.o ctrevc.o ctrexc.o ctrrfs.o ctrsen.o ctrsna.o \ - ctrsyl.o ctrtrs.o ctzrqf.o ctzrzf.o cung2l.o cung2r.o \ + ctrsyl.o ctrti2.o ctrtri.o ctrtrs.o ctzrqf.o ctzrzf.o cung2l.o cung2r.o \ cungbr.o cunghr.o cungl2.o cunglq.o cungql.o cungqr.o cungr2.o \ cungrq.o cungtr.o cunm2l.o cunm2r.o cunmbr.o cunmhr.o cunml2.o \ cunmlq.o cunmql.o cunmqr.o cunmr2.o cunmr3.o cunmrq.o cunmrz.o \ @@ -252,7 +252,7 @@ CXLASRC = cgesvxx.o cgerfsx.o cla_gerfsx_extended.o cla_geamv.o \ cla_lin_berr.o clarscl2.o clascl2.o cla_wwaddw.o endif -ZCLASRC = cpotrs.o +ZCLASRC = cpotrs.o cgetrs.o cpotrf.o cgetrf.o DLASRC = \ dgbbrd.o dgbcon.o dgbequ.o dgbrfs.o dgbsv.o \ @@ -262,8 +262,8 @@ DLASRC = \ dgels.o dgelsd.o dgelss.o dgelsx.o dgelsy.o dgeql2.o dgeqlf.o \ dgeqp3.o dgeqpf.o dgeqr2.o dgeqr2p.o dgeqrf.o dgeqrfp.o dgerfs.o \ dgerq2.o dgerqf.o dgesc2.o dgesdd.o dgesv.o dgesvd.o dgesvx.o \ - dgetc2.o dgetri.o \ - dggbak.o dggbal.o dgges.o dggesx.o dggev.o dggevx.o \ + dgetc2.o dgetf2.o dgetrf.o dgetri.o \ + dgetrs.o dggbak.o dggbal.o dgges.o dggesx.o dggev.o dggevx.o \ dggglm.o dgghrd.o dgglse.o dggqrf.o \ dggrqf.o dggsvd.o dggsvp.o dgtcon.o dgtrfs.o dgtsv.o \ dgtsvx.o dgttrf.o dgttrs.o dgtts2.o dhgeqz.o \ @@ -278,16 +278,16 @@ DLASRC = \ dlaqtr.o dlar1v.o dlar2v.o iladlr.o iladlc.o \ dlarf.o dlarfb.o dlarfg.o dlarfgp.o dlarft.o dlarfx.o \ dlargv.o dlarrv.o dlartv.o \ - dlarz.o dlarzb.o dlarzt.o dlasy2.o dlasyf.o dlasyf_rook.o \ - dlatbs.o dlatdf.o dlatps.o dlatrd.o dlatrs.o dlatrz.o dlatzm.o \ - dopgtr.o dopmtr.o dorg2l.o dorg2r.o \ + dlarz.o dlarzb.o dlarzt.o dlaswp.o dlasy2.o dlasyf.o dlasyf_rook.o \ + dlatbs.o dlatdf.o dlatps.o dlatrd.o dlatrs.o dlatrz.o dlatzm.o dlauu2.o \ + dlauum.o dopgtr.o dopmtr.o dorg2l.o dorg2r.o \ dorgbr.o dorghr.o dorgl2.o dorglq.o dorgql.o dorgqr.o dorgr2.o \ dorgrq.o dorgtr.o dorm2l.o dorm2r.o \ dormbr.o dormhr.o dorml2.o dormlq.o dormql.o dormqr.o dormr2.o \ dormr3.o dormrq.o dormrz.o dormtr.o dpbcon.o dpbequ.o dpbrfs.o \ dpbstf.o dpbsv.o dpbsvx.o \ dpbtf2.o dpbtrf.o dpbtrs.o dpocon.o dpoequ.o dporfs.o dposv.o \ - dposvx.o dpotri.o dpotrs.o dpstrf.o dpstf2.o \ + dposvx.o dpotf2.o dpotrf.o dpotri.o dpotrs.o dpstrf.o dpstf2.o \ dppcon.o dppequ.o \ dpprfs.o dppsv.o dppsvx.o dpptrf.o dpptri.o dpptrs.o dptcon.o \ dpteqr.o dptrfs.o dptsv.o dptsvx.o dpttrs.o dptts2.o drscl.o \ @@ -307,7 +307,7 @@ DLASRC = \ dtgsja.o dtgsna.o dtgsy2.o dtgsyl.o dtpcon.o dtprfs.o dtptri.o \ dtptrs.o \ dtrcon.o dtrevc.o dtrexc.o dtrrfs.o dtrsen.o dtrsna.o dtrsyl.o \ - dtrtrs.o dtzrqf.o dtzrzf.o dstemr.o \ + dtrti2.o dtrtri.o dtrtrs.o dtzrqf.o dtzrzf.o dstemr.o \ dsgesv.o dsposv.o dlag2s.o slag2d.o dlat2s.o \ dlansf.o dpftrf.o dpftri.o dpftrs.o dsfrk.o dtfsm.o dtftri.o dtfttp.o \ dtfttr.o dtpttf.o dtpttr.o dtrttf.o dtrttp.o \ @@ -335,8 +335,8 @@ ZLASRC = \ zgegs.o zgegv.o zgehd2.o zgehrd.o zgelq2.o zgelqf.o \ zgels.o zgelsd.o zgelss.o zgelsx.o zgelsy.o zgeql2.o zgeqlf.o zgeqp3.o \ zgeqpf.o zgeqr2.o zgeqr2p.o zgeqrf.o zgeqrfp.o zgerfs.o zgerq2.o zgerqf.o \ - zgesc2.o zgesdd.o zgesv.o zgesvd.o zgesvx.o zgetc2.o \ - zgetri.o \ + zgesc2.o zgesdd.o zgesv.o zgesvd.o zgesvx.o zgetc2.o zgetf2.o zgetrf.o \ + zgetri.o zgetrs.o \ zggbak.o zggbal.o zgges.o zggesx.o zggev.o zggevx.o zggglm.o \ zgghrd.o zgglse.o zggqrf.o zggrqf.o \ zggsvd.o zggsvp.o \ @@ -368,11 +368,11 @@ ZLASRC = \ zlarfg.o zlarft.o zlarfgp.o \ zlarfx.o zlargv.o zlarnv.o zlarrv.o zlartg.o zlartv.o \ zlarz.o zlarzb.o zlarzt.o zlascl.o zlaset.o zlasr.o \ - zlassq.o zlasyf.o zlasyf_rook.o \ + zlassq.o zlaswp.o zlasyf.o zlasyf_rook.o \ zlatbs.o zlatdf.o zlatps.o zlatrd.o zlatrs.o zlatrz.o zlatzm.o zlauu2.o \ - zpbcon.o zpbequ.o zpbrfs.o zpbstf.o zpbsv.o \ + zlauum.o zpbcon.o zpbequ.o zpbrfs.o zpbstf.o zpbsv.o \ zpbsvx.o zpbtf2.o zpbtrf.o zpbtrs.o zpocon.o zpoequ.o zporfs.o \ - zposv.o zposvx.o zpotri.o zpotrs.o zpstrf.o zpstf2.o \ + zposv.o zposvx.o zpotf2.o zpotrf.o zpotri.o zpotrs.o zpstrf.o zpstf2.o \ zppcon.o zppequ.o zpprfs.o zppsv.o zppsvx.o zpptrf.o zpptri.o zpptrs.o \ zptcon.o zpteqr.o zptrfs.o zptsv.o zptsvx.o zpttrf.o zpttrs.o zptts2.o \ zrot.o zspcon.o zspmv.o zspr.o zsprfs.o zspsv.o \ @@ -387,7 +387,7 @@ ZLASRC = \ ztgexc.o ztgsen.o ztgsja.o ztgsna.o ztgsy2.o ztgsyl.o ztpcon.o \ ztprfs.o ztptri.o \ ztptrs.o ztrcon.o ztrevc.o ztrexc.o ztrrfs.o ztrsen.o ztrsna.o \ - ztrsyl.o ztrtrs.o ztzrqf.o ztzrzf.o zung2l.o \ + ztrsyl.o ztrti2.o ztrtri.o ztrtrs.o ztzrqf.o ztzrzf.o zung2l.o \ zung2r.o zungbr.o zunghr.o zungl2.o zunglq.o zungql.o zungqr.o zungr2.o \ zungrq.o zungtr.o zunm2l.o zunm2r.o zunmbr.o zunmhr.o zunml2.o \ zunmlq.o zunmql.o zunmqr.o zunmr2.o zunmr3.o zunmrq.o zunmrz.o \ @@ -417,8 +417,6 @@ endif ALLOBJ = $(SLASRC) $(DLASRC) $(DSLASRC) $(CLASRC) $(ZLASRC) $(ZCLASRC) \ $(SCLAUX) $(DZLAUX) $(ALLAUX) -ALLOBJ_P = $(ALLOBJ:.o=.$(PSUFFIX)) - ifdef USEXBLAS ALLXOBJ = $(SXLASRC) $(DXLASRC) $(CXLASRC) $(ZXLASRC) endif @@ -435,6 +433,7 @@ lapacklib: $(ALLOBJ) $(ALLXOBJ) $(ARCH) $(ARCHFLAGS) $@ $(ALLOBJ_P) $(RANLIB) $@ + single: $(SLASRC) $(DSLASRC) $(SXLASRC) $(SCLAUX) $(ALLAUX) $(ARCH) $(ARCHFLAGS) ../$(LAPACKLIB) $(SLASRC) $(DSLASRC) \ $(SXLASRC) $(SCLAUX) $(ALLAUX) $(ALLXAUX) @@ -483,16 +482,11 @@ clean: %.$(PSUFFIX): %.f $(FORTRAN) $(POPTS) -c $< -o $@ -slaruv.o: slaruv.f ; $(FORTRAN) $(NOOPT) -O0 -c $< -o $@ -dlaruv.o: dlaruv.f ; $(FORTRAN) $(NOOPT) -O0 -c $< -o $@ -sla_wwaddw.o: sla_wwaddw.f ; $(FORTRAN) $(NOOPT) -O0 -c $< -o $@ -dla_wwaddw.o: dla_wwaddw.f ; $(FORTRAN) $(NOOPT) -O0 -c $< -o $@ -cla_wwaddw.o: cla_wwaddw.f ; $(FORTRAN) $(NOOPT) -O0 -c $< -o $@ -zla_wwaddw.o: zla_wwaddw.f ; $(FORTRAN) $(NOOPT) -O0 -c $< -o $@ -slaruv.$(PSUFFIX): slaruv.f ; $(FORTRAN) $(PNOOPT) -O0 -c $< -o $@ -dlaruv.$(PSUFFIX): dlaruv.f ; $(FORTRAN) $(PNOOPT) -O0 -c $< -o $@ -sla_wwaddw.$(PSUFFIX): sla_wwaddw.f ; $(FORTRAN) $(PNOOPT) -O0 -c $< -o $@ -dla_wwaddw.$(PSUFFIX): dla_wwaddw.f ; $(FORTRAN) $(PNOOPT) -O0 -c $< -o $@ -cla_wwaddw.$(PSUFFIX): cla_wwaddw.f ; $(FORTRAN) $(PNOOPT) -O0 -c $< -o $@ -zla_wwaddw.$(PSUFFIX): zla_wwaddw.f ; $(FORTRAN) $(PNOOPT) -O0 -c $< -o $@ +slaruv.o: slaruv.f ; $(FORTRAN) $(NOOPT) -c $< -o $@ +dlaruv.o: dlaruv.f ; $(FORTRAN) $(NOOPT) -c $< -o $@ +sla_wwaddw.o: sla_wwaddw.f ; $(FORTRAN) $(NOOPT) -c $< -o $@ +dla_wwaddw.o: dla_wwaddw.f ; $(FORTRAN) $(NOOPT) -c $< -o $@ +cla_wwaddw.o: cla_wwaddw.f ; $(FORTRAN) $(NOOPT) -c $< -o $@ +zla_wwaddw.o: zla_wwaddw.f ; $(FORTRAN) $(NOOPT) -c $< -o $@ + diff --git a/lapack/Makefile b/lapack/Makefile index 215badb74..dd203d222 100644 --- a/lapack/Makefile +++ b/lapack/Makefile @@ -1,7 +1,8 @@ TOPDIR = .. include ../Makefile.system -SUBDIRS = laswp getf2 getrf potf2 potrf lauu2 lauum trti2 trtri getrs +#SUBDIRS = laswp getf2 getrf potf2 potrf lauu2 lauum trti2 trtri getrs +SUBDIRS = FLAMEDIRS = laswp getf2 potf2 lauu2 trti2 diff --git a/make.inc b/make.inc index 01b9bde92..d3f91cbaa 100644 --- a/make.inc +++ b/make.inc @@ -5,7 +5,7 @@ LOADER = $(FORTRAN) TIMER = NONE ARCHFLAGS= -ru #RANLIB = ranlib -BLASLIB = +BLASLIB = ../../../libopenblas.a TMGLIB = tmglib.a -EIGSRCLIB = eigsrc.a -LINSRCLIB = linsrc.a +#EIGSRCLIB = eigsrc.a +#LINSRCLIB = linsrc.a From e673848a9be68e6eb620839d23696fda23f7287b Mon Sep 17 00:00:00 2001 From: wernsaar Date: Wed, 7 May 2014 14:36:49 +0200 Subject: [PATCH 02/70] added log file for lapack development --- lapack-devel.log | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lapack-devel.log diff --git a/lapack-devel.log b/lapack-devel.log new file mode 100644 index 000000000..8243bb890 --- /dev/null +++ b/lapack-devel.log @@ -0,0 +1,19 @@ +======================================================================================== +2014/05/07 Saar + +Platform: BULLDOZER single thread + + + --> LAPACK TESTING SUMMARY <-- + Processing LAPACK Testing output found in the TESTING direcory +SUMMARY nb test run numerical error other error +================ =========== ================= ================ +REAL 1079349 0 (0.000%) 0 (0.000%) +DOUBLE PRECISION 1080161 0 (0.000%) 0 (0.000%) +COMPLEX 556022 0 (0.000%) 0 (0.000%) +COMPLEX16 556834 0 (0.000%) 0 (0.000%) + +--> ALL PRECISIONS 3272366 0 (0.000%) 0 (0.000%) + +======================================================================================== + From 320c80590535e1448b9de70d24212fe1b6c0aad5 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Thu, 8 May 2014 11:06:32 +0200 Subject: [PATCH 03/70] fixed incorrect parameter 2 errors --- interface/syr2k.c | 15 ++++++++++++--- interface/syrk.c | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/interface/syr2k.c b/interface/syr2k.c index 01fbe648f..381e088a6 100644 --- a/interface/syr2k.c +++ b/interface/syr2k.c @@ -145,12 +145,21 @@ void NAME(char *UPLO, char *TRANS, if (uplo_arg == 'U') uplo = 0; if (uplo_arg == 'L') uplo = 1; +#ifndef COMPLEX if (trans_arg == 'N') trans = 0; -#ifndef HEMM if (trans_arg == 'T') trans = 1; - if (trans_arg == 'R') trans = 0; -#endif if (trans_arg == 'C') trans = 1; +#else +#ifdef HEMM + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'C') trans = 1; +#else + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'T') trans = 1; +#endif + +#endif + nrowa = args.n; if (trans & 1) nrowa = args.k; diff --git a/interface/syrk.c b/interface/syrk.c index b85e2c880..072cc86f5 100644 --- a/interface/syrk.c +++ b/interface/syrk.c @@ -148,12 +148,21 @@ void NAME(char *UPLO, char *TRANS, if (uplo_arg == 'U') uplo = 0; if (uplo_arg == 'L') uplo = 1; + +#ifndef COMPLEX if (trans_arg == 'N') trans = 0; -#ifndef HEMM if (trans_arg == 'T') trans = 1; - if (trans_arg == 'R') trans = 0; -#endif if (trans_arg == 'C') trans = 1; +#else +#ifdef HEMM + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'C') trans = 1; +#else + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'T') trans = 1; +#endif + +#endif nrowa = args.n; if (trans & 1) nrowa = args.k; From 6b252033ae7982eb797a7257e049c50842d062c2 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Fri, 9 May 2014 13:17:47 +0200 Subject: [PATCH 04/70] changed test ratio from 30.0 to 40.0 --- lapack-netlib/TESTING/ctest_rfp.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lapack-netlib/TESTING/ctest_rfp.in b/lapack-netlib/TESTING/ctest_rfp.in index d6988f2a7..8ffb27a32 100644 --- a/lapack-netlib/TESTING/ctest_rfp.in +++ b/lapack-netlib/TESTING/ctest_rfp.in @@ -5,5 +5,5 @@ Data file for testing COMPLEX LAPACK linear equation routines RFP format 1 2 15 Values of NRHS (number of right hand sides) 9 Number of matrix types (list types on next line if 0 < NTYPES < 9) 1 2 3 4 5 6 7 8 9 Matrix Types -30.0 Threshold value of test ratio +40.0 Threshold value of test ratio T Put T to test the error exits From 2424af62fde4a0257e38310ef38b7ad56cfa8507 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sat, 10 May 2014 10:52:37 +0200 Subject: [PATCH 05/70] replaced dgemm-kernel because bug in lapack --- kernel/x86_64/KERNEL.NEHALEM | 27 ++++++++++++++++----------- param.h | 4 ++-- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/kernel/x86_64/KERNEL.NEHALEM b/kernel/x86_64/KERNEL.NEHALEM index 1a1c7a2e0..878e3cdd8 100644 --- a/kernel/x86_64/KERNEL.NEHALEM +++ b/kernel/x86_64/KERNEL.NEHALEM @@ -7,15 +7,19 @@ SGEMMINCOPYOBJ = sgemm_incopy$(TSUFFIX).$(SUFFIX) SGEMMITCOPYOBJ = sgemm_itcopy$(TSUFFIX).$(SUFFIX) SGEMMONCOPYOBJ = sgemm_oncopy$(TSUFFIX).$(SUFFIX) SGEMMOTCOPYOBJ = sgemm_otcopy$(TSUFFIX).$(SUFFIX) -DGEMMKERNEL = gemm_kernel_2x8_nehalem.S -DGEMMINCOPY = dgemm_ncopy_2.S -DGEMMITCOPY = dgemm_tcopy_2.S -DGEMMONCOPY = ../generic/gemm_ncopy_8.c -DGEMMOTCOPY = dgemm_tcopy_8.S -DGEMMINCOPYOBJ = dgemm_incopy$(TSUFFIX).$(SUFFIX) -DGEMMITCOPYOBJ = dgemm_itcopy$(TSUFFIX).$(SUFFIX) + + +DGEMMKERNEL = gemm_kernel_4x4_core2.S +DGEMMINCOPY = +DGEMMITCOPY = +DGEMMONCOPY = gemm_ncopy_4.S +DGEMMOTCOPY = gemm_tcopy_4.S +DGEMMINCOPYOBJ = +DGEMMITCOPYOBJ = DGEMMONCOPYOBJ = dgemm_oncopy$(TSUFFIX).$(SUFFIX) DGEMMOTCOPYOBJ = dgemm_otcopy$(TSUFFIX).$(SUFFIX) + + CGEMMKERNEL = zgemm_kernel_2x4_nehalem.S CGEMMINCOPY = zgemm_ncopy_2.S CGEMMITCOPY = zgemm_tcopy_2.S @@ -40,10 +44,11 @@ STRSMKERNEL_LT = trsm_kernel_LT_4x8_nehalem.S STRSMKERNEL_RN = trsm_kernel_LT_4x8_nehalem.S STRSMKERNEL_RT = trsm_kernel_RT_4x8_nehalem.S -DTRSMKERNEL_LN = trsm_kernel_LN_2x8_nehalem.S -DTRSMKERNEL_LT = trsm_kernel_LT_2x8_nehalem.S -DTRSMKERNEL_RN = trsm_kernel_LT_2x8_nehalem.S -DTRSMKERNEL_RT = trsm_kernel_RT_2x8_nehalem.S +DTRSMKERNEL_LN = trsm_kernel_LN_4x4_core2.S +DTRSMKERNEL_LT = trsm_kernel_LT_4x4_core2.S +DTRSMKERNEL_RN = trsm_kernel_LT_4x4_core2.S +DTRSMKERNEL_RT = trsm_kernel_RT_4x4_core2.S + CTRSMKERNEL_LN = ztrsm_kernel_LN_2x4_nehalem.S CTRSMKERNEL_LT = ztrsm_kernel_LT_2x4_nehalem.S diff --git a/param.h b/param.h index aae648f8c..0065cf5e4 100644 --- a/param.h +++ b/param.h @@ -1032,14 +1032,14 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define XGEMM_DEFAULT_UNROLL_N 1 #else #define SGEMM_DEFAULT_UNROLL_M 4 -#define DGEMM_DEFAULT_UNROLL_M 2 +#define DGEMM_DEFAULT_UNROLL_M 4 #define QGEMM_DEFAULT_UNROLL_M 2 #define CGEMM_DEFAULT_UNROLL_M 2 #define ZGEMM_DEFAULT_UNROLL_M 1 #define XGEMM_DEFAULT_UNROLL_M 1 #define SGEMM_DEFAULT_UNROLL_N 8 -#define DGEMM_DEFAULT_UNROLL_N 8 +#define DGEMM_DEFAULT_UNROLL_N 4 #define QGEMM_DEFAULT_UNROLL_N 2 #define CGEMM_DEFAULT_UNROLL_N 4 #define ZGEMM_DEFAULT_UNROLL_N 4 From 5f3b68b4d454d2eebcc60df48f330f1ec65f79cc Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sat, 10 May 2014 11:24:07 +0200 Subject: [PATCH 06/70] replaced sgemm and cgemm kernels because lapack bugs --- kernel/x86_64/KERNEL.SANDYBRIDGE | 30 ++++++++++++++++-------------- param.h | 4 ++-- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/kernel/x86_64/KERNEL.SANDYBRIDGE b/kernel/x86_64/KERNEL.SANDYBRIDGE index c321be752..4d095d21f 100644 --- a/kernel/x86_64/KERNEL.SANDYBRIDGE +++ b/kernel/x86_64/KERNEL.SANDYBRIDGE @@ -1,34 +1,35 @@ -SGEMMKERNEL = sgemm_kernel_8x8_sandy.S -SGEMMINCOPY = -SGEMMITCOPY = +SGEMMKERNEL = gemm_kernel_4x8_nehalem.S +SGEMMINCOPY = gemm_ncopy_4.S +SGEMMITCOPY = gemm_tcopy_4.S SGEMMONCOPY = ../generic/gemm_ncopy_8.c SGEMMOTCOPY = ../generic/gemm_tcopy_8.c -SGEMMINCOPYOBJ = -SGEMMITCOPYOBJ = +SGEMMINCOPYOBJ = sgemm_incopy$(TSUFFIX).$(SUFFIX) +SGEMMITCOPYOBJ = sgemm_itcopy$(TSUFFIX).$(SUFFIX) SGEMMONCOPYOBJ = sgemm_oncopy$(TSUFFIX).$(SUFFIX) SGEMMOTCOPYOBJ = sgemm_otcopy$(TSUFFIX).$(SUFFIX) + + DGEMMKERNEL = dgemm_kernel_4x8_sandy.S DGEMMINCOPY = ../generic/gemm_ncopy_8.c DGEMMITCOPY = ../generic/gemm_tcopy_8.c -#DGEMMONCOPY = gemm_ncopy_4.S DGEMMONCOPY = ../generic/gemm_ncopy_4.c DGEMMOTCOPY = ../generic/gemm_tcopy_4.c -#DGEMMOTCOPY = gemm_tcopy_4.S DGEMMINCOPYOBJ = dgemm_incopy$(TSUFFIX).$(SUFFIX) DGEMMITCOPYOBJ = dgemm_itcopy$(TSUFFIX).$(SUFFIX) DGEMMONCOPYOBJ = dgemm_oncopy$(TSUFFIX).$(SUFFIX) DGEMMOTCOPYOBJ = dgemm_otcopy$(TSUFFIX).$(SUFFIX) -#CGEMMKERNEL = zgemm_kernel_2x4_nehalem.S -CGEMMKERNEL = cgemm_kernel_4x8_sandy.S -CGEMMINCOPY = ../generic/zgemm_ncopy_8_sandy.c -CGEMMITCOPY = ../generic/zgemm_tcopy_8_sandy.c -CGEMMONCOPY = ../generic/zgemm_ncopy_4_sandy.c -CGEMMOTCOPY = ../generic/zgemm_tcopy_4_sandy.c + +CGEMMKERNEL = zgemm_kernel_2x4_nehalem.S +CGEMMINCOPY = zgemm_ncopy_2.S +CGEMMITCOPY = zgemm_tcopy_2.S +CGEMMONCOPY = ../generic/zgemm_ncopy_4.c +CGEMMOTCOPY = ../generic/zgemm_tcopy_4.c CGEMMINCOPYOBJ = cgemm_incopy$(TSUFFIX).$(SUFFIX) CGEMMITCOPYOBJ = cgemm_itcopy$(TSUFFIX).$(SUFFIX) CGEMMONCOPYOBJ = cgemm_oncopy$(TSUFFIX).$(SUFFIX) CGEMMOTCOPYOBJ = cgemm_otcopy$(TSUFFIX).$(SUFFIX) -#ZGEMMKERNEL = zgemm_kernel_1x4_nehalem.S + + ZGEMMKERNEL = zgemm_kernel_4x4_sandy.S ZGEMMINCOPY = ZGEMMITCOPY = @@ -58,6 +59,7 @@ ZGEMMOTCOPYOBJ = zgemm_otcopy$(TSUFFIX).$(SUFFIX) #ZTRSMKERNEL_LT = ztrsm_kernel_LT_1x4_nehalem.S #ZTRSMKERNEL_RN = ztrsm_kernel_LT_1x4_nehalem.S #ZTRSMKERNEL_RT = ztrsm_kernel_RT_1x4_nehalem.S + STRSMKERNEL_LN = ../generic/trsm_kernel_LN.c STRSMKERNEL_LT = ../generic/trsm_kernel_LT.c STRSMKERNEL_RN = ../generic/trsm_kernel_RN.c diff --git a/param.h b/param.h index 0065cf5e4..efec08b85 100644 --- a/param.h +++ b/param.h @@ -1104,10 +1104,10 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define ZGEMM_DEFAULT_UNROLL_N 2 #define XGEMM_DEFAULT_UNROLL_N 1 #else -#define SGEMM_DEFAULT_UNROLL_M 8 +#define SGEMM_DEFAULT_UNROLL_M 4 #define DGEMM_DEFAULT_UNROLL_M 8 #define QGEMM_DEFAULT_UNROLL_M 2 -#define CGEMM_DEFAULT_UNROLL_M 8 +#define CGEMM_DEFAULT_UNROLL_M 2 #define ZGEMM_DEFAULT_UNROLL_M 4 #define XGEMM_DEFAULT_UNROLL_M 1 From 0732238213669cd5daad0baaa8c46c11adea7569 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sat, 10 May 2014 21:25:17 +0200 Subject: [PATCH 07/70] removed all C files in interface --- interface/asum.c | 93 --------- interface/axpy.c | 121 ------------ interface/copy.c | 80 -------- interface/dot.c | 101 ---------- interface/dsdot.c | 102 ---------- interface/gbmv.c | 252 ------------------------- interface/gemm.c | 461 --------------------------------------------- interface/gemv.c | 237 ----------------------- interface/ger.c | 193 ------------------- interface/gesv.c | 154 --------------- interface/getf2.c | 109 ----------- interface/getrf.c | 121 ------------ interface/getrs.c | 152 --------------- interface/imax.c | 171 ----------------- interface/larf.c | 109 ----------- interface/laswp.c | 110 ----------- interface/lauu2.c | 128 ------------- interface/lauum.c | 139 -------------- interface/max.c | 169 ----------------- interface/nrm2.c | 93 --------- interface/potf2.c | 128 ------------- interface/potrf.c | 139 -------------- interface/potri.c | 160 ---------------- interface/rot.c | 82 -------- interface/rotg.c | 109 ----------- interface/rotm.c | 155 --------------- interface/rotmg.c | 235 ----------------------- interface/sbmv.c | 215 --------------------- interface/scal.c | 112 ----------- interface/sdsdot.c | 101 ---------- interface/spmv.c | 207 -------------------- interface/spr.c | 197 ------------------- interface/spr2.c | 203 -------------------- interface/swap.c | 115 ----------- interface/symm.c | 442 ------------------------------------------- interface/symv.c | 205 -------------------- interface/syr.c | 200 -------------------- interface/syr2.c | 204 -------------------- interface/syr2k.c | 377 ------------------------------------ interface/syrk.c | 366 ----------------------------------- interface/tbmv.c | 248 ------------------------ interface/tbsv.c | 213 --------------------- interface/tpmv.c | 239 ----------------------- interface/tpsv.c | 204 -------------------- interface/trmv.c | 243 ------------------------ interface/trsm.c | 391 -------------------------------------- interface/trsv.c | 208 -------------------- interface/trti2.c | 134 ------------- interface/trtri.c | 156 --------------- interface/zaxpy.c | 127 ------------- interface/zdot.c | 202 -------------------- interface/zgbmv.c | 271 -------------------------- interface/zgemv.c | 259 ------------------------- interface/zger.c | 249 ------------------------ interface/zgetf2.c | 109 ----------- interface/zgetrf.c | 122 ------------ interface/zgetrs.c | 153 --------------- interface/zhbmv.c | 223 ---------------------- interface/zhemv.c | 215 --------------------- interface/zher.c | 200 -------------------- interface/zher2.c | 207 -------------------- interface/zhpmv.c | 213 --------------------- interface/zhpr.c | 198 ------------------- interface/zhpr2.c | 207 -------------------- interface/zlaswp.c | 108 ----------- interface/zlauu2.c | 129 ------------- interface/zlauum.c | 141 -------------- interface/zpotf2.c | 129 ------------- interface/zpotrf.c | 141 -------------- interface/zpotri.c | 157 --------------- interface/zrot.c | 72 ------- interface/zrotg.c | 115 ----------- interface/zsbmv.c | 157 --------------- interface/zscal.c | 117 ------------ interface/zspmv.c | 154 --------------- interface/zspr.c | 146 -------------- interface/zspr2.c | 149 --------------- interface/zswap.c | 116 ------------ interface/zsymv.c | 143 -------------- interface/zsyr.c | 203 -------------------- interface/zsyr2.c | 151 --------------- interface/ztbmv.c | 260 ------------------------- interface/ztbsv.c | 219 --------------------- interface/ztpmv.c | 252 ------------------------- interface/ztpsv.c | 210 --------------------- interface/ztrmv.c | 255 ------------------------- interface/ztrsv.c | 216 --------------------- interface/ztrti2.c | 134 ------------- interface/ztrtri.c | 154 --------------- 89 files changed, 16066 deletions(-) delete mode 100644 interface/asum.c delete mode 100644 interface/axpy.c delete mode 100644 interface/copy.c delete mode 100644 interface/dot.c delete mode 100644 interface/dsdot.c delete mode 100644 interface/gbmv.c delete mode 100644 interface/gemm.c delete mode 100644 interface/gemv.c delete mode 100644 interface/ger.c delete mode 100644 interface/gesv.c delete mode 100644 interface/getf2.c delete mode 100644 interface/getrf.c delete mode 100644 interface/getrs.c delete mode 100644 interface/imax.c delete mode 100644 interface/larf.c delete mode 100644 interface/laswp.c delete mode 100644 interface/lauu2.c delete mode 100644 interface/lauum.c delete mode 100644 interface/max.c delete mode 100644 interface/nrm2.c delete mode 100644 interface/potf2.c delete mode 100644 interface/potrf.c delete mode 100644 interface/potri.c delete mode 100644 interface/rot.c delete mode 100644 interface/rotg.c delete mode 100644 interface/rotm.c delete mode 100644 interface/rotmg.c delete mode 100644 interface/sbmv.c delete mode 100644 interface/scal.c delete mode 100644 interface/sdsdot.c delete mode 100644 interface/spmv.c delete mode 100644 interface/spr.c delete mode 100644 interface/spr2.c delete mode 100644 interface/swap.c delete mode 100644 interface/symm.c delete mode 100644 interface/symv.c delete mode 100644 interface/syr.c delete mode 100644 interface/syr2.c delete mode 100644 interface/syr2k.c delete mode 100644 interface/syrk.c delete mode 100644 interface/tbmv.c delete mode 100644 interface/tbsv.c delete mode 100644 interface/tpmv.c delete mode 100644 interface/tpsv.c delete mode 100644 interface/trmv.c delete mode 100644 interface/trsm.c delete mode 100644 interface/trsv.c delete mode 100644 interface/trti2.c delete mode 100644 interface/trtri.c delete mode 100644 interface/zaxpy.c delete mode 100644 interface/zdot.c delete mode 100644 interface/zgbmv.c delete mode 100644 interface/zgemv.c delete mode 100644 interface/zger.c delete mode 100644 interface/zgetf2.c delete mode 100644 interface/zgetrf.c delete mode 100644 interface/zgetrs.c delete mode 100644 interface/zhbmv.c delete mode 100644 interface/zhemv.c delete mode 100644 interface/zher.c delete mode 100644 interface/zher2.c delete mode 100644 interface/zhpmv.c delete mode 100644 interface/zhpr.c delete mode 100644 interface/zhpr2.c delete mode 100644 interface/zlaswp.c delete mode 100644 interface/zlauu2.c delete mode 100644 interface/zlauum.c delete mode 100644 interface/zpotf2.c delete mode 100644 interface/zpotrf.c delete mode 100644 interface/zpotri.c delete mode 100644 interface/zrot.c delete mode 100644 interface/zrotg.c delete mode 100644 interface/zsbmv.c delete mode 100644 interface/zscal.c delete mode 100644 interface/zspmv.c delete mode 100644 interface/zspr.c delete mode 100644 interface/zspr2.c delete mode 100644 interface/zswap.c delete mode 100644 interface/zsymv.c delete mode 100644 interface/zsyr.c delete mode 100644 interface/zsyr2.c delete mode 100644 interface/ztbmv.c delete mode 100644 interface/ztbsv.c delete mode 100644 interface/ztpmv.c delete mode 100644 interface/ztpsv.c delete mode 100644 interface/ztrmv.c delete mode 100644 interface/ztrsv.c delete mode 100644 interface/ztrti2.c delete mode 100644 interface/ztrtri.c diff --git a/interface/asum.c b/interface/asum.c deleted file mode 100644 index 634836e28..000000000 --- a/interface/asum.c +++ /dev/null @@ -1,93 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifndef CBLAS - -FLOATRET NAME(blasint *N, FLOAT *x, blasint *INCX){ - - BLASLONG n = *N; - BLASLONG incx = *INCX; - FLOATRET ret; - - PRINT_DEBUG_NAME; - - if (n <= 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - ret = (FLOATRET)ASUM_K(n, x, incx); - - FUNCTION_PROFILE_END(COMPSIZE, n, n); - - IDEBUG_END; - - return ret; -} - -#else - -FLOAT CNAME(blasint n, FLOAT *x, blasint incx){ - - FLOAT ret; - - PRINT_DEBUG_CNAME; - - if (n <= 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - ret = ASUM_K(n, x, incx); - - FUNCTION_PROFILE_END(COMPSIZE, n, n); - - IDEBUG_END; - - return ret; -} - -#endif diff --git a/interface/axpy.c b/interface/axpy.c deleted file mode 100644 index 82b0ee234..000000000 --- a/interface/axpy.c +++ /dev/null @@ -1,121 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifndef CBLAS - -void NAME(blasint *N, FLOAT *ALPHA, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){ - - BLASLONG n = *N; - BLASLONG incx = *INCX; - BLASLONG incy = *INCY; - FLOAT alpha = *ALPHA; - -#else - -void CNAME(blasint n, FLOAT alpha, FLOAT *x, blasint incx, FLOAT *y, blasint incy){ - -#endif - -#ifdef SMP - int mode, nthreads; -#endif - -#ifndef CBLAS - PRINT_DEBUG_NAME; -#else - PRINT_DEBUG_CNAME; -#endif - - if (n <= 0) return; - - if (alpha == ZERO) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0) x -= (n - 1) * incx; - if (incy < 0) y -= (n - 1) * incy; - -#ifdef SMP - nthreads = num_cpu_avail(1); - - //disable multi-thread when incx==0 or incy==0 - //In that case, the threads would be dependent. - if (incx == 0 || incy == 0) - nthreads = 1; - - //Temporarily walk around the low performance issue with small imput size & multithreads. - if (n <= 10000) - nthreads = 1; - - if (nthreads == 1) { -#endif - - AXPYU_K(n, 0, 0, alpha, x, incx, y, incy, NULL, 0); - -#ifdef SMP - } else { - -#ifdef XDOUBLE - mode = BLAS_XDOUBLE | BLAS_REAL; -#elif defined(DOUBLE) - mode = BLAS_DOUBLE | BLAS_REAL; -#else - mode = BLAS_SINGLE | BLAS_REAL; -#endif - - blas_level1_thread(mode, n, 0, 0, &alpha, - x, incx, y, incy, NULL, 0, (void *)AXPYU_K, nthreads); - - } -#endif - - FUNCTION_PROFILE_END(1, 2 * n, 2 * n); - - IDEBUG_END; - - return; - -} diff --git a/interface/copy.c b/interface/copy.c deleted file mode 100644 index 6965682ec..000000000 --- a/interface/copy.c +++ /dev/null @@ -1,80 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifndef CBLAS - -void NAME(blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){ - - BLASLONG n = *N; - BLASLONG incx = *INCX; - BLASLONG incy = *INCY; - - PRINT_DEBUG_NAME; - -#else - -void CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy){ - - PRINT_DEBUG_CNAME; - -#endif - - if (n <= 0) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0) x -= (n - 1) * incx * COMPSIZE; - if (incy < 0) y -= (n - 1) * incy * COMPSIZE; - - COPY_K(n, x, incx, y, incy); - - FUNCTION_PROFILE_END(COMPSIZE, COMPSIZE * n, 0); - - IDEBUG_END; - - return; - -} diff --git a/interface/dot.c b/interface/dot.c deleted file mode 100644 index 3744db5ea..000000000 --- a/interface/dot.c +++ /dev/null @@ -1,101 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifndef CBLAS - -FLOATRET NAME(blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){ - - BLASLONG n = *N; - BLASLONG incx = *INCX; - BLASLONG incy = *INCY; - FLOATRET ret; - - PRINT_DEBUG_NAME; - - if (n <= 0) return 0.; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0) x -= (n - 1) * incx; - if (incy < 0) y -= (n - 1) * incy; - - ret = (FLOATRET)DOTU_K(n, x, incx, y, incy); - - FUNCTION_PROFILE_END(1, 2 * n, 2 * n); - - IDEBUG_END; - - return ret; -} - -#else - -FLOAT CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy){ - - FLOAT ret; - - PRINT_DEBUG_CNAME; - - if (n <= 0) return 0.; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0) x -= (n - 1) * incx; - if (incy < 0) y -= (n - 1) * incy; - - ret = DOTU_K(n, x, incx, y, incy); - - FUNCTION_PROFILE_END(1, 2 * n, 2 * n); - - IDEBUG_END; - - return ret; - -} - -#endif diff --git a/interface/dsdot.c b/interface/dsdot.c deleted file mode 100644 index 94237e0c4..000000000 --- a/interface/dsdot.c +++ /dev/null @@ -1,102 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifndef CBLAS - -double NAME(blasint *N, float *x, blasint *INCX, float *y, blasint *INCY){ - - BLASLONG n = *N; - BLASLONG incx = *INCX; - BLASLONG incy = *INCY; - double ret = 0.0; - - PRINT_DEBUG_NAME; - - if (n <= 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0) x -= (n - 1) * incx; - if (incy < 0) y -= (n - 1) * incy; - - ret=DSDOT_K(n, x, incx, y, incy); - - FUNCTION_PROFILE_END(1, n, n); - - IDEBUG_END; - - return ret; - -} - -#else - -double CNAME(blasint n, float *x, blasint incx, float *y, blasint incy){ - - double ret = 0.0; - - PRINT_DEBUG_CNAME; - - if (n <= 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0) x -= (n - 1) * incx; - if (incy < 0) y -= (n - 1) * incy; - - ret=DSDOT_K(n, x, incx, y, incy); - - FUNCTION_PROFILE_END(1, n, n); - - IDEBUG_END; - - return ret; - -} - -#endif diff --git a/interface/gbmv.c b/interface/gbmv.c deleted file mode 100644 index a76c48d04..000000000 --- a/interface/gbmv.c +++ /dev/null @@ -1,252 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QGBMV " -#elif defined(DOUBLE) -#define ERROR_NAME "DGBMV " -#else -#define ERROR_NAME "SGBMV " -#endif - -static void (*gbmv[])(BLASLONG, BLASLONG, BLASLONG, BLASLONG, FLOAT, - FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { -#ifdef XDOUBLE - qgbmv_n, qgbmv_t, -#elif defined(DOUBLE) - dgbmv_n, dgbmv_t, -#else - sgbmv_n, sgbmv_t, -#endif -}; - -#ifdef SMP -static int (*gbmv_thread[])(BLASLONG, BLASLONG, BLASLONG, BLASLONG, FLOAT, - FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { -#ifdef XDOUBLE - qgbmv_thread_n, qgbmv_thread_t, -#elif defined(DOUBLE) - dgbmv_thread_n, dgbmv_thread_t, -#else - sgbmv_thread_n, sgbmv_thread_t, -#endif -}; -#endif - -#ifndef CBLAS - -void NAME(char *TRANS, blasint *M, blasint *N, - blasint *KU, blasint *KL, - FLOAT *ALPHA, FLOAT *a, blasint *LDA, - FLOAT *x, blasint *INCX, - FLOAT *BETA, FLOAT *y, blasint *INCY){ - - char trans = *TRANS; - blasint m = *M; - blasint n = *N; - blasint ku = *KU; - blasint kl = *KL; - blasint lda = *LDA; - blasint incx = *INCX; - blasint incy = *INCY; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - FLOAT alpha = *ALPHA; - FLOAT beta = *BETA; - - blasint info; - blasint lenx, leny; - blasint i; - - PRINT_DEBUG_NAME; - - TOUPPER(trans); - - info = 0; - - i = -1; - - if (trans == 'N') i = 0; - if (trans == 'T') i = 1; - if (trans == 'R') i = 0; - if (trans == 'C') i = 1; - - if (incy == 0) info = 13; - if (incx == 0) info = 10; - if (lda < kl + ku + 1) info = 8; - if (kl < 0) info = 5; - if (ku < 0) info = 4; - if (n < 0) info = 3; - if (m < 0) info = 2; - if (i < 0) info = 1; - - trans = i; - - if (info != 0){ - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, - enum CBLAS_TRANSPOSE TransA, - blasint m, blasint n, - blasint ku, blasint kl, - FLOAT alpha, - FLOAT *a, blasint lda, - FLOAT *x, blasint incx, - FLOAT beta, - FLOAT *y, blasint incy){ - - FLOAT *buffer; - blasint lenx, leny, info, t; - int trans; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_CNAME; - - trans = -1; - info = 0; - - if (order == CblasColMajor) { - if (TransA == CblasNoTrans) trans = 0; - if (TransA == CblasTrans) trans = 1; - if (TransA == CblasConjNoTrans) trans = 0; - if (TransA == CblasConjTrans) trans = 1; - - info = -1; - - if (incy == 0) info = 13; - if (incx == 0) info = 10; - if (lda < kl + ku + 1) info = 8; - if (kl < 0) info = 5; - if (ku < 0) info = 4; - if (n < 0) info = 3; - if (m < 0) info = 2; - if (trans < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (TransA == CblasNoTrans) trans = 1; - if (TransA == CblasTrans) trans = 0; - if (TransA == CblasConjNoTrans) trans = 1; - if (TransA == CblasConjTrans) trans = 0; - - info = -1; - - t = n; - n = m; - m = t; - - t = ku; - ku = kl; - kl = t; - - if (incy == 0) info = 13; - if (incx == 0) info = 10; - if (lda < kl + ku + 1) info = 8; - if (kl < 0) info = 5; - if (ku < 0) info = 4; - if (n < 0) info = 3; - if (m < 0) info = 2; - if (trans < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if ((m==0) || (n==0)) return; - - lenx = n; - leny = m; - if (trans) lenx = m; - if (trans) leny = n; - - if (beta != ONE) SCAL_K(leny, 0, 0, beta, y, abs(incy), NULL, 0, NULL, 0); - - if (alpha == ZERO) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0) x -= (lenx-1)*incx; - if (incy < 0) y -= (leny-1)*incy; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (gbmv[(int)trans])(m, n, kl, ku, alpha, a, lda, x, incx, y, incy, buffer); - -#ifdef SMP - } else { - - (gbmv_thread[(int)trans])(m, n, kl, ku, alpha, a, lda, x, incx, y, incy, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(1, m * n / 2 + n, m * n); - - IDEBUG_END; - - return; -} diff --git a/interface/gemm.c b/interface/gemm.c deleted file mode 100644 index 587175ec7..000000000 --- a/interface/gemm.c +++ /dev/null @@ -1,461 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifndef COMPLEX -#ifdef XDOUBLE -#define ERROR_NAME "QGEMM " -#elif defined(DOUBLE) -#define ERROR_NAME "DGEMM " -#else -#define ERROR_NAME "SGEMM " -#endif -#else -#ifndef GEMM3M -#ifdef XDOUBLE -#define ERROR_NAME "XGEMM " -#elif defined(DOUBLE) -#define ERROR_NAME "ZGEMM " -#else -#define ERROR_NAME "CGEMM " -#endif -#else -#ifdef XDOUBLE -#define ERROR_NAME "XGEMM3M " -#elif defined(DOUBLE) -#define ERROR_NAME "ZGEMM3M " -#else -#define ERROR_NAME "CGEMM3M " -#endif -#endif -#endif - -#ifndef GEMM_MULTITHREAD_THRESHOLD -# define GEMM_MULTITHREAD_THRESHOLD 4 -#endif - -static int (*gemm[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { -#ifndef GEMM3M - GEMM_NN, GEMM_TN, GEMM_RN, GEMM_CN, - GEMM_NT, GEMM_TT, GEMM_RT, GEMM_CT, - GEMM_NR, GEMM_TR, GEMM_RR, GEMM_CR, - GEMM_NC, GEMM_TC, GEMM_RC, GEMM_CC, -#if defined(SMP) && !defined(USE_SIMPLE_THREADED_LEVEL3) - GEMM_THREAD_NN, GEMM_THREAD_TN, GEMM_THREAD_RN, GEMM_THREAD_CN, - GEMM_THREAD_NT, GEMM_THREAD_TT, GEMM_THREAD_RT, GEMM_THREAD_CT, - GEMM_THREAD_NR, GEMM_THREAD_TR, GEMM_THREAD_RR, GEMM_THREAD_CR, - GEMM_THREAD_NC, GEMM_THREAD_TC, GEMM_THREAD_RC, GEMM_THREAD_CC, -#endif -#else - GEMM3M_NN, GEMM3M_TN, GEMM3M_RN, GEMM3M_CN, - GEMM3M_NT, GEMM3M_TT, GEMM3M_RT, GEMM3M_CT, - GEMM3M_NR, GEMM3M_TR, GEMM3M_RR, GEMM3M_CR, - GEMM3M_NC, GEMM3M_TC, GEMM3M_RC, GEMM3M_CC, -#if defined(SMP) && !defined(USE_SIMPLE_THREADED_LEVEL3) - GEMM3M_THREAD_NN, GEMM3M_THREAD_TN, GEMM3M_THREAD_RN, GEMM3M_THREAD_CN, - GEMM3M_THREAD_NT, GEMM3M_THREAD_TT, GEMM3M_THREAD_RT, GEMM3M_THREAD_CT, - GEMM3M_THREAD_NR, GEMM3M_THREAD_TR, GEMM3M_THREAD_RR, GEMM3M_THREAD_CR, - GEMM3M_THREAD_NC, GEMM3M_THREAD_TC, GEMM3M_THREAD_RC, GEMM3M_THREAD_CC, -#endif -#endif -}; - -#ifndef CBLAS - -void NAME(char *TRANSA, char *TRANSB, - blasint *M, blasint *N, blasint *K, - FLOAT *alpha, - FLOAT *a, blasint *ldA, - FLOAT *b, blasint *ldB, - FLOAT *beta, - FLOAT *c, blasint *ldC){ - - blas_arg_t args; - - int transa, transb, nrowa, nrowb; - blasint info; - - char transA, transB; - FLOAT *buffer; - FLOAT *sa, *sb; - -#ifdef SMP -#ifndef COMPLEX -#ifdef XDOUBLE - int mode = BLAS_XDOUBLE | BLAS_REAL; -#elif defined(DOUBLE) - int mode = BLAS_DOUBLE | BLAS_REAL; -#else - int mode = BLAS_SINGLE | BLAS_REAL; -#endif -#else -#ifdef XDOUBLE - int mode = BLAS_XDOUBLE | BLAS_COMPLEX; -#elif defined(DOUBLE) - int mode = BLAS_DOUBLE | BLAS_COMPLEX; -#else - int mode = BLAS_SINGLE | BLAS_COMPLEX; -#endif -#endif -#endif - -#if defined(SMP) && !defined(NO_AFFINITY) && !defined(USE_SIMPLE_THREADED_LEVEL3) - int nodes; -#endif - - PRINT_DEBUG_NAME; - - args.m = *M; - args.n = *N; - args.k = *K; - - args.a = (void *)a; - args.b = (void *)b; - args.c = (void *)c; - - args.lda = *ldA; - args.ldb = *ldB; - args.ldc = *ldC; - - args.alpha = (void *)alpha; - args.beta = (void *)beta; - - transA = *TRANSA; - transB = *TRANSB; - - TOUPPER(transA); - TOUPPER(transB); - - transa = -1; - transb = -1; - - if (transA == 'N') transa = 0; - if (transA == 'T') transa = 1; -#ifndef COMPLEX - if (transA == 'R') transa = 0; - if (transA == 'C') transa = 1; -#else - if (transA == 'R') transa = 2; - if (transA == 'C') transa = 3; -#endif - - if (transB == 'N') transb = 0; - if (transB == 'T') transb = 1; -#ifndef COMPLEX - if (transB == 'R') transb = 0; - if (transB == 'C') transb = 1; -#else - if (transB == 'R') transb = 2; - if (transB == 'C') transb = 3; -#endif - - nrowa = args.m; - if (transa & 1) nrowa = args.k; - nrowb = args.k; - if (transb & 1) nrowb = args.n; - - info = 0; - - if (args.ldc < args.m) info = 13; - if (args.ldb < nrowb) info = 10; - if (args.lda < nrowa) info = 8; - if (args.k < 0) info = 5; - if (args.n < 0) info = 4; - if (args.m < 0) info = 3; - if (transb < 0) info = 2; - if (transa < 0) info = 1; - - if (info){ - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_TRANSPOSE TransA, enum CBLAS_TRANSPOSE TransB, - blasint m, blasint n, blasint k, -#ifndef COMPLEX - FLOAT alpha, -#else - FLOAT *alpha, -#endif - FLOAT *a, blasint lda, - FLOAT *b, blasint ldb, -#ifndef COMPLEX - FLOAT beta, -#else - FLOAT *beta, -#endif - FLOAT *c, blasint ldc) { - - blas_arg_t args; - int transa, transb; - blasint nrowa, nrowb, info; - - XFLOAT *buffer; - XFLOAT *sa, *sb; - -#ifdef SMP -#ifndef COMPLEX -#ifdef XDOUBLE - int mode = BLAS_XDOUBLE | BLAS_REAL; -#elif defined(DOUBLE) - int mode = BLAS_DOUBLE | BLAS_REAL; -#else - int mode = BLAS_SINGLE | BLAS_REAL; -#endif -#else -#ifdef XDOUBLE - int mode = BLAS_XDOUBLE | BLAS_COMPLEX; -#elif defined(DOUBLE) - int mode = BLAS_DOUBLE | BLAS_COMPLEX; -#else - int mode = BLAS_SINGLE | BLAS_COMPLEX; -#endif -#endif -#endif - -#if defined(SMP) && !defined(NO_AFFINITY) && !defined(USE_SIMPLE_THREADED_LEVEL3) - int nodes; -#endif - - PRINT_DEBUG_CNAME; - -#ifndef COMPLEX - args.alpha = (void *)α - args.beta = (void *)β -#else - args.alpha = (void *)alpha; - args.beta = (void *)beta; -#endif - - transa = -1; - transb = -1; - info = 0; - - if (order == CblasColMajor) { - args.m = m; - args.n = n; - args.k = k; - - args.a = (void *)a; - args.b = (void *)b; - args.c = (void *)c; - - args.lda = lda; - args.ldb = ldb; - args.ldc = ldc; - - if (TransA == CblasNoTrans) transa = 0; - if (TransA == CblasTrans) transa = 1; -#ifndef COMPLEX - if (TransA == CblasConjNoTrans) transa = 0; - if (TransA == CblasConjTrans) transa = 1; -#else - if (TransA == CblasConjNoTrans) transa = 2; - if (TransA == CblasConjTrans) transa = 3; -#endif - if (TransB == CblasNoTrans) transb = 0; - if (TransB == CblasTrans) transb = 1; -#ifndef COMPLEX - if (TransB == CblasConjNoTrans) transb = 0; - if (TransB == CblasConjTrans) transb = 1; -#else - if (TransB == CblasConjNoTrans) transb = 2; - if (TransB == CblasConjTrans) transb = 3; -#endif - - nrowa = args.m; - if (transa & 1) nrowa = args.k; - nrowb = args.k; - if (transb & 1) nrowb = args.n; - - info = -1; - - if (args.ldc < args.m) info = 13; - if (args.ldb < nrowb) info = 10; - if (args.lda < nrowa) info = 8; - if (args.k < 0) info = 5; - if (args.n < 0) info = 4; - if (args.m < 0) info = 3; - if (transb < 0) info = 2; - if (transa < 0) info = 1; - } - - if (order == CblasRowMajor) { - args.m = n; - args.n = m; - args.k = k; - - args.a = (void *)b; - args.b = (void *)a; - args.c = (void *)c; - - args.lda = ldb; - args.ldb = lda; - args.ldc = ldc; - - if (TransB == CblasNoTrans) transa = 0; - if (TransB == CblasTrans) transa = 1; -#ifndef COMPLEX - if (TransB == CblasConjNoTrans) transa = 0; - if (TransB == CblasConjTrans) transa = 1; -#else - if (TransB == CblasConjNoTrans) transa = 2; - if (TransB == CblasConjTrans) transa = 3; -#endif - if (TransA == CblasNoTrans) transb = 0; - if (TransA == CblasTrans) transb = 1; -#ifndef COMPLEX - if (TransA == CblasConjNoTrans) transb = 0; - if (TransA == CblasConjTrans) transb = 1; -#else - if (TransA == CblasConjNoTrans) transb = 2; - if (TransA == CblasConjTrans) transb = 3; -#endif - - nrowa = args.m; - if (transa & 1) nrowa = args.k; - nrowb = args.k; - if (transb & 1) nrowb = args.n; - - info = -1; - - if (args.ldc < args.m) info = 13; - if (args.ldb < nrowb) info = 10; - if (args.lda < nrowa) info = 8; - if (args.k < 0) info = 5; - if (args.n < 0) info = 4; - if (args.m < 0) info = 3; - if (transb < 0) info = 2; - if (transa < 0) info = 1; - - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if ((args.m == 0) || (args.n == 0)) return; - -#if 0 - fprintf(stderr, "m = %4d n = %d k = %d lda = %4d ldb = %4d ldc = %4d\n", - args.m, args.n, args.k, args.lda, args.ldb, args.ldc); -#endif - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - buffer = (XFLOAT *)blas_memory_alloc(0); - - sa = (XFLOAT *)((BLASLONG)buffer +GEMM_OFFSET_A); - sb = (XFLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); - -#ifdef SMP - mode |= (transa << BLAS_TRANSA_SHIFT); - mode |= (transb << BLAS_TRANSB_SHIFT); - - args.common = NULL; - - if(args.m <= GEMM_MULTITHREAD_THRESHOLD || args.n <= GEMM_MULTITHREAD_THRESHOLD - || args.k <=GEMM_MULTITHREAD_THRESHOLD){ - args.nthreads = 1; - }else{ - args.nthreads = num_cpu_avail(3); - } - if (args.nthreads == 1) { -#endif - - (gemm[(transb << 2) | transa])(&args, NULL, NULL, sa, sb, 0); - -#ifdef SMP - - } else { - -#ifndef USE_SIMPLE_THREADED_LEVEL3 - -#ifndef NO_AFFINITY - nodes = get_num_nodes(); - - if ((nodes > 1) && get_node_equal()) { - - args.nthreads /= nodes; - - gemm_thread_mn(mode, &args, NULL, NULL, gemm[16 | (transb << 2) | transa], sa, sb, nodes); - - } else { -#endif - - (gemm[16 | (transb << 2) | transa])(&args, NULL, NULL, sa, sb, 0); - -#else - - GEMM_THREAD(mode, &args, NULL, NULL, gemm[(transb << 2) | transa], sa, sb, args.nthreads); - -#endif - -#ifndef USE_SIMPLE_THREADED_LEVEL3 -#ifndef NO_AFFINITY - } -#endif -#endif - -#endif - -#ifdef SMP - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.m * args.k + args.k * args.n + args.m * args.n, 2 * args.m * args.n * args.k); - - IDEBUG_END; - - return; -} diff --git a/interface/gemv.c b/interface/gemv.c deleted file mode 100644 index 9ea8aa895..000000000 --- a/interface/gemv.c +++ /dev/null @@ -1,237 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QGEMV " -#elif defined(DOUBLE) -#define ERROR_NAME "DGEMV " -#else -#define ERROR_NAME "SGEMV " -#endif - -#ifdef SMP -static int (*gemv_thread[])(BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { -#ifdef XDOUBLE - qgemv_thread_n, qgemv_thread_t, -#elif defined DOUBLE - dgemv_thread_n, dgemv_thread_t, -#else - sgemv_thread_n, sgemv_thread_t, -#endif -}; -#endif - -#ifndef CBLAS - -void NAME(char *TRANS, blasint *M, blasint *N, - FLOAT *ALPHA, FLOAT *a, blasint *LDA, - FLOAT *x, blasint *INCX, - FLOAT *BETA, FLOAT *y, blasint *INCY){ - - char trans = *TRANS; - blasint m = *M; - blasint n = *N; - blasint lda = *LDA; - blasint incx = *INCX; - blasint incy = *INCY; - FLOAT alpha = *ALPHA; - FLOAT beta = *BETA; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - int (*gemv[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { - GEMV_N, GEMV_T, - }; - - blasint info; - blasint lenx, leny; - blasint i; - - PRINT_DEBUG_NAME; - - TOUPPER(trans); - - info = 0; - - i = -1; - - if (trans == 'N') i = 0; - if (trans == 'T') i = 1; - if (trans == 'R') i = 0; - if (trans == 'C') i = 1; - - if (incy == 0) info = 11; - if (incx == 0) info = 8; - if (lda < MAX(1, m)) info = 6; - if (n < 0) info = 3; - if (m < 0) info = 2; - if (i < 0) info = 1; - - trans = i; - - if (info != 0){ - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, - enum CBLAS_TRANSPOSE TransA, - blasint m, blasint n, - FLOAT alpha, - FLOAT *a, blasint lda, - FLOAT *x, blasint incx, - FLOAT beta, - FLOAT *y, blasint incy){ - - FLOAT *buffer; - blasint lenx, leny; - int trans; - blasint info, t; -#ifdef SMP - int nthreads; -#endif - - int (*gemv[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { - GEMV_N, GEMV_T, - }; - - PRINT_DEBUG_CNAME; - - trans = -1; - info = 0; - - if (order == CblasColMajor) { - if (TransA == CblasNoTrans) trans = 0; - if (TransA == CblasTrans) trans = 1; - if (TransA == CblasConjNoTrans) trans = 0; - if (TransA == CblasConjTrans) trans = 1; - - info = -1; - - if (incy == 0) info = 11; - if (incx == 0) info = 8; - if (lda < MAX(1, m)) info = 6; - if (n < 0) info = 3; - if (m < 0) info = 2; - if (trans < 0) info = 1; - - } - - if (order == CblasRowMajor) { - if (TransA == CblasNoTrans) trans = 1; - if (TransA == CblasTrans) trans = 0; - if (TransA == CblasConjNoTrans) trans = 1; - if (TransA == CblasConjTrans) trans = 0; - - info = -1; - - t = n; - n = m; - m = t; - - if (incy == 0) info = 11; - if (incx == 0) info = 8; - if (lda < MAX(1, m)) info = 6; - if (n < 0) info = 3; - if (m < 0) info = 2; - if (trans < 0) info = 1; - - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if ((m==0) || (n==0)) return; - - lenx = n; - leny = m; - if (trans) lenx = m; - if (trans) leny = n; - - if (beta != ONE) SCAL_K(leny, 0, 0, beta, y, abs(incy), NULL, 0, NULL, 0); - - if (alpha == ZERO) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0) x -= (lenx - 1) * incx; - if (incy < 0) y -= (leny - 1) * incy; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (gemv[(int)trans])(m, n, 0, alpha, a, lda, x, incx, y, incy, buffer); - -#ifdef SMP - } else { - - (gemv_thread[(int)trans])(m, n, alpha, a, lda, x, incx, y, incy, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(1, m * n + m + n, 2 * m * n); - - IDEBUG_END; - - return; - -} diff --git a/interface/ger.c b/interface/ger.c deleted file mode 100644 index 0218d94dd..000000000 --- a/interface/ger.c +++ /dev/null @@ -1,193 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QGER " -#elif defined DOUBLE -#define ERROR_NAME "DGER " -#else -#define ERROR_NAME "SGER " -#endif - -#define GER GERU_K - -#if defined XDOUBLE -#define GER_THREAD qger_thread -#elif defined DOUBLE -#define GER_THREAD dger_thread -#else -#define GER_THREAD sger_thread -#endif - - -#ifndef CBLAS - -void NAME(blasint *M, blasint *N, FLOAT *Alpha, - FLOAT *x, blasint *INCX, - FLOAT *y, blasint *INCY, - FLOAT *a, blasint *LDA){ - - blasint m = *M; - blasint n = *N; - FLOAT alpha = *Alpha; - blasint incx = *INCX; - blasint incy = *INCY; - blasint lda = *LDA; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - blasint info; - - PRINT_DEBUG_NAME; - - info = 0; - - if (lda < MAX(1,m)) info = 9; - if (incy == 0) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (m < 0) info = 1; - - if (info){ - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, - blasint m, blasint n, - FLOAT alpha, - FLOAT *x, blasint incx, - FLOAT *y, blasint incy, - FLOAT *a, blasint lda) { - - FLOAT *buffer; - blasint info, t; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_CNAME; - - info = 0; - - if (order == CblasColMajor) { - info = -1; - - if (lda < MAX(1,m)) info = 9; - if (incy == 0) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (m < 0) info = 1; - } - - if (order == CblasRowMajor) { - info = -1; - - t = n; - n = m; - m = t; - - t = incx; - incx = incy; - incy = t; - - buffer = x; - x = y; - y = buffer; - - if (lda < MAX(1,m)) info = 9; - if (incy == 0) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (m < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - /* Quick return if possible. */ - if (m == 0 || n == 0) return; - if (alpha == 0.) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incy < 0) y -= (n - 1) * incy; - if (incx < 0) x -= (m - 1) * incx; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - GER(m, n, 0, alpha, x, incx, y, incy, a, lda, buffer); - -#ifdef SMP - } else { - - GER_THREAD(m, n, alpha, x, incx, y, incy, a, lda, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(1, m * n + m + n, 2 * m * n); - - IDEBUG_END; - - return; -} diff --git a/interface/gesv.c b/interface/gesv.c deleted file mode 100644 index ce6bcbd0b..000000000 --- a/interface/gesv.c +++ /dev/null @@ -1,154 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifndef COMPLEX -#ifdef XDOUBLE -#define ERROR_NAME "QGESV " -#elif defined(DOUBLE) -#define ERROR_NAME "DGESV " -#else -#define ERROR_NAME "SGESV " -#endif -#else -#ifdef XDOUBLE -#define ERROR_NAME "XGESV " -#elif defined(DOUBLE) -#define ERROR_NAME "ZGESV " -#else -#define ERROR_NAME "CGESV " -#endif -#endif - -int NAME(blasint *N, blasint *NRHS, FLOAT *a, blasint *ldA, blasint *ipiv, - FLOAT *b, blasint *ldB, blasint *Info){ - - blas_arg_t args; - - blasint info; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.m = *N; - args.n = *NRHS; - args.a = (void *)a; - args.lda = *ldA; - args.b = (void *)b; - args.ldb = *ldB; - args.c = (void *)ipiv; - - info = 0; - if (args.ldb < MAX(1,args.m)) info = 7; - if (args.lda < MAX(1,args.m)) info = 4; - if (args.n < 0) info = 2; - if (args.m < 0) info = 1; - - if (info) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - *Info = - info; - return 0; - } - - args.alpha = NULL; - args.beta = NULL; - - *Info = 0; - - if (args.m == 0 || args.n == 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - -#ifdef SMP - args.common = NULL; - args.nthreads = num_cpu_avail(4); - - if (args.nthreads == 1) { -#endif - - args.n = *N; - info = GETRF_SINGLE(&args, NULL, NULL, sa, sb, 0); - - if (info == 0){ - args.n = *NRHS; - GETRS_N_SINGLE(&args, NULL, NULL, sa, sb, 0); - } - -#ifdef SMP - } else { - - args.n = *N; - info = GETRF_PARALLEL(&args, NULL, NULL, sa, sb, 0); - - if (info == 0){ - args.n = *NRHS; - GETRS_N_PARALLEL(&args, NULL, NULL, sa, sb, 0); - } - } -#endif - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - *Info = info; - - FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, *N * *N, 2. / 3. * *N * *N * *N + *N * *N); - - IDEBUG_END; - - return 0; -} diff --git a/interface/getf2.c b/interface/getf2.c deleted file mode 100644 index cae15953b..000000000 --- a/interface/getf2.c +++ /dev/null @@ -1,109 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QGETF2" -#elif defined(DOUBLE) -#define ERROR_NAME "DGETF2" -#else -#define ERROR_NAME "SGETF2" -#endif - -int NAME(blasint *M, blasint *N, FLOAT *a, blasint *ldA, blasint *ipiv, blasint *Info){ - - blas_arg_t args; - - blasint info; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.m = *M; - args.n = *N; - args.a = (void *)a; - args.lda = *ldA; - args.c = (void *)ipiv; - - info = 0; - if (args.lda < MAX(1,args.m)) info = 4; - if (args.n < 0) info = 2; - if (args.m < 0) info = 1; - if (info) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - *Info = - info; - return 0; - } - - *Info = 0; - if (args.m == 0 || args.n == 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - - info = GETF2(&args, NULL, NULL, sa, sb, 0); - - *Info = info; - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.m * args.n, 2. / 3. * args.m * args.n * args.n); - - IDEBUG_END; - - return 0; -} diff --git a/interface/getrf.c b/interface/getrf.c deleted file mode 100644 index aa799e8d3..000000000 --- a/interface/getrf.c +++ /dev/null @@ -1,121 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QGETRF" -#elif defined(DOUBLE) -#define ERROR_NAME "DGETRF" -#else -#define ERROR_NAME "SGETRF" -#endif - -int NAME(blasint *M, blasint *N, FLOAT *a, blasint *ldA, blasint *ipiv, blasint *Info){ - - blas_arg_t args; - - blasint info; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.m = *M; - args.n = *N; - args.a = (void *)a; - args.lda = *ldA; - args.c = (void *)ipiv; - - info = 0; - if (args.lda < MAX(1,args.m)) info = 4; - if (args.n < 0) info = 2; - if (args.m < 0) info = 1; - if (info) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - *Info = - info; - return 0; - } - - *Info = 0; - if (args.m == 0 || args.n == 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - -#ifdef SMP - args.common = NULL; - args.nthreads = num_cpu_avail(4); - - if (args.nthreads == 1) { -#endif - - *Info = GETRF_SINGLE(&args, NULL, NULL, sa, sb, 0); - -#ifdef SMP - } else { - - *Info = GETRF_PARALLEL(&args, NULL, NULL, sa, sb, 0); - } -#endif - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.m * args.n, 2. / 3. * args.m * args.n * args.n); - - IDEBUG_END; - - return 0; -} diff --git a/interface/getrs.c b/interface/getrs.c deleted file mode 100644 index 761a00160..000000000 --- a/interface/getrs.c +++ /dev/null @@ -1,152 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QGETRS" -#elif defined(DOUBLE) -#define ERROR_NAME "DGETRS" -#else -#define ERROR_NAME "SGETRS" -#endif - -static blasint (*getrs_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { - GETRS_N_SINGLE, GETRS_T_SINGLE, -}; - -#ifdef SMP -static blasint (*getrs_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { - GETRS_N_PARALLEL, GETRS_T_PARALLEL, -}; -#endif - -int NAME(char *TRANS, blasint *N, blasint *NRHS, FLOAT *a, blasint *ldA, - blasint *ipiv, FLOAT *b, blasint *ldB, blasint *Info){ - - char trans_arg = *TRANS; - - blas_arg_t args; - - blasint info; - int trans; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.m = *N; - args.n = *NRHS; - args.a = (void *)a; - args.lda = *ldA; - args.b = (void *)b; - args.ldb = *ldB; - args.c = (void *)ipiv; - - info = 0; - - TOUPPER(trans_arg); - trans = -1; - - if (trans_arg == 'N') trans = 0; - if (trans_arg == 'T') trans = 1; - if (trans_arg == 'R') trans = 0; - if (trans_arg == 'C') trans = 1; - - if (args.ldb < MAX(1, args.m)) info = 8; - if (args.lda < MAX(1, args.m)) info = 5; - if (args.n < 0) info = 3; - if (args.m < 0) info = 2; - if (trans < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return 0; - } - - args.alpha = NULL; - args.beta = NULL; - - *Info = info; - - if (args.m == 0 || args.n == 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - -#ifdef SMP - args.common = NULL; - args.nthreads = num_cpu_avail(4); - - if (args.nthreads == 1) { -#endif - - (getrs_single[trans])(&args, NULL, NULL, sa, sb, 0); - -#ifdef SMP - } else { - (getrs_parallel[trans])(&args, NULL, NULL, sa, sb, 0); - } -#endif - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.m * args.n, 2 * args.m * args.m * args.n); - - IDEBUG_END; - - return 0; - -} diff --git a/interface/imax.c b/interface/imax.c deleted file mode 100644 index 37396c7f8..000000000 --- a/interface/imax.c +++ /dev/null @@ -1,171 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#undef MAX_K - -#ifdef USE_ABS - -#ifndef USE_MIN - -/* ABS & MAX */ -#ifndef COMPLEX -#ifdef XDOUBLE -#define MAX_K IQAMAX_K -#elif defined(DOUBLE) -#define MAX_K IDAMAX_K -#else -#define MAX_K ISAMAX_K -#endif -#else -#ifdef XDOUBLE -#define MAX_K IXAMAX_K -#elif defined(DOUBLE) -#define MAX_K IZAMAX_K -#else -#define MAX_K ICAMAX_K -#endif -#endif - -#else - -/* ABS & MIN */ -#ifndef COMPLEX -#ifdef XDOUBLE -#define MAX_K IQAMIN_K -#elif defined(DOUBLE) -#define MAX_K IDAMIN_K -#else -#define MAX_K ISAMIN_K -#endif -#else -#ifdef XDOUBLE -#define MAX_K IXAMIN_K -#elif defined(DOUBLE) -#define MAX_K IZAMIN_K -#else -#define MAX_K ICAMIN_K -#endif -#endif - -#endif - -#else - -#ifndef USE_MIN - -/* MAX */ -#ifdef XDOUBLE -#define MAX_K IQMAX_K -#elif defined(DOUBLE) -#define MAX_K IDMAX_K -#else -#define MAX_K ISMAX_K -#endif - -#else - -/* MIN */ -#ifdef XDOUBLE -#define MAX_K IQMIN_K -#elif defined(DOUBLE) -#define MAX_K IDMIN_K -#else -#define MAX_K ISMIN_K -#endif - -#endif - -#endif - -#ifndef CBLAS - -blasint NAME(blasint *N, FLOAT *x, blasint *INCX){ - - BLASLONG n = *N; - BLASLONG incx = *INCX; - blasint ret; - - PRINT_DEBUG_NAME; - - if (n <= 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - ret = (blasint)MAX_K(n, x, incx); - - FUNCTION_PROFILE_END(COMPSIZE, n, 0); - - IDEBUG_END; - - return ret; -} - -#else - -CBLAS_INDEX CNAME(blasint n, FLOAT *x, blasint incx){ - - CBLAS_INDEX ret; - - PRINT_DEBUG_CNAME; - - if (n <= 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - ret = MAX_K(n, x, incx); - - if (ret) ret --; - - FUNCTION_PROFILE_END(COMPSIZE, n, 0); - - IDEBUG_END; - - return ret; -} - -#endif diff --git a/interface/larf.c b/interface/larf.c deleted file mode 100644 index 3b538c4a2..000000000 --- a/interface/larf.c +++ /dev/null @@ -1,109 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -static int (*larf[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { - LARF_L, LARF_R, -}; - -int NAME(char *SIDE, blasint *M, blasint *N, FLOAT *v, blasint *incV, FLOAT *tau, FLOAT *c, blasint *ldC, FLOAT *work){ - - blas_arg_t args; - - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - char side_arg = *SIDE; - int side; - - PRINT_DEBUG_NAME; - - TOUPPER(side_arg); - - args.m = *M; - args.n = *N; - args.a = (void *)v; - args.lda = *incV; - args.c = (void *)c; - args.ldc = *ldC; - - args.alpha = (void *)tau; - - side = -1; - if (side_arg == 'L') side = 0; - if (side_arg == 'R') side = 1; - - if (args.m == 0 || args.n == 0) return 0; - -#ifndef COMPLEX - if (*tau == ZERO) return 0; -#else - if ((*(tau + 0) == ZERO) && (*(tau + 1) == ZERO)) return 0; -#endif - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - - larf[side](&args, NULL, NULL, sa, sb, 0); - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.m * args.n, 2. / 3. * args.m * args.n * args.n); - - IDEBUG_END; - - return 0; -} diff --git a/interface/laswp.c b/interface/laswp.c deleted file mode 100644 index 026b5156f..000000000 --- a/interface/laswp.c +++ /dev/null @@ -1,110 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -static int (*laswp[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, blasint *, BLASLONG) = { -#ifdef XDOUBLE - qlaswp_plus, qlaswp_minus, -#elif defined(DOUBLE) - dlaswp_plus, dlaswp_minus, -#else - slaswp_plus, slaswp_minus, -#endif -}; - -int NAME(blasint *N, FLOAT *a, blasint *LDA, blasint *K1, blasint *K2, blasint *ipiv, blasint *INCX){ - - blasint n = *N; - blasint lda = *LDA; - blasint k1 = *K1; - blasint k2 = *K2; - blasint incx = *INCX; - int flag; - -#ifdef SMP - int mode, nthreads; - FLOAT dummyalpha[2] = {ZERO, ZERO}; -#endif - - PRINT_DEBUG_NAME; - - if (incx == 0 || n <= 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - flag = (incx < 0); - -#ifdef SMP - nthreads = num_cpu_avail(1); - - if (nthreads == 1) { -#endif - - (laswp[flag])(n, k1, k2, ZERO, a, lda, NULL, 0, ipiv, incx); - -#ifdef SMP - } else { - -#ifdef XDOUBLE - mode = BLAS_XDOUBLE | BLAS_REAL; -#elif defined(DOUBLE) - mode = BLAS_DOUBLE | BLAS_REAL; -#else - mode = BLAS_SINGLE | BLAS_REAL; -#endif - - blas_level1_thread(mode, n, k1, k2, dummyalpha, - a, lda, NULL, 0, ipiv, incx, - laswp[flag], nthreads); - } -#endif - - FUNCTION_PROFILE_END(COMPSIZE, n * (k2 - k1), 0); - - IDEBUG_END; - - return 0; - -} diff --git a/interface/lauu2.c b/interface/lauu2.c deleted file mode 100644 index 14417e986..000000000 --- a/interface/lauu2.c +++ /dev/null @@ -1,128 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QLAUU2" -#elif defined(DOUBLE) -#define ERROR_NAME "DLAUU2" -#else -#define ERROR_NAME "SLAUU2" -#endif - -static blasint (*lauu2[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { -#ifdef XDOUBLE - qlauu2_U, qlauu2_L, -#elif defined(DOUBLE) - dlauu2_U, dlauu2_L, -#else - slauu2_U, slauu2_L, -#endif - }; - -int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ - - blas_arg_t args; - - blasint uplo_arg = *UPLO; - blasint uplo; - blasint info; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.n = *N; - args.a = (void *)a; - args.lda = *ldA; - - TOUPPER(uplo_arg); - - uplo = -1; - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - if (args.lda < MAX(1,args.n)) info = 4; - if (args.n < 0) info = 2; - if (uplo < 0) info = 1; - if (info) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - *Info = - info; - return 0; - } - - *Info = 0; - - if (args.n <= 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - - info = (lauu2[uplo])(&args, NULL, NULL, sa, sb, 0); - - *Info = info; - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(1, .5 * args.n * args.n, - args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) - + 1./6. * args.n * (args.n * args.n - 1)); - - IDEBUG_END; - - return 0; -} diff --git a/interface/lauum.c b/interface/lauum.c deleted file mode 100644 index e5b593f30..000000000 --- a/interface/lauum.c +++ /dev/null @@ -1,139 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QLAUUM" -#elif defined(DOUBLE) -#define ERROR_NAME "DLAUUM" -#else -#define ERROR_NAME "SLAUUM" -#endif - -static blasint (*lauum_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { - LAUUM_U_SINGLE, LAUUM_L_SINGLE, -}; - -#ifdef SMP -static blasint (*lauum_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { - LAUUM_U_PARALLEL, LAUUM_L_PARALLEL, -}; -#endif - -int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ - - blas_arg_t args; - - blasint uplo_arg = *UPLO; - blasint uplo; - blasint info; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.n = *N; - args.a = (void *)a; - args.lda = *ldA; - - TOUPPER(uplo_arg); - - uplo = -1; - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - if (args.lda < MAX(1,args.n)) info = 4; - if (args.n < 0) info = 2; - if (uplo < 0) info = 1; - if (info) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - *Info = - info; - return 0; - } - - *Info = 0; - - if (args.n == 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - -#ifdef SMP - args.common = NULL; - args.nthreads = num_cpu_avail(4); - - if (args.nthreads == 1) { -#endif - - *Info = (lauum_single[uplo])(&args, NULL, NULL, sa, sb, 0); - -#ifdef SMP - } else { - *Info = (lauum_parallel[uplo])(&args, NULL, NULL, sa, sb, 0); - } -#endif - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(1, .5 * args.n * args.n, - args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) - + 1./6. * args.n * (args.n * args.n - 1)); - - IDEBUG_END; - - return 0; -} diff --git a/interface/max.c b/interface/max.c deleted file mode 100644 index 9bedaddd0..000000000 --- a/interface/max.c +++ /dev/null @@ -1,169 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#undef MAX_K - -#ifdef USE_ABS - -#ifndef USE_MIN - -/* ABS & MAX */ -#ifndef COMPLEX -#ifdef XDOUBLE -#define MAX_K QAMAX_K -#elif defined(DOUBLE) -#define MAX_K DAMAX_K -#else -#define MAX_K SAMAX_K -#endif -#else -#ifdef XDOUBLE -#define MAX_K XAMAX_K -#elif defined(DOUBLE) -#define MAX_K ZAMAX_K -#else -#define MAX_K CAMAX_K -#endif -#endif - -#else - -/* ABS & MIN */ -#ifndef COMPLEX -#ifdef XDOUBLE -#define MAX_K QAMIN_K -#elif defined(DOUBLE) -#define MAX_K DAMIN_K -#else -#define MAX_K SAMIN_K -#endif -#else -#ifdef XDOUBLE -#define MAX_K XAMIN_K -#elif defined(DOUBLE) -#define MAX_K ZAMIN_K -#else -#define MAX_K CAMIN_K -#endif -#endif - -#endif - -#else - -#ifndef USE_MIN - -/* MAX */ -#ifdef XDOUBLE -#define MAX_K QMAX_K -#elif defined(DOUBLE) -#define MAX_K DMAX_K -#else -#define MAX_K SMAX_K -#endif - -#else - -/* MIN */ -#ifdef XDOUBLE -#define MAX_K QMIN_K -#elif defined(DOUBLE) -#define MAX_K DMIN_K -#else -#define MAX_K SMIN_K -#endif - -#endif - -#endif - -#ifndef CBLAS - -FLOATRET NAME(blasint *N, FLOAT *x, blasint *INCX){ - - BLASLONG n = *N; - BLASLONG incx = *INCX; - FLOATRET ret; - - PRINT_DEBUG_NAME; - - if (n <= 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - ret = (FLOATRET)MAX_K(n, x, incx); - - FUNCTION_PROFILE_END(COMPSIZE, n, 0); - - IDEBUG_END; - - return ret; -} - -#else - -FLOAT CNAME(blasint n, FLOAT *x, blasint incx){ - - FLOAT ret; - - PRINT_DEBUG_CNAME; - - if (n <= 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - ret = MAX_K(n, x, incx); - - FUNCTION_PROFILE_END(COMPSIZE, n, 0); - - IDEBUG_END; - - return ret; -} - -#endif diff --git a/interface/nrm2.c b/interface/nrm2.c deleted file mode 100644 index ff8ef6d0d..000000000 --- a/interface/nrm2.c +++ /dev/null @@ -1,93 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifndef CBLAS - -FLOATRET NAME(blasint *N, FLOAT *x, blasint *INCX){ - - BLASLONG n = *N; - BLASLONG incx = *INCX; - FLOATRET ret; - - PRINT_DEBUG_NAME; - - if (n <= 0) return 0.; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - ret = (FLOATRET)NRM2_K(n, x, incx); - - FUNCTION_PROFILE_END(COMPSIZE, n, 2 * n); - - IDEBUG_END; - - return ret; -} - -#else - -FLOAT CNAME(blasint n, FLOAT *x, blasint incx){ - - FLOAT ret; - - PRINT_DEBUG_CNAME; - - if (n <= 0) return 0.; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - ret = NRM2_K(n, x, incx); - - FUNCTION_PROFILE_END(COMPSIZE, n, 2 * n); - - IDEBUG_END; - - return ret; -} - -#endif diff --git a/interface/potf2.c b/interface/potf2.c deleted file mode 100644 index 76822a49c..000000000 --- a/interface/potf2.c +++ /dev/null @@ -1,128 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QPOTF2" -#elif defined(DOUBLE) -#define ERROR_NAME "DPOTF2" -#else -#define ERROR_NAME "SPOTF2" -#endif - -static blasint (*potf2[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { -#ifdef XDOUBLE - qpotf2_U, qpotf2_L, -#elif defined(DOUBLE) - dpotf2_U, dpotf2_L, -#else - spotf2_U, spotf2_L, -#endif - }; - -int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ - - blas_arg_t args; - - blasint uplo_arg = *UPLO; - blasint uplo; - blasint info; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.n = *N; - args.a = (void *)a; - args.lda = *ldA; - - TOUPPER(uplo_arg); - - uplo = -1; - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - if (args.lda < MAX(1,args.n)) info = 4; - if (args.n < 0) info = 2; - if (uplo < 0) info = 1; - if (info) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - *Info = - info; - return 0; - } - - *Info = 0; - - if (args.n <= 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - - info = (potf2[uplo])(&args, NULL, NULL, sa, sb, 0); - - *Info = info; - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(1, .5 * args.n * args.n, - args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) - + 1./6. * args.n * (args.n * args.n - 1)); - - IDEBUG_END; - - return 0; -} diff --git a/interface/potrf.c b/interface/potrf.c deleted file mode 100644 index 9a15012d3..000000000 --- a/interface/potrf.c +++ /dev/null @@ -1,139 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QPOTRF" -#elif defined(DOUBLE) -#define ERROR_NAME "DPOTRF" -#else -#define ERROR_NAME "SPOTRF" -#endif - -static blasint (*potrf_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { - POTRF_U_SINGLE, POTRF_L_SINGLE, -}; - -#ifdef SMP -static blasint (*potrf_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { - POTRF_U_PARALLEL, POTRF_L_PARALLEL, -}; -#endif - -int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ - - blas_arg_t args; - - blasint uplo_arg = *UPLO; - blasint uplo; - blasint info; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.n = *N; - args.a = (void *)a; - args.lda = *ldA; - - TOUPPER(uplo_arg); - - uplo = -1; - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - if (args.lda < MAX(1,args.n)) info = 4; - if (args.n < 0) info = 2; - if (uplo < 0) info = 1; - if (info) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - *Info = - info; - return 0; - } - - *Info = 0; - - if (args.n == 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - -#ifdef SMP - args.common = NULL; - args.nthreads = num_cpu_avail(4); - - if (args.nthreads == 1) { -#endif - - *Info = (potrf_single[uplo])(&args, NULL, NULL, sa, sb, 0); - -#ifdef SMP - } else { - *Info = (potrf_parallel[uplo])(&args, NULL, NULL, sa, sb, 0); - } -#endif - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(1, .5 * args.n * args.n, - args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) - + 1./6. * args.n * (args.n * args.n - 1)); - - IDEBUG_END; - - return 0; -} diff --git a/interface/potri.c b/interface/potri.c deleted file mode 100644 index a4f33221a..000000000 --- a/interface/potri.c +++ /dev/null @@ -1,160 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QPOTRI" -#elif defined(DOUBLE) -#define ERROR_NAME "DPOTRI" -#else -#define ERROR_NAME "SPOTRI" -#endif - -static blasint (*trtri_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ - TRTRI_UN_SINGLE, TRTRI_LN_SINGLE, -}; - -static blasint (*lauum_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ - LAUUM_U_SINGLE, LAUUM_L_SINGLE, -}; - -#ifdef SMP -static blasint (*trtri_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ - TRTRI_UN_PARALLEL, TRTRI_LN_PARALLEL, -}; - -static blasint (*lauum_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ - LAUUM_U_PARALLEL, LAUUM_L_PARALLEL, -}; -#endif - -int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ - - blas_arg_t args; - - blasint uplo_arg = *UPLO; - blasint uplo; - blasint info; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.n = *N; - args.a = (void *)a; - args.lda = *ldA; - - TOUPPER(uplo_arg); - - uplo = -1; - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - if (args.lda < MAX(1,args.n)) info = 4; - if (args.n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - *Info = - info; - return 0; - } - - *Info = 0; - - if (args.n == 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - -#ifdef SMP - args.common = NULL; - args.nthreads = num_cpu_avail(4); - - if (args.nthreads == 1) { -#endif - - info = (trtri_single[uplo])(&args, NULL, NULL, sa, sb, 0); - - if (!info) { - info = (lauum_single[uplo])(&args, NULL, NULL, sa, sb, 0); - } - - *Info = info; - -#ifdef SMP - } else { - info = (trtri_parallel[uplo])(&args, NULL, NULL, sa, sb, 0); - - if (!info) { - info = (lauum_parallel[uplo])(&args, NULL, NULL, sa, sb, 0); - } - - *Info = info; - } -#endif - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, .5 * args.n * args.n, - args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) - + args.n * (1./3. + args.n * (-1./2. + args.n * 1./6.))); - - IDEBUG_END; - - return 0; -} diff --git a/interface/rot.c b/interface/rot.c deleted file mode 100644 index 2e458b12d..000000000 --- a/interface/rot.c +++ /dev/null @@ -1,82 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifndef CBLAS - -void NAME(blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *C, FLOAT *S){ - - BLASLONG n = *N; - BLASLONG incx = *INCX; - BLASLONG incy = *INCY; - FLOAT c = *C; - FLOAT s = *S; - - PRINT_DEBUG_NAME; - -#else - -void CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy, FLOAT c, FLOAT s){ - - PRINT_DEBUG_CNAME; - -#endif - - if (n <= 0) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0) x -= (n - 1) * incx; - if (incy < 0) y -= (n - 1) * incy; - - ROT_K(n, x, incx, y, incy, c, s); - - FUNCTION_PROFILE_END(1, n, n); - - IDEBUG_END; - - return; - -} diff --git a/interface/rotg.c b/interface/rotg.c deleted file mode 100644 index 49088ab02..000000000 --- a/interface/rotg.c +++ /dev/null @@ -1,109 +0,0 @@ -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifndef CBLAS - -void NAME(FLOAT *DA, FLOAT *DB, FLOAT *C, FLOAT *S){ - -#else - -void CNAME(FLOAT *DA, FLOAT *DB, FLOAT *C, FLOAT *S){ - -#endif - - -#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__) - - long double da = *DA; - long double db = *DB; - long double c; - long double s; - long double r, roe, z; - - long double ada = fabs(da); - long double adb = fabs(db); - long double scale = ada + adb; - -#ifndef CBLAS - PRINT_DEBUG_NAME; -#else - PRINT_DEBUG_CNAME; -#endif - - roe = db; - if (ada > adb) roe = da; - - if (scale == ZERO) { - *C = ONE; - *S = ZERO; - *DA = ZERO; - *DB = ZERO; - } else { - r = sqrt(da * da + db * db); - if (roe < 0) r = -r; - c = da / r; - s = db / r; - z = ONE; - if (da != ZERO) { - if (ada > adb){ - z = s; - } else { - z = ONE / c; - } - } - - *C = c; - *S = s; - *DA = r; - *DB = z; - } - -#else - FLOAT da = *DA; - FLOAT db = *DB; - FLOAT c = *C; - FLOAT s = *S; - FLOAT r, roe, z; - - FLOAT ada = fabs(da); - FLOAT adb = fabs(db); - FLOAT scale = ada + adb; - -#ifndef CBLAS - PRINT_DEBUG_NAME; -#else - PRINT_DEBUG_CNAME; -#endif - - roe = db; - if (ada > adb) roe = da; - - if (scale == ZERO) { - *C = ONE; - *S = ZERO; - *DA = ZERO; - *DB = ZERO; - } else { - FLOAT aa = da / scale; - FLOAT bb = db / scale; - - r = scale * sqrt(aa * aa + bb * bb); - if (roe < 0) r = -r; - c = da / r; - s = db / r; - z = ONE; - if (ada > adb) z = s; - if ((ada < adb) && (c != ZERO)) z = ONE / c; - - *C = c; - *S = s; - *DA = r; - *DB = z; - } -#endif - - return; -} diff --git a/interface/rotm.c b/interface/rotm.c deleted file mode 100644 index 4f026c75d..000000000 --- a/interface/rotm.c +++ /dev/null @@ -1,155 +0,0 @@ -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifndef CBLAS - -void NAME(blasint *N, FLOAT *dx, blasint *INCX, FLOAT *dy, blasint *INCY, FLOAT *dparam){ - - blasint n = *N; - blasint incx = *INCX; - blasint incy = *INCY; - -#else - -void CNAME(blasint n, FLOAT *dx, blasint incx, FLOAT *dy, blasint incy, FLOAT *dparam){ - -#endif - - blasint i__1, i__2; - - blasint i__; - FLOAT w, z__; - blasint kx, ky; - FLOAT dh11, dh12, dh22, dh21, dflag; - blasint nsteps; - -#ifndef CBLAS - PRINT_DEBUG_CNAME; -#else - PRINT_DEBUG_CNAME; -#endif - - --dparam; - --dy; - --dx; - - dflag = dparam[1]; - if (n <= 0 || dflag == - 2.0) goto L140; - - if (! (incx == incy && incx > 0)) goto L70; - - nsteps = n * incx; - if (dflag < 0.) { - goto L50; - } else if (dflag == 0) { - goto L10; - } else { - goto L30; - } -L10: - dh12 = dparam[4]; - dh21 = dparam[3]; - i__1 = nsteps; - i__2 = incx; - for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) { - w = dx[i__]; - z__ = dy[i__]; - dx[i__] = w + z__ * dh12; - dy[i__] = w * dh21 + z__; -/* L20: */ - } - goto L140; -L30: - dh11 = dparam[2]; - dh22 = dparam[5]; - i__2 = nsteps; - i__1 = incx; - for (i__ = 1; i__1 < 0 ? i__ >= i__2 : i__ <= i__2; i__ += i__1) { - w = dx[i__]; - z__ = dy[i__]; - dx[i__] = w * dh11 + z__; - dy[i__] = -w + dh22 * z__; -/* L40: */ - } - goto L140; -L50: - dh11 = dparam[2]; - dh12 = dparam[4]; - dh21 = dparam[3]; - dh22 = dparam[5]; - i__1 = nsteps; - i__2 = incx; - for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) { - w = dx[i__]; - z__ = dy[i__]; - dx[i__] = w * dh11 + z__ * dh12; - dy[i__] = w * dh21 + z__ * dh22; -/* L60: */ - } - goto L140; -L70: - kx = 1; - ky = 1; - if (incx < 0) { - kx = (1 - n) * incx + 1; - } - if (incy < 0) { - ky = (1 - n) * incy + 1; - } - - if (dflag < 0.) { - goto L120; - } else if (dflag == 0) { - goto L80; - } else { - goto L100; - } -L80: - dh12 = dparam[4]; - dh21 = dparam[3]; - i__2 = n; - for (i__ = 1; i__ <= i__2; ++i__) { - w = dx[kx]; - z__ = dy[ky]; - dx[kx] = w + z__ * dh12; - dy[ky] = w * dh21 + z__; - kx += incx; - ky += incy; -/* L90: */ - } - goto L140; -L100: - dh11 = dparam[2]; - dh22 = dparam[5]; - i__2 = n; - for (i__ = 1; i__ <= i__2; ++i__) { - w = dx[kx]; - z__ = dy[ky]; - dx[kx] = w * dh11 + z__; - dy[ky] = -w + dh22 * z__; - kx += incx; - ky += incy; -/* L110: */ - } - goto L140; -L120: - dh11 = dparam[2]; - dh12 = dparam[4]; - dh21 = dparam[3]; - dh22 = dparam[5]; - i__2 = n; - for (i__ = 1; i__ <= i__2; ++i__) { - w = dx[kx]; - z__ = dy[ky]; - dx[kx] = w * dh11 + z__ * dh12; - dy[ky] = w * dh21 + z__ * dh22; - kx += incx; - ky += incy; -/* L130: */ - } -L140: - return; -} - diff --git a/interface/rotmg.c b/interface/rotmg.c deleted file mode 100644 index 4dbb580eb..000000000 --- a/interface/rotmg.c +++ /dev/null @@ -1,235 +0,0 @@ -/*************************************************************************** -Copyright (c) 2013, The OpenBLAS Project -All rights reserved. -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. -2. 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. -3. Neither the name of the OpenBLAS project 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 OPENBLAS PROJECT 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. -*****************************************************************************/ - -/************************************************************************************** -* 2014/05/02 Saar -* fixed two bugs as reported by Brendan Tracey -* Test with lapack-3.5.0 : OK -* -**************************************************************************************/ - - -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#define GAM 4096.e0 -#define GAMSQ 16777216.e0 -#define RGAMSQ 5.9604645e-8 - -#define TWO 2.e0 - -#ifdef DOUBLE -#define ABS(x) fabs(x) -#else -#define ABS(x) fabsf(x) -#endif - -#ifndef CBLAS - -void NAME(FLOAT *dd1, FLOAT *dd2, FLOAT *dx1, FLOAT *DY1, FLOAT *dparam){ - - FLOAT dy1 = *DY1; - -#else - -void CNAME(FLOAT *dd1, FLOAT *dd2, FLOAT *dx1, FLOAT dy1, FLOAT *dparam){ - -#endif - - FLOAT du, dp1, dp2, dq2, dq1, dh11, dh21, dh12, dh22, dflag, dtemp; - - if(*dd1 < ZERO) - { - dflag = -ONE; - dh11 = ZERO; - dh12 = ZERO; - dh21 = ZERO; - dh22 = ZERO; - - *dd1 = ZERO; - *dd2 = ZERO; - *dx1 = ZERO; - } - else - { - dp2 = *dd2 * dy1; - if(dp2 == ZERO) - { - dflag = -TWO; - dparam[0] = dflag; - return; - } - dp1 = *dd1 * *dx1; - dq2 = dp2 * dy1; - dq1 = dp1 * *dx1; - if(ABS(dq1) > ABS(dq2)) - { - dh21 = - dy1 / *dx1; - dh12 = dp2 / dp1; - - du = ONE - dh12 * dh21; - if(du > ZERO) - { - dflag = ZERO; - *dd1 = *dd1 / du; - *dd2 = *dd2 / du; - *dx1 = *dx1 * du; - - } - } - else - { - if(dq2 < ZERO) - { - dflag = -ONE; - - dh11 = ZERO; - dh12 = ZERO; - dh21 = ZERO; - dh22 = ZERO; - - *dd1 = ZERO; - *dd2 = ZERO; - *dx1 = ZERO; - } - else - { - dflag = ONE; - - dh11 = dp1 / dp2; - dh22 = *dx1 / dy1; - du = ONE + dh11 * dh22; - dtemp = *dd2 / du; - - *dd2 = *dd1 / du; - *dd1 = dtemp; - *dx1 = dy1 * du; - } - } - - - if(*dd1 != ZERO) - { - while( (*dd1 <= RGAMSQ) || (*dd1 >= GAMSQ) ) - { - if(dflag == ZERO) - { - dh11 = ONE; - dh22 = ONE; - dflag = -ONE; - } - else - { - if(dflag == ONE) - { - dh21 = -ONE; - dh12 = ONE; - dflag = -ONE; - } - } - if( *dd1 <= RGAMSQ ) - { - *dd1 = *dd1 * (GAM * GAM); - *dx1 = *dx1 / GAM; - dh11 = dh11 / GAM; - dh12 = dh12 / GAM; - } - else - { - *dd1 = *dd1 / (GAM * GAM); - *dx1 = *dx1 * GAM; - dh11 = dh11 * GAM; - dh12 = dh12 * GAM; - } - } - } - - if(*dd2 != ZERO) - { - while( (ABS(*dd2) <= RGAMSQ) || (ABS(*dd2) >= GAMSQ) ) - { - if(dflag == ZERO) - { - dh11 = ONE; - dh22 = ONE; - dflag = -ONE; - } - else - { - if(dflag == ONE) - { - dh21 = -ONE; - dh12 = ONE; - dflag = -ONE; - } - } - if( ABS(*dd2) <= RGAMSQ ) - { - *dd2 = *dd2 * (GAM * GAM); - dh21 = dh21 / GAM; - dh22 = dh22 / GAM; - } - else - { - *dd2 = *dd2 / (GAM * GAM); - dh21 = dh21 * GAM; - dh22 = dh22 * GAM; - } - } - } - - } - - if(dflag < ZERO) - { - dparam[1] = dh11; - dparam[2] = dh21; - dparam[3] = dh12; - dparam[4] = dh22; - } - else - { - if(dflag == ZERO) - { - dparam[2] = dh21; - dparam[3] = dh12; - } - else - { - dparam[1] = dh11; - dparam[4] = dh22; - } - } - - - dparam[0] = dflag; - return; -} - - diff --git a/interface/sbmv.c b/interface/sbmv.c deleted file mode 100644 index 2ffe7f166..000000000 --- a/interface/sbmv.c +++ /dev/null @@ -1,215 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QSBMV " -#elif defined(DOUBLE) -#define ERROR_NAME "DSBMV " -#else -#define ERROR_NAME "SSBMV " -#endif - -static int (*sbmv[])(BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { -#ifdef XDOUBLE - qsbmv_U, qsbmv_L, -#elif defined(DOUBLE) - dsbmv_U, dsbmv_L, -#else - ssbmv_U, ssbmv_L, -#endif -}; - -#ifdef SMP -static int (*sbmv_thread[])(BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { -#ifdef XDOUBLE - qsbmv_thread_U, qsbmv_thread_L, -#elif defined(DOUBLE) - dsbmv_thread_U, dsbmv_thread_L, -#else - ssbmv_thread_U, ssbmv_thread_L, -#endif -}; -#endif - -#ifndef CBLAS - -void NAME(char *UPLO, blasint *N, blasint *K, FLOAT *ALPHA, FLOAT *a, blasint *LDA, - FLOAT *x, blasint *INCX, FLOAT *BETA, FLOAT *y, blasint *INCY){ - - char uplo_arg = *UPLO; - blasint n = *N; - blasint k = *K; - FLOAT alpha = *ALPHA; - blasint lda = *LDA; - blasint incx = *INCX; - FLOAT beta = *BETA; - blasint incy = *INCY; - - blasint info; - int uplo; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - uplo = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incy == 0) info = 11; - if (incx == 0) info = 8; - if (lda < k + 1) info = 6; - if (k < 0) info = 3; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, - enum CBLAS_UPLO Uplo, - blasint n, blasint k, - FLOAT alpha, - FLOAT *a, blasint lda, - FLOAT *x, blasint incx, - FLOAT beta, - FLOAT *y, blasint incy){ - - FLOAT *buffer; - int uplo; - blasint info; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_CNAME; - - uplo = -1; - info = 0; - - if (order == CblasColMajor) { - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - info = -1; - - if (incy == 0) info = 11; - if (incx == 0) info = 8; - if (lda < k + 1) info = 6; - if (k < 0) info = 3; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - info = -1; - - if (incy == 0) info = 11; - if (incx == 0) info = 8; - if (lda < k + 1) info = 6; - if (k < 0) info = 3; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - if (beta != ONE) SCAL_K(n, 0, 0, beta, y, abs(incy), NULL, 0, NULL, 0); - - if (alpha == ZERO) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx; - if (incy < 0 ) y -= (n - 1) * incy; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (sbmv[uplo])(n, k, alpha, a, lda, x, incx, y, incy, buffer); - -#ifdef SMP - } else { - - (sbmv_thread[uplo])(n, k, alpha, a, lda, x, incx, y, incy, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(1, n * k / 2 + n, n * k); - - IDEBUG_END; - - return; -} diff --git a/interface/scal.c b/interface/scal.c deleted file mode 100644 index 7b72ca01c..000000000 --- a/interface/scal.c +++ /dev/null @@ -1,112 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifndef CBLAS - -void NAME(blasint *N, FLOAT *ALPHA, FLOAT *x, blasint *INCX){ - - blasint n = *N; - blasint incx = *INCX; - FLOAT alpha = *ALPHA; - -#else - -void CNAME(blasint n, FLOAT alpha, FLOAT *x, blasint incx){ - -#endif - -#ifdef SMP - int mode, nthreads; -#endif - -#ifndef CBLAS - PRINT_DEBUG_NAME; -#else - PRINT_DEBUG_CNAME; -#endif - - if (incx <= 0 || n <= 0) return; - - if (alpha == ONE) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - -#ifdef SMP - nthreads = num_cpu_avail(1); - - if (nthreads == 1) { -#endif - - SCAL_K(n, 0, 0, alpha, x, incx, NULL, 0, NULL, 0); - -#ifdef SMP - } else { - -#ifdef DOUBLE - mode = BLAS_DOUBLE | BLAS_REAL; -#else - mode = BLAS_SINGLE | BLAS_REAL; -#endif - - blas_level1_thread(mode, n, 0, 0, -#ifndef CBLAS - ALPHA, -#else - &alpha, -#endif - x, incx, NULL, 0, NULL, 0, (void *)SCAL_K, nthreads); - - } -#endif - - FUNCTION_PROFILE_END(1, n, n); - - IDEBUG_END; - - return; - -} diff --git a/interface/sdsdot.c b/interface/sdsdot.c deleted file mode 100644 index 168468c3a..000000000 --- a/interface/sdsdot.c +++ /dev/null @@ -1,101 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifndef CBLAS - -FLOATRET NAME(blasint *N, FLOAT *a, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){ - - BLASLONG n = *N; - BLASLONG incx = *INCX; - BLASLONG incy = *INCY; - FLOATRET ret; - - PRINT_DEBUG_NAME; - - if (n <= 0) return(*a) ; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0) x -= (n - 1) * incx; - if (incy < 0) y -= (n - 1) * incy; - - ret = (FLOATRET)(SDSDOT_K(n, x, incx, y, incy) + *a); - - FUNCTION_PROFILE_END(1, 2 * n, 2 * n); - - IDEBUG_END; - - return ret; - -} - -#else - -FLOAT CNAME(blasint n, FLOAT alpha, FLOAT *x, blasint incx, FLOAT *y, blasint incy){ - - FLOAT ret; - - PRINT_DEBUG_CNAME; - - if (n <= 0) return (alpha); - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0) x -= (n - 1) * incx; - if (incy < 0) y -= (n - 1) * incy; - - ret = SDSDOT_K(n, x, incx, y, incy) + alpha; - - FUNCTION_PROFILE_END(1, 2 * n, 2 * n); - - IDEBUG_END; - - return ret; -} - -#endif diff --git a/interface/spmv.c b/interface/spmv.c deleted file mode 100644 index 8d8902763..000000000 --- a/interface/spmv.c +++ /dev/null @@ -1,207 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QSPMV " -#elif defined(DOUBLE) -#define ERROR_NAME "DSPMV " -#else -#define ERROR_NAME "SSPMV " -#endif - -static int (*spmv[])(BLASLONG, FLOAT, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { -#ifdef XDOUBLE - qspmv_U, qspmv_L, -#elif defined(DOUBLE) - dspmv_U, dspmv_L, -#else - sspmv_U, sspmv_L, -#endif -}; - -#ifdef SMP -static int (*spmv_thread[])(BLASLONG, FLOAT, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { -#ifdef XDOUBLE - qspmv_thread_U, qspmv_thread_L, -#elif defined(DOUBLE) - dspmv_thread_U, dspmv_thread_L, -#else - sspmv_thread_U, sspmv_thread_L, -#endif -}; -#endif - -#ifndef CBLAS - -void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, - FLOAT *x, blasint *INCX, FLOAT *BETA, FLOAT *y, blasint *INCY){ - - char uplo_arg = *UPLO; - blasint n = *N; - FLOAT alpha = *ALPHA; - blasint incx = *INCX; - FLOAT beta = *BETA; - blasint incy = *INCY; - - blasint info; - int uplo; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - uplo = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incy == 0) info = 9; - if (incx == 0) info = 6; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, - enum CBLAS_UPLO Uplo, - blasint n, - FLOAT alpha, - FLOAT *a, - FLOAT *x, blasint incx, - FLOAT beta, - FLOAT *y, blasint incy){ - - FLOAT *buffer; - int uplo; - blasint info; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_CNAME; - - uplo = -1; - info = 0; - - if (order == CblasColMajor) { - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - info = -1; - - if (incy == 0) info = 9; - if (incx == 0) info = 6; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - info = -1; - - if (incy == 0) info = 9; - if (incx == 0) info = 6; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - if (beta != ONE) SCAL_K(n, 0, 0, beta, y, abs(incy), NULL, 0, NULL, 0); - - if (alpha == ZERO) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx; - if (incy < 0 ) y -= (n - 1) * incy; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (spmv[uplo])(n, alpha, a, x, incx, y, incy, buffer); - -#ifdef SMP - } else { - - (spmv_thread[uplo])(n, alpha, a, x, incx, y, incy, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(1, n * n / 2 + n, n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/spr.c b/interface/spr.c deleted file mode 100644 index aa2ff8f3f..000000000 --- a/interface/spr.c +++ /dev/null @@ -1,197 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QSPR " -#elif defined(DOUBLE) -#define ERROR_NAME "DSPR " -#else -#define ERROR_NAME "SSPR " -#endif - -static int (*spr[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, FLOAT *) = { -#ifdef XDOUBLE - qspr_U, qspr_L, -#elif defined(DOUBLE) - dspr_U, dspr_L, -#else - sspr_U, sspr_L, -#endif -}; - -#ifdef SMP -static int (*spr_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = { -#ifdef XDOUBLE - qspr_thread_U, qspr_thread_L, -#elif defined(DOUBLE) - dspr_thread_U, dspr_thread_L, -#else - sspr_thread_U, sspr_thread_L, -#endif -}; -#endif - -#ifndef CBLAS - -void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, - FLOAT *x, blasint *INCX, FLOAT *a){ - - char uplo_arg = *UPLO; - blasint n = *N; - FLOAT alpha = *ALPHA; - blasint incx = *INCX; - - blasint info; - int uplo; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - uplo = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, - enum CBLAS_UPLO Uplo, - blasint n, - FLOAT alpha, - FLOAT *x, blasint incx, - FLOAT *a) { - - FLOAT *buffer; - int uplo; - blasint info; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_CNAME; - - uplo = -1; - info = 0; - - if (order == CblasColMajor) { - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - info = -1; - - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - info = -1; - - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - if (alpha == ZERO) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (spr[uplo])(n, alpha, x, incx, a, buffer); - -#ifdef SMP - } else { - - (spr_thread[uplo])(n, alpha, x, incx, a, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(1, n * n / 2 + n, n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/spr2.c b/interface/spr2.c deleted file mode 100644 index e556d3fa8..000000000 --- a/interface/spr2.c +++ /dev/null @@ -1,203 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QSPR2 " -#elif defined(DOUBLE) -#define ERROR_NAME "DSPR2 " -#else -#define ERROR_NAME "SSPR2 " -#endif - -static int (*spr2[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, FLOAT *) = { -#ifdef XDOUBLE - qspr2_U, qspr2_L, -#elif defined(DOUBLE) - dspr2_U, dspr2_L, -#else - sspr2_U, sspr2_L, -#endif -}; - -#ifdef SMP -static int (*spr2_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = { -#ifdef XDOUBLE - qspr2_thread_U, qspr2_thread_L, -#elif defined(DOUBLE) - dspr2_thread_U, dspr2_thread_L, -#else - sspr2_thread_U, sspr2_thread_L, -#endif -}; -#endif - -#ifndef CBLAS - -void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, - FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *a){ - - char uplo_arg = *UPLO; - blasint n = *N; - FLOAT alpha = *ALPHA; - blasint incx = *INCX; - blasint incy = *INCY; - - blasint info; - int uplo; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - uplo = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incy == 0) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, - enum CBLAS_UPLO Uplo, - blasint n, - FLOAT alpha, - FLOAT *x, blasint incx, - FLOAT *y, blasint incy, - FLOAT *a) { - - FLOAT *buffer; - int uplo; - blasint info; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_CNAME; - - uplo = -1; - info = 0; - - if (order == CblasColMajor) { - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - info = -1; - - if (incy == 0) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - info = -1; - - if (incy == 0) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - if (alpha == ZERO) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx; - if (incy < 0 ) y -= (n - 1) * incy; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (spr2[uplo])(n, alpha, x, incx, y, incy, a, buffer); - -#ifdef SMP - } else { - - (spr2_thread[uplo])(n, alpha, x, incx, y, incy, a, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(1, n * n / 2 + 2 * n, 2 * n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/swap.c b/interface/swap.c deleted file mode 100644 index 271fa083a..000000000 --- a/interface/swap.c +++ /dev/null @@ -1,115 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifndef CBLAS - -void NAME(blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){ - - blasint n = *N; - blasint incx = *INCX; - blasint incy = *INCY; - -#else - -void CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy){ - -#endif - -#ifdef SMP - int mode, nthreads; - FLOAT dummyalpha[2] = {ZERO, ZERO}; -#endif - -#ifndef CBLAS - PRINT_DEBUG_NAME; -#else - PRINT_DEBUG_CNAME; -#endif - - if (n <= 0) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0) x -= (n - 1) * incx; - if (incy < 0) y -= (n - 1) * incy; - -#ifdef SMP - nthreads = num_cpu_avail(1); - - //disable multi-thread when incx==0 or incy==0 - //In that case, the threads would be dependent. - if (incx == 0 || incy == 0) - nthreads = 1; - - if (nthreads == 1) { -#endif - - SWAP_K(n, 0, 0, ZERO, x, incx, y, incy, NULL, 0); - -#ifdef SMP - } else { - -#ifdef XDOUBLE - mode = BLAS_XDOUBLE | BLAS_REAL; -#elif defined(DOUBLE) - mode = BLAS_DOUBLE | BLAS_REAL; -#else - mode = BLAS_SINGLE | BLAS_REAL; -#endif - - blas_level1_thread(mode, n, 0, 0, dummyalpha, - x, incx, y, incy, NULL, 0, (void *)SWAP_K, nthreads); - } - -#endif - - FUNCTION_PROFILE_END(1, 2 * n, 0); - - IDEBUG_END; - - return; - -} diff --git a/interface/symm.c b/interface/symm.c deleted file mode 100644 index b447f13e8..000000000 --- a/interface/symm.c +++ /dev/null @@ -1,442 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifndef COMPLEX -#ifdef XDOUBLE -#define ERROR_NAME "QSYMM " -#elif defined(DOUBLE) -#define ERROR_NAME "DSYMM " -#else -#define ERROR_NAME "SSYMM " -#endif -#else -#ifndef GEMM3M -#ifndef HEMM -#ifdef XDOUBLE -#define ERROR_NAME "XSYMM " -#elif defined(DOUBLE) -#define ERROR_NAME "ZSYMM " -#else -#define ERROR_NAME "CSYMM " -#endif -#else -#ifdef XDOUBLE -#define ERROR_NAME "XHEMM " -#elif defined(DOUBLE) -#define ERROR_NAME "ZHEMM " -#else -#define ERROR_NAME "CHEMM " -#endif -#endif -#else -#ifndef HEMM -#ifdef XDOUBLE -#define ERROR_NAME "XSYMM3M " -#elif defined(DOUBLE) -#define ERROR_NAME "ZSYMM3M " -#else -#define ERROR_NAME "CSYMM3M " -#endif -#else -#ifdef XDOUBLE -#define ERROR_NAME "XHEMM3M " -#elif defined(DOUBLE) -#define ERROR_NAME "ZHEMM3M " -#else -#define ERROR_NAME "CHEMM3M " -#endif -#endif -#endif -#endif - -static int (*symm[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { -#ifndef GEMM3M -#ifndef HEMM - SYMM_LU, SYMM_LL, SYMM_RU, SYMM_RL, -#if defined(SMP) && !defined(USE_SIMPLE_THREADED_LEVEL3) - SYMM_THREAD_LU, SYMM_THREAD_LL, SYMM_THREAD_RU, SYMM_THREAD_RL, -#endif -#else - HEMM_LU, HEMM_LL, HEMM_RU, HEMM_RL, -#if defined(SMP) && !defined(USE_SIMPLE_THREADED_LEVEL3) - HEMM_THREAD_LU, HEMM_THREAD_LL, HEMM_THREAD_RU, HEMM_THREAD_RL, -#endif -#endif -#else -#ifndef HEMM - SYMM3M_LU, SYMM3M_LL, SYMM3M_RU, SYMM3M_RL, -#if defined(SMP) && !defined(USE_SIMPLE_THREADED_LEVEL3) - SYMM3M_THREAD_LU, SYMM3M_THREAD_LL, SYMM3M_THREAD_RU, SYMM3M_THREAD_RL, -#endif -#else - HEMM3M_LU, HEMM3M_LL, HEMM3M_RU, HEMM3M_RL, -#if defined(SMP) && !defined(USE_SIMPLE_THREADED_LEVEL3) - HEMM3M_THREAD_LU, HEMM3M_THREAD_LL, HEMM3M_THREAD_RU, HEMM3M_THREAD_RL, -#endif -#endif -#endif -}; - -#ifndef CBLAS - -void NAME(char *SIDE, char *UPLO, - blasint *M, blasint *N, - FLOAT *alpha, FLOAT *a, blasint *ldA, - FLOAT *b, blasint *ldB, - FLOAT *beta, FLOAT *c, blasint *ldC){ - - char side_arg = *SIDE; - char uplo_arg = *UPLO; - - blas_arg_t args; - - FLOAT *buffer; - FLOAT *sa, *sb; - -#ifdef SMP -#ifndef COMPLEX -#ifdef XDOUBLE - int mode = BLAS_XDOUBLE | BLAS_REAL; -#elif defined(DOUBLE) - int mode = BLAS_DOUBLE | BLAS_REAL; -#else - int mode = BLAS_SINGLE | BLAS_REAL; -#endif -#else -#ifdef XDOUBLE - int mode = BLAS_XDOUBLE | BLAS_COMPLEX; -#elif defined(DOUBLE) - int mode = BLAS_DOUBLE | BLAS_COMPLEX; -#else - int mode = BLAS_SINGLE | BLAS_COMPLEX; -#endif -#endif -#endif - -#if defined(SMP) && !defined(NO_AFFINITY) - int nodes; -#endif - - blasint info; - int side; - int uplo; - - PRINT_DEBUG_NAME; - - args.alpha = (void *)alpha; - args.beta = (void *)beta; - - TOUPPER(side_arg); - TOUPPER(uplo_arg); - - side = -1; - uplo = -1; - - if (side_arg == 'L') side = 0; - if (side_arg == 'R') side = 1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - args.m = *M; - args.n = *N; - - args.c = (void *)c; - args.ldc = *ldC; - - info = 0; - - if (args.ldc < MAX(1, args.m)) info = 12; - - if (!side) { - args.a = (void *)a; - args.b = (void *)b; - - args.lda = *ldA; - args.ldb = *ldB; - - if (args.ldb < MAX(1, args.m)) info = 9; - if (args.lda < MAX(1, args.m)) info = 7; - - } else { - args.a = (void *)b; - args.b = (void *)a; - - args.lda = *ldB; - args.ldb = *ldA; - - if (args.lda < MAX(1, args.m)) info = 9; - if (args.ldb < MAX(1, args.n)) info = 7; - } - - if (args.n < 0) info = 4; - if (args.m < 0) info = 3; - if (uplo < 0) info = 2; - if (side < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_SIDE Side, enum CBLAS_UPLO Uplo, - blasint m, blasint n, -#ifndef COMPLEX - FLOAT alpha, -#else - FLOAT *alpha, -#endif - FLOAT *a, blasint lda, - FLOAT *b, blasint ldb, -#ifndef COMPLEX - FLOAT beta, -#else - FLOAT *beta, -#endif - FLOAT *c, blasint ldc) { - - blas_arg_t args; - int side, uplo; - blasint info; - - FLOAT *buffer; - FLOAT *sa, *sb; - -#ifdef SMP -#ifndef COMPLEX -#ifdef XDOUBLE - int mode = BLAS_XDOUBLE | BLAS_REAL; -#elif defined(DOUBLE) - int mode = BLAS_DOUBLE | BLAS_REAL; -#else - int mode = BLAS_SINGLE | BLAS_REAL; -#endif -#else -#ifdef XDOUBLE - int mode = BLAS_XDOUBLE | BLAS_COMPLEX; -#elif defined(DOUBLE) - int mode = BLAS_DOUBLE | BLAS_COMPLEX; -#else - int mode = BLAS_SINGLE | BLAS_COMPLEX; -#endif -#endif -#endif - -#if defined(SMP) && !defined(NO_AFFINITY) - int nodes; -#endif - - PRINT_DEBUG_CNAME; - -#ifndef COMPLEX - args.alpha = (void *)α - args.beta = (void *)β -#else - args.alpha = (void *)alpha; - args.beta = (void *)beta; -#endif - - args.c = (void *)c; - args.ldc = ldc; - - side = -1; - uplo = -1; - info = 0; - - if (order == CblasColMajor) { - if (Side == CblasLeft) side = 0; - if (Side == CblasRight) side = 1; - - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - info = -1; - - args.m = m; - args.n = n; - - if (args.ldc < MAX(1, args.m)) info = 12; - - if (!side) { - args.a = (void *)a; - args.b = (void *)b; - - args.lda = lda; - args.ldb = ldb; - - if (args.ldb < MAX(1, args.m)) info = 9; - if (args.lda < MAX(1, args.m)) info = 7; - - } else { - args.a = (void *)b; - args.b = (void *)a; - - args.lda = ldb; - args.ldb = lda; - - if (args.lda < MAX(1, args.m)) info = 9; - if (args.ldb < MAX(1, args.n)) info = 7; - } - - if (args.n < 0) info = 4; - if (args.m < 0) info = 3; - if (uplo < 0) info = 2; - if (side < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (Side == CblasLeft) side = 1; - if (Side == CblasRight) side = 0; - - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - info = -1; - - args.m = n; - args.n = m; - - if (args.ldc < MAX(1, args.m)) info = 12; - - if (!side) { - args.a = (void *)a; - args.b = (void *)b; - - args.lda = lda; - args.ldb = ldb; - - if (args.ldb < MAX(1, args.m)) info = 9; - if (args.lda < MAX(1, args.m)) info = 7; - - } else { - args.a = (void *)b; - args.b = (void *)a; - - args.lda = ldb; - args.ldb = lda; - - if (args.lda < MAX(1, args.m)) info = 9; - if (args.ldb < MAX(1, args.n)) info = 7; - } - - if (args.n < 0) info = 4; - if (args.m < 0) info = 3; - if (uplo < 0) info = 2; - if (side < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (args.m == 0 || args.n == 0) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - buffer = (FLOAT *)blas_memory_alloc(0); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); - -#ifdef SMP - args.common = NULL; - args.nthreads = num_cpu_avail(3); - - if (args.nthreads == 1) { -#endif - - (symm[(side << 1) | uplo ])(&args, NULL, NULL, sa, sb, 0); - -#ifdef SMP - - } else { - -#ifndef NO_AFFINITY - nodes = get_num_nodes(); - - if (nodes > 1) { - - args.nthreads /= nodes; - - gemm_thread_mn(mode, &args, NULL, NULL, - symm[4 | (side << 1) | uplo ], sa, sb, nodes); - - } else { -#endif - -#ifndef USE_SIMPLE_THREADED_LEVEL3 - - (symm[4 | (side << 1) | uplo ])(&args, NULL, NULL, sa, sb, 0); - -#else - - GEMM_THREAD(mode, &args, NULL, NULL, symm[(side << 1) | uplo ], sa, sb, args.nthreads); - -#endif - -#ifndef NO_AFFINITY - } -#endif - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, - (!side)? args.m * (args.m / 2 + args.n) : args.n * (args.m + args.n / 2), - (!side)? 2 * args.m * args.m * args.n : 2 * args.m * args.n * args.n); - - IDEBUG_END; - - return; -} diff --git a/interface/symv.c b/interface/symv.c deleted file mode 100644 index e8c24df66..000000000 --- a/interface/symv.c +++ /dev/null @@ -1,205 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QSYMV " -#elif defined(DOUBLE) -#define ERROR_NAME "DSYMV " -#else -#define ERROR_NAME "SSYMV " -#endif - -#ifndef CBLAS - -void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, blasint *LDA, - FLOAT *x, blasint *INCX, FLOAT *BETA, FLOAT *y, blasint *INCY){ - - char uplo_arg = *UPLO; - blasint n = *N; - FLOAT alpha = *ALPHA; - blasint lda = *LDA; - blasint incx = *INCX; - FLOAT beta = *BETA; - blasint incy = *INCY; - - int (*symv[])(BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { - SYMV_U, SYMV_L, - }; - -#ifdef SMP - int (*symv_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { - SYMV_THREAD_U, SYMV_THREAD_L, - }; -#endif - - blasint info; - int uplo; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - uplo = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incy == 0) info = 10; - if (incx == 0) info = 7; - if (lda < MAX(1, n)) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, - FLOAT *a, blasint lda, FLOAT *x, blasint incx, FLOAT beta, FLOAT *y, blasint incy) { - - FLOAT *buffer; - int uplo; - blasint info; -#ifdef SMP - int nthreads; -#endif - - int (*symv[])(BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { - SYMV_U, SYMV_L, - }; - -#ifdef SMP - int (*symv_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { - SYMV_THREAD_U, SYMV_THREAD_L, - }; -#endif - - PRINT_DEBUG_CNAME; - - uplo = -1; - info = 0; - - if (order == CblasColMajor) { - - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - info = -1; - - if (incy == 0) info = 10; - if (incx == 0) info = 7; - if (lda < MAX(1, n)) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - info = -1; - - if (incy == 0) info = 10; - if (incx == 0) info = 7; - if (lda < MAX(1, n)) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - if (beta != ONE) SCAL_K(n, 0, 0, beta, y, abs(incy), NULL, 0, NULL, 0); - - if (alpha == ZERO) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx; - if (incy < 0 ) y -= (n - 1) * incy; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (symv[uplo])(n, n, alpha, a, lda, x, incx, y, incy, buffer); - -#ifdef SMP - } else { - - (symv_thread[uplo])(n, alpha, a, lda, x, incx, y, incy, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(1, n * n / 2 + 2 * n, 2 * n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/syr.c b/interface/syr.c deleted file mode 100644 index 2b2d3d1e2..000000000 --- a/interface/syr.c +++ /dev/null @@ -1,200 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QSYR " -#elif defined(DOUBLE) -#define ERROR_NAME "DSYR " -#else -#define ERROR_NAME "SSYR " -#endif - -static int (*syr[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { -#ifdef XDOUBLE - qsyr_U, qsyr_L, -#elif defined(DOUBLE) - dsyr_U, dsyr_L, -#else - ssyr_U, ssyr_L, -#endif -}; - -#ifdef SMP -static int (*syr_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { -#ifdef XDOUBLE - qsyr_thread_U, qsyr_thread_L, -#elif defined(DOUBLE) - dsyr_thread_U, dsyr_thread_L, -#else - ssyr_thread_U, ssyr_thread_L, -#endif -}; -#endif - -#ifndef CBLAS - -void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, - FLOAT *x, blasint *INCX, FLOAT *a, blasint *LDA){ - - char uplo_arg = *UPLO; - blasint n = *N; - FLOAT alpha = *ALPHA; - blasint lda = *LDA; - blasint incx = *INCX; - - blasint info; - int uplo; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - uplo = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (lda < MAX(1, n)) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, FLOAT *x, blasint incx, FLOAT *a, blasint lda) { - - FLOAT *buffer; - int trans, uplo; - blasint info; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_CNAME; - - trans = -1; - uplo = -1; - info = 0; - - if (order == CblasColMajor) { - - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - info = -1; - - if (lda < MAX(1, n)) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - } - - if (order == CblasRowMajor) { - - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - info = -1; - - if (lda < MAX(1, n)) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - if (alpha == ZERO) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (syr[uplo])(n, alpha, x, incx, a, lda, buffer); - -#ifdef SMP - } else { - - (syr_thread[uplo])(n, alpha, x, incx, a, lda, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(1, n * n / 2 + n, n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/syr2.c b/interface/syr2.c deleted file mode 100644 index 15dbae4bd..000000000 --- a/interface/syr2.c +++ /dev/null @@ -1,204 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QSYR2 " -#elif defined(DOUBLE) -#define ERROR_NAME "DSYR2 " -#else -#define ERROR_NAME "SSYR2 " -#endif - -static int (*syr2[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { -#ifdef XDOUBLE - qsyr2_U, qsyr2_L, -#elif defined(DOUBLE) - dsyr2_U, dsyr2_L, -#else - ssyr2_U, ssyr2_L, -#endif -}; - -#ifdef SMP -static int (*syr2_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { -#ifdef XDOUBLE - qsyr2_thread_U, qsyr2_thread_L, -#elif defined(DOUBLE) - dsyr2_thread_U, dsyr2_thread_L, -#else - ssyr2_thread_U, ssyr2_thread_L, -#endif -}; -#endif - -#ifndef CBLAS - -void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, - FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *a, blasint *LDA){ - - char uplo_arg = *UPLO; - blasint n = *N; - FLOAT alpha = *ALPHA; - blasint lda = *LDA; - blasint incx = *INCX; - blasint incy = *INCY; - - blasint info; - int uplo; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - uplo = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (lda < MAX(1, n)) info = 9; - if (incy == 0) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, FLOAT *x, blasint incx, FLOAT *y, blasint incy, FLOAT *a, blasint lda) { - - FLOAT *buffer; - int trans, uplo; - blasint info; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_CNAME; - - trans = -1; - uplo = -1; - info = 0; - - if (order == CblasColMajor) { - - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - info = -1; - - if (lda < MAX(1, n)) info = 9; - if (incy == 0) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - info = -1; - - if (lda < MAX(1, n)) info = 9; - if (incy == 0) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - if (alpha == ZERO) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx; - if (incy < 0 ) y -= (n - 1) * incy; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (syr2[uplo])(n, alpha, x, incx, y, incy, a, lda, buffer); - -#ifdef SMP - } else { - - (syr2_thread[uplo])(n, alpha, x, incx, y, incy, a, lda, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(1, n * n / 2 + 2 * n, 2 * n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/syr2k.c b/interface/syr2k.c deleted file mode 100644 index 381e088a6..000000000 --- a/interface/syr2k.c +++ /dev/null @@ -1,377 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifndef COMPLEX -#ifdef XDOUBLE -#define ERROR_NAME "QSYR2K" -#elif defined(DOUBLE) -#define ERROR_NAME "DSYR2K" -#else -#define ERROR_NAME "SSYR2K" -#endif -#else -#ifndef HEMM -#ifdef XDOUBLE -#define ERROR_NAME "XSYR2K" -#elif defined(DOUBLE) -#define ERROR_NAME "ZSYR2K" -#else -#define ERROR_NAME "CSYR2K" -#endif -#else -#ifdef XDOUBLE -#define ERROR_NAME "XHER2K" -#elif defined(DOUBLE) -#define ERROR_NAME "ZHER2K" -#else -#define ERROR_NAME "CHER2K" -#endif -#endif -#endif - -static int (*syr2k[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { -#ifndef HEMM - SYR2K_UN, SYR2K_UC, SYR2K_LN, SYR2K_LC, -#else - HER2K_UN, HER2K_UC, HER2K_LN, HER2K_LC, -#endif -}; - -#ifndef CBLAS - -void NAME(char *UPLO, char *TRANS, - blasint *N, blasint *K, - FLOAT *alpha, FLOAT *a, blasint *ldA, - FLOAT *b, blasint *ldB, - FLOAT *beta, FLOAT *c, blasint *ldC){ - - char uplo_arg = *UPLO; - char trans_arg = *TRANS; - - blas_arg_t args; - - FLOAT *buffer; - FLOAT *sa, *sb; - -#ifdef SMP -#ifndef COMPLEX -#ifdef XDOUBLE - int mode = BLAS_XDOUBLE | BLAS_REAL; -#elif defined(DOUBLE) - int mode = BLAS_DOUBLE | BLAS_REAL; -#else - int mode = BLAS_SINGLE | BLAS_REAL; -#endif -#else -#ifdef XDOUBLE - int mode = BLAS_XDOUBLE | BLAS_COMPLEX; -#elif defined(DOUBLE) - int mode = BLAS_DOUBLE | BLAS_COMPLEX; -#else - int mode = BLAS_SINGLE | BLAS_COMPLEX; -#endif -#endif -#endif - - blasint info; - int uplo; - int trans; - int nrowa; - - PRINT_DEBUG_NAME; - - args.n = *N; - args.k = *K; - - args.a = (void *)a; - args.b = (void *)b; - args.c = (void *)c; - - args.lda = *ldA; - args.ldb = *ldB; - args.ldc = *ldC; - - args.alpha = (void *)alpha; - args.beta = (void *)beta; - - TOUPPER(uplo_arg); - TOUPPER(trans_arg); - - uplo = -1; - trans = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - -#ifndef COMPLEX - if (trans_arg == 'N') trans = 0; - if (trans_arg == 'T') trans = 1; - if (trans_arg == 'C') trans = 1; -#else -#ifdef HEMM - if (trans_arg == 'N') trans = 0; - if (trans_arg == 'C') trans = 1; -#else - if (trans_arg == 'N') trans = 0; - if (trans_arg == 'T') trans = 1; -#endif - -#endif - - - nrowa = args.n; - if (trans & 1) nrowa = args.k; - - info = 0; - - if (args.ldc < MAX(1,args.n)) info = 12; - if (args.ldb < MAX(1,nrowa)) info = 9; - if (args.lda < MAX(1,nrowa)) info = 7; - if (args.k < 0) info = 4; - if (args.n < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, enum CBLAS_TRANSPOSE Trans, - blasint n, blasint k, -#ifndef COMPLEX - FLOAT alpha, -#else - FLOAT *alpha, -#endif - FLOAT *a, blasint lda, - FLOAT *b, blasint ldb, -#if !defined(COMPLEX) || defined(HEMM) - FLOAT beta, -#else - FLOAT *beta, -#endif - FLOAT *c, blasint ldc) { - - blas_arg_t args; - int uplo, trans; - blasint info, nrowa; - - FLOAT *buffer; - FLOAT *sa, *sb; - -#ifdef HEMM - FLOAT CAlpha[2]; -#endif - -#ifdef SMP -#ifndef COMPLEX -#ifdef XDOUBLE - int mode = BLAS_XDOUBLE | BLAS_REAL; -#elif defined(DOUBLE) - int mode = BLAS_DOUBLE | BLAS_REAL; -#else - int mode = BLAS_SINGLE | BLAS_REAL; -#endif -#else -#ifdef XDOUBLE - int mode = BLAS_XDOUBLE | BLAS_COMPLEX; -#elif defined(DOUBLE) - int mode = BLAS_DOUBLE | BLAS_COMPLEX; -#else - int mode = BLAS_SINGLE | BLAS_COMPLEX; -#endif -#endif -#endif - - PRINT_DEBUG_CNAME; - - args.n = n; - args.k = k; - - args.a = (void *)a; - args.b = (void *)b; - args.c = (void *)c; - - args.lda = lda; - args.ldb = ldb; - args.ldc = ldc; - -#ifndef COMPLEX - args.alpha = (void *)α -#else - args.alpha = (void *)alpha; -#endif - -#if !defined(COMPLEX) || defined(HEMM) - args.beta = (void *)β -#else - args.beta = (void *)beta; -#endif - - trans = -1; - uplo = -1; - info = 0; - - if (order == CblasColMajor) { - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - if (Trans == CblasNoTrans) trans = 0; -#ifndef COMPLEX - if (Trans == CblasTrans) trans = 1; - if (Trans == CblasConjNoTrans) trans = 0; - if (Trans == CblasConjTrans) trans = 1; -#elif !defined(HEMM) - if (Trans == CblasTrans) trans = 1; -#else - if (Trans == CblasConjTrans) trans = 1; -#endif - - info = -1; - - nrowa = args.n; - if (trans & 1) nrowa = args.k; - - if (args.ldc < MAX(1,args.n)) info = 12; - if (args.ldb < MAX(1,nrowa)) info = 9; - if (args.lda < MAX(1,nrowa)) info = 7; - if (args.k < 0) info = 4; - if (args.n < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - -#ifdef HEMM - CAlpha[0] = alpha[0]; - CAlpha[1] = -alpha[1]; - - args.alpha = (void *)CAlpha; -#endif - - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - if (Trans == CblasNoTrans) trans = 1; -#ifndef COMPLEX - if (Trans == CblasTrans) trans = 0; - if (Trans == CblasConjNoTrans) trans = 1; - if (Trans == CblasConjTrans) trans = 0; -#elif !defined(HEMM) - if (Trans == CblasTrans) trans = 0; -#else - if (Trans == CblasConjTrans) trans = 0; -#endif - - info = -1; - - nrowa = args.n; - if (trans & 1) nrowa = args.k; - - if (args.ldc < MAX(1,args.n)) info = 12; - if (args.ldb < MAX(1,nrowa)) info = 9; - if (args.lda < MAX(1,nrowa)) info = 7; - if (args.k < 0) info = 4; - if (args.n < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (args.n == 0) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - buffer = (FLOAT *)blas_memory_alloc(0); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); - -#ifdef SMP - if (!trans){ - mode |= (BLAS_TRANSA_N | BLAS_TRANSB_T); - } else { - mode |= (BLAS_TRANSA_T | BLAS_TRANSB_N); - } - - mode |= (uplo << BLAS_UPLO_SHIFT); - - args.common = NULL; - args.nthreads = num_cpu_avail(3); - - if (args.nthreads == 1) { -#endif - - (syr2k[(uplo << 1) | trans ])(&args, NULL, NULL, sa, sb, 0); - -#ifdef SMP - - } else { - - syrk_thread(mode, &args, NULL, NULL, syr2k[(uplo << 1) | trans ], sa, sb, args.nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, 2 * args.n * args.k + args.n * args.n, 2 * args.n * args.n * args.k); - - IDEBUG_END; - - return; -} diff --git a/interface/syrk.c b/interface/syrk.c deleted file mode 100644 index 072cc86f5..000000000 --- a/interface/syrk.c +++ /dev/null @@ -1,366 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifndef COMPLEX -#ifdef XDOUBLE -#define ERROR_NAME "QSYRK " -#elif defined(DOUBLE) -#define ERROR_NAME "DSYRK " -#else -#define ERROR_NAME "SSYRK " -#endif -#else -#ifndef HEMM -#ifdef XDOUBLE -#define ERROR_NAME "XSYRK " -#elif defined(DOUBLE) -#define ERROR_NAME "ZSYRK " -#else -#define ERROR_NAME "CSYRK " -#endif -#else -#ifdef XDOUBLE -#define ERROR_NAME "XHERK " -#elif defined(DOUBLE) -#define ERROR_NAME "ZHERK " -#else -#define ERROR_NAME "CHERK " -#endif -#endif -#endif - -static int (*syrk[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { -#ifndef HEMM - SYRK_UN, SYRK_UC, SYRK_LN, SYRK_LC, -#if defined(SMP) && !defined(USE_SIMPLE_THREADED_LEVEL3) - SYRK_THREAD_UN, SYRK_THREAD_UC, SYRK_THREAD_LN, SYRK_THREAD_LC, -#endif -#else - HERK_UN, HERK_UC, HERK_LN, HERK_LC, -#if defined(SMP) && !defined(USE_SIMPLE_THREADED_LEVEL3) - HERK_THREAD_UN, HERK_THREAD_UC, HERK_THREAD_LN, HERK_THREAD_LC, -#endif -#endif -}; - -#ifndef CBLAS - -void NAME(char *UPLO, char *TRANS, - blasint *N, blasint *K, - FLOAT *alpha, FLOAT *a, blasint *ldA, - FLOAT *beta, FLOAT *c, blasint *ldC){ - - char uplo_arg = *UPLO; - char trans_arg = *TRANS; - - blas_arg_t args; - - FLOAT *buffer; - FLOAT *sa, *sb; - -#ifdef SMP -#ifndef COMPLEX -#ifdef XDOUBLE - int mode = BLAS_XDOUBLE | BLAS_REAL; -#elif defined(DOUBLE) - int mode = BLAS_DOUBLE | BLAS_REAL; -#else - int mode = BLAS_SINGLE | BLAS_REAL; -#endif -#else -#ifdef XDOUBLE - int mode = BLAS_XDOUBLE | BLAS_COMPLEX; -#elif defined(DOUBLE) - int mode = BLAS_DOUBLE | BLAS_COMPLEX; -#else - int mode = BLAS_SINGLE | BLAS_COMPLEX; -#endif -#endif -#endif - - blasint info; - int uplo; - int trans; - int nrowa; - - PRINT_DEBUG_NAME; - - args.n = *N; - args.k = *K; - - args.a = (void *)a; - args.c = (void *)c; - - args.lda = *ldA; - args.ldc = *ldC; - - args.alpha = (void *)alpha; - args.beta = (void *)beta; - - TOUPPER(uplo_arg); - TOUPPER(trans_arg); - - uplo = -1; - trans = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - -#ifndef COMPLEX - if (trans_arg == 'N') trans = 0; - if (trans_arg == 'T') trans = 1; - if (trans_arg == 'C') trans = 1; -#else -#ifdef HEMM - if (trans_arg == 'N') trans = 0; - if (trans_arg == 'C') trans = 1; -#else - if (trans_arg == 'N') trans = 0; - if (trans_arg == 'T') trans = 1; -#endif - -#endif - - nrowa = args.n; - if (trans & 1) nrowa = args.k; - - info = 0; - - if (args.ldc < MAX(1,args.n)) info = 10; - if (args.lda < MAX(1,nrowa)) info = 7; - if (args.k < 0) info = 4; - if (args.n < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, enum CBLAS_TRANSPOSE Trans, - blasint n, blasint k, -#if !defined(COMPLEX) || defined(HEMM) - FLOAT alpha, -#else - FLOAT *alpha, -#endif - FLOAT *a, blasint lda, -#if !defined(COMPLEX) || defined(HEMM) - FLOAT beta, -#else - FLOAT *beta, -#endif - FLOAT *c, blasint ldc) { - - blas_arg_t args; - int uplo, trans; - blasint info, nrowa; - - FLOAT *buffer; - FLOAT *sa, *sb; - -#ifdef SMP -#ifndef COMPLEX -#ifdef XDOUBLE - int mode = BLAS_XDOUBLE | BLAS_REAL; -#elif defined(DOUBLE) - int mode = BLAS_DOUBLE | BLAS_REAL; -#else - int mode = BLAS_SINGLE | BLAS_REAL; -#endif -#else -#ifdef XDOUBLE - int mode = BLAS_XDOUBLE | BLAS_COMPLEX; -#elif defined(DOUBLE) - int mode = BLAS_DOUBLE | BLAS_COMPLEX; -#else - int mode = BLAS_SINGLE | BLAS_COMPLEX; -#endif -#endif -#endif - - PRINT_DEBUG_CNAME; - - args.n = n; - args.k = k; - - args.a = (void *)a; - args.c = (void *)c; - - args.lda = lda; - args.ldc = ldc; - -#if !defined(COMPLEX) || defined(HEMM) - args.alpha = (void *)α - args.beta = (void *)β -#else - args.alpha = (void *)alpha; - args.beta = (void *)beta; -#endif - - trans = -1; - uplo = -1; - info = 0; - - if (order == CblasColMajor) { - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - if (Trans == CblasNoTrans) trans = 0; -#ifndef COMPLEX - if (Trans == CblasTrans) trans = 1; - if (Trans == CblasConjNoTrans) trans = 0; - if (Trans == CblasConjTrans) trans = 1; -#elif !defined(HEMM) - if (Trans == CblasTrans) trans = 1; -#else - if (Trans == CblasConjTrans) trans = 1; -#endif - - info = -1; - - nrowa = args.n; - if (trans & 1) nrowa = args.k; - - if (args.ldc < MAX(1,args.n)) info = 10; - if (args.lda < MAX(1,nrowa)) info = 7; - if (args.k < 0) info = 4; - if (args.n < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - if (Trans == CblasNoTrans) trans = 1; -#ifndef COMPLEX - if (Trans == CblasTrans) trans = 0; - if (Trans == CblasConjNoTrans) trans = 1; - if (Trans == CblasConjTrans) trans = 0; -#elif !defined(HEMM) - if (Trans == CblasTrans) trans = 0; -#else - if (Trans == CblasConjTrans) trans = 0; -#endif - - info = -1; - - nrowa = args.n; - if (trans & 1) nrowa = args.k; - - if (args.ldc < MAX(1,args.n)) info = 10; - if (args.lda < MAX(1,nrowa)) info = 7; - if (args.k < 0) info = 4; - if (args.n < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (args.n == 0) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - buffer = (FLOAT *)blas_memory_alloc(0); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); - -#ifdef SMP - if (!trans){ - mode |= (BLAS_TRANSA_N | BLAS_TRANSB_T); - } else { - mode |= (BLAS_TRANSA_T | BLAS_TRANSB_N); - } - - mode |= (uplo << BLAS_UPLO_SHIFT); - - args.common = NULL; - args.nthreads = num_cpu_avail(3); - - if (args.nthreads == 1) { -#endif - - (syrk[(uplo << 1) | trans ])(&args, NULL, NULL, sa, sb, 0); - -#ifdef SMP - - } else { - -#ifndef USE_SIMPLE_THREADED_LEVEL3 - - (syrk[4 | (uplo << 1) | trans ])(&args, NULL, NULL, sa, sb, 0); - -#else - - syrk_thread(mode, &args, NULL, NULL, syrk[(uplo << 1) | trans ], sa, sb, args.nthreads); - -#endif - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.n * args.k + args.n * args.n / 2, args.n * args.n * args.k); - - IDEBUG_END; - - return; -} diff --git a/interface/tbmv.c b/interface/tbmv.c deleted file mode 100644 index cec2be465..000000000 --- a/interface/tbmv.c +++ /dev/null @@ -1,248 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QTBMV " -#elif defined(DOUBLE) -#define ERROR_NAME "DTBMV " -#else -#define ERROR_NAME "STBMV " -#endif - -static int (*tbmv[])(BLASLONG, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { -#ifdef XDOUBLE - qtbmv_NUU, qtbmv_NUN, qtbmv_NLU, qtbmv_NLN, - qtbmv_TUU, qtbmv_TUN, qtbmv_TLU, qtbmv_TLN, -#elif defined(DOUBLE) - dtbmv_NUU, dtbmv_NUN, dtbmv_NLU, dtbmv_NLN, - dtbmv_TUU, dtbmv_TUN, dtbmv_TLU, dtbmv_TLN, -#else - stbmv_NUU, stbmv_NUN, stbmv_NLU, stbmv_NLN, - stbmv_TUU, stbmv_TUN, stbmv_TLU, stbmv_TLN, -#endif -}; - -#ifdef SMP -static int (*tbmv_thread[])(BLASLONG, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { -#ifdef XDOUBLE - qtbmv_thread_NUU, qtbmv_thread_NUN, qtbmv_thread_NLU, qtbmv_thread_NLN, - qtbmv_thread_TUU, qtbmv_thread_TUN, qtbmv_thread_TLU, qtbmv_thread_TLN, -#elif defined(DOUBLE) - dtbmv_thread_NUU, dtbmv_thread_NUN, dtbmv_thread_NLU, dtbmv_thread_NLN, - dtbmv_thread_TUU, dtbmv_thread_TUN, dtbmv_thread_TLU, dtbmv_thread_TLN, -#else - stbmv_thread_NUU, stbmv_thread_NUN, stbmv_thread_NLU, stbmv_thread_NLN, - stbmv_thread_TUU, stbmv_thread_TUN, stbmv_thread_TLU, stbmv_thread_TLN, -#endif -}; -#endif - -#ifndef CBLAS - -void NAME(char *UPLO, char *TRANS, char *DIAG, - blasint *N, blasint *K, - FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){ - - char uplo_arg = *UPLO; - char trans_arg = *TRANS; - char diag_arg = *DIAG; - - blasint n = *N; - blasint k = *K; - blasint lda = *LDA; - blasint incx = *INCX; - - blasint info; - int uplo; - int unit; - int trans; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - TOUPPER(trans_arg); - TOUPPER(diag_arg); - - trans = -1; - unit = -1; - uplo = -1; - - if (trans_arg == 'N') trans = 0; - if (trans_arg == 'T') trans = 1; - if (trans_arg == 'R') trans = 0; - if (trans_arg == 'C') trans = 1; - - if (diag_arg == 'U') unit = 0; - if (diag_arg == 'N') unit = 1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incx == 0) info = 9; - if (lda < k + 1) info = 7; - if (k < 0) info = 5; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, - enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, - blasint n, blasint k, FLOAT *a, blasint lda, FLOAT *x, blasint incx) { - - int trans, uplo, unit; - blasint info; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_CNAME; - - unit = -1; - uplo = -1; - trans = -1; - info = 0; - - if (order == CblasColMajor) { - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - if (TransA == CblasNoTrans) trans = 0; - if (TransA == CblasTrans) trans = 1; - if (TransA == CblasConjNoTrans) trans = 0; - if (TransA == CblasConjTrans) trans = 1; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 9; - if (lda < k + 1) info = 7; - if (k < 0) info = 5; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - if (TransA == CblasNoTrans) trans = 1; - if (TransA == CblasTrans) trans = 0; - if (TransA == CblasConjNoTrans) trans = 1; - if (TransA == CblasConjTrans) trans = 0; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 9; - if (lda < k + 1) info = 7; - if (k < 0) info = 5; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (tbmv[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer); - -#ifdef SMP - } else { - - (tbmv_thread[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(1, n * k / 2 + n, n * k); - - IDEBUG_END; - - return; -} diff --git a/interface/tbsv.c b/interface/tbsv.c deleted file mode 100644 index a07c4c584..000000000 --- a/interface/tbsv.c +++ /dev/null @@ -1,213 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QTBSV " -#elif defined(DOUBLE) -#define ERROR_NAME "DTBSV " -#else -#define ERROR_NAME "STBSV " -#endif - -static int (*tbsv[])(BLASLONG, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { -#ifdef XDOUBLE - qtbsv_NUU, qtbsv_NUN, qtbsv_NLU, qtbsv_NLN, - qtbsv_TUU, qtbsv_TUN, qtbsv_TLU, qtbsv_TLN, -#elif defined(DOUBLE) - dtbsv_NUU, dtbsv_NUN, dtbsv_NLU, dtbsv_NLN, - dtbsv_TUU, dtbsv_TUN, dtbsv_TLU, dtbsv_TLN, -#else - stbsv_NUU, stbsv_NUN, stbsv_NLU, stbsv_NLN, - stbsv_TUU, stbsv_TUN, stbsv_TLU, stbsv_TLN, -#endif -}; - -#ifndef CBLAS - -void NAME(char *UPLO, char *TRANS, char *DIAG, - blasint *N, blasint *K, - FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){ - - char uplo_arg = *UPLO; - char trans_arg = *TRANS; - char diag_arg = *DIAG; - - blasint n = *N; - blasint k = *K; - blasint lda = *LDA; - blasint incx = *INCX; - - blasint info; - int uplo; - int unit; - int trans; - FLOAT *buffer; - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - TOUPPER(trans_arg); - TOUPPER(diag_arg); - - trans = -1; - unit = -1; - uplo = -1; - - if (trans_arg == 'N') trans = 0; - if (trans_arg == 'T') trans = 1; - if (trans_arg == 'R') trans = 0; - if (trans_arg == 'C') trans = 1; - - if (diag_arg == 'U') unit = 0; - if (diag_arg == 'N') unit = 1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incx == 0) info = 9; - if (lda < k + 1) info = 7; - if (k < 0) info = 5; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, - enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, - blasint n, blasint k, FLOAT *a, blasint lda, FLOAT *x, blasint incx) { - - int trans, uplo, unit; - blasint info; - FLOAT *buffer; - - PRINT_DEBUG_CNAME; - - unit = -1; - uplo = -1; - trans = -1; - info = 0; - - if (order == CblasColMajor) { - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - if (TransA == CblasNoTrans) trans = 0; - if (TransA == CblasTrans) trans = 1; - if (TransA == CblasConjNoTrans) trans = 0; - if (TransA == CblasConjTrans) trans = 1; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 9; - if (lda < k + 1) info = 7; - if (k < 0) info = 5; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - if (TransA == CblasNoTrans) trans = 1; - if (TransA == CblasTrans) trans = 0; - if (TransA == CblasConjNoTrans) trans = 1; - if (TransA == CblasConjTrans) trans = 0; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 9; - if (lda < k + 1) info = 7; - if (k < 0) info = 5; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx; - - buffer = (FLOAT *)blas_memory_alloc(1); - - (tbsv[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer); - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(1, n * k / 2 + n, n * k); - - IDEBUG_END; - - return; -} diff --git a/interface/tpmv.c b/interface/tpmv.c deleted file mode 100644 index f0fc4f71c..000000000 --- a/interface/tpmv.c +++ /dev/null @@ -1,239 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QTPMV " -#elif defined(DOUBLE) -#define ERROR_NAME "DTPMV " -#else -#define ERROR_NAME "STPMV " -#endif - -static int (*tpmv[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, void *) = { -#ifdef XDOUBLE - qtpmv_NUU, qtpmv_NUN, qtpmv_NLU, qtpmv_NLN, - qtpmv_TUU, qtpmv_TUN, qtpmv_TLU, qtpmv_TLN, -#elif defined(DOUBLE) - dtpmv_NUU, dtpmv_NUN, dtpmv_NLU, dtpmv_NLN, - dtpmv_TUU, dtpmv_TUN, dtpmv_TLU, dtpmv_TLN, -#else - stpmv_NUU, stpmv_NUN, stpmv_NLU, stpmv_NLN, - stpmv_TUU, stpmv_TUN, stpmv_TLU, stpmv_TLN, -#endif -}; - -#ifdef SMP -static int (*tpmv_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, int) = { -#ifdef XDOUBLE - qtpmv_thread_NUU, qtpmv_thread_NUN, qtpmv_thread_NLU, qtpmv_thread_NLN, - qtpmv_thread_TUU, qtpmv_thread_TUN, qtpmv_thread_TLU, qtpmv_thread_TLN, -#elif defined(DOUBLE) - dtpmv_thread_NUU, dtpmv_thread_NUN, dtpmv_thread_NLU, dtpmv_thread_NLN, - dtpmv_thread_TUU, dtpmv_thread_TUN, dtpmv_thread_TLU, dtpmv_thread_TLN, -#else - stpmv_thread_NUU, stpmv_thread_NUN, stpmv_thread_NLU, stpmv_thread_NLN, - stpmv_thread_TUU, stpmv_thread_TUN, stpmv_thread_TLU, stpmv_thread_TLN, -#endif -}; -#endif - -#ifndef CBLAS - -void NAME(char *UPLO, char *TRANS, char *DIAG, - blasint *N, FLOAT *a, FLOAT *x, blasint *INCX){ - - char uplo_arg = *UPLO; - char trans_arg = *TRANS; - char diag_arg = *DIAG; - - blasint n = *N; - blasint incx = *INCX; - - blasint info; - int uplo; - int unit; - int trans; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - TOUPPER(trans_arg); - TOUPPER(diag_arg); - - trans = -1; - unit = -1; - uplo = -1; - - if (trans_arg == 'N') trans = 0; - if (trans_arg == 'T') trans = 1; - if (trans_arg == 'R') trans = 0; - if (trans_arg == 'C') trans = 1; - - if (diag_arg == 'U') unit = 0; - if (diag_arg == 'N') unit = 1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incx == 0) info = 7; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, - enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, - blasint n, FLOAT *a, FLOAT *x, blasint incx) { - - int trans, uplo, unit; - blasint info; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_CNAME; - - unit = -1; - uplo = -1; - trans = -1; - info = 0; - - if (order == CblasColMajor) { - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - if (TransA == CblasNoTrans) trans = 0; - if (TransA == CblasTrans) trans = 1; - if (TransA == CblasConjNoTrans) trans = 0; - if (TransA == CblasConjTrans) trans = 1; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 7; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - if (TransA == CblasNoTrans) trans = 1; - if (TransA == CblasTrans) trans = 0; - if (TransA == CblasConjNoTrans) trans = 1; - if (TransA == CblasConjTrans) trans = 0; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 7; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (tpmv[(trans<<2) | (uplo<<1) | unit])(n, a, x, incx, buffer); - -#ifdef SMP - } else { - - (tpmv_thread[(trans<<2) | (uplo<<1) | unit])(n, a, x, incx, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(1, n * n / 2 + n, n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/tpsv.c b/interface/tpsv.c deleted file mode 100644 index 9dafd0b68..000000000 --- a/interface/tpsv.c +++ /dev/null @@ -1,204 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QTPSV " -#elif defined(DOUBLE) -#define ERROR_NAME "DTPSV " -#else -#define ERROR_NAME "STPSV " -#endif - -static int (*tpsv[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, void *) = { -#ifdef XDOUBLE - qtpsv_NUU, qtpsv_NUN, qtpsv_NLU, qtpsv_NLN, - qtpsv_TUU, qtpsv_TUN, qtpsv_TLU, qtpsv_TLN, -#elif defined(DOUBLE) - dtpsv_NUU, dtpsv_NUN, dtpsv_NLU, dtpsv_NLN, - dtpsv_TUU, dtpsv_TUN, dtpsv_TLU, dtpsv_TLN, -#else - stpsv_NUU, stpsv_NUN, stpsv_NLU, stpsv_NLN, - stpsv_TUU, stpsv_TUN, stpsv_TLU, stpsv_TLN, -#endif -}; - -#ifndef CBLAS - -void NAME(char *UPLO, char *TRANS, char *DIAG, - blasint *N, FLOAT *a, FLOAT *x, blasint *INCX){ - - char uplo_arg = *UPLO; - char trans_arg = *TRANS; - char diag_arg = *DIAG; - - blasint n = *N; - blasint incx = *INCX; - - blasint info; - int uplo; - int unit; - int trans; - FLOAT *buffer; - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - TOUPPER(trans_arg); - TOUPPER(diag_arg); - - trans = -1; - unit = -1; - uplo = -1; - - if (trans_arg == 'N') trans = 0; - if (trans_arg == 'T') trans = 1; - if (trans_arg == 'R') trans = 0; - if (trans_arg == 'C') trans = 1; - - if (diag_arg == 'U') unit = 0; - if (diag_arg == 'N') unit = 1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incx == 0) info = 7; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, - enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, - blasint n, FLOAT *a, FLOAT *x, blasint incx) { - - int trans, uplo, unit; - blasint info; - FLOAT *buffer; - - PRINT_DEBUG_CNAME; - - unit = -1; - uplo = -1; - trans = -1; - info = 0; - - if (order == CblasColMajor) { - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - if (TransA == CblasNoTrans) trans = 0; - if (TransA == CblasTrans) trans = 1; - if (TransA == CblasConjNoTrans) trans = 0; - if (TransA == CblasConjTrans) trans = 1; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 7; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - if (TransA == CblasNoTrans) trans = 1; - if (TransA == CblasTrans) trans = 0; - if (TransA == CblasConjNoTrans) trans = 1; - if (TransA == CblasConjTrans) trans = 0; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 7; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx; - - buffer = (FLOAT *)blas_memory_alloc(1); - - (tpsv[(trans<<2) | (uplo<<1) | unit])(n, a, x, incx, buffer); - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(1, n * n / 2 + n, n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/trmv.c b/interface/trmv.c deleted file mode 100644 index ed23cedc6..000000000 --- a/interface/trmv.c +++ /dev/null @@ -1,243 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QTRMV " -#elif defined(DOUBLE) -#define ERROR_NAME "DTRMV " -#else -#define ERROR_NAME "STRMV " -#endif - -static int (*trmv[])(BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { -#ifdef XDOUBLE - qtrmv_NUU, qtrmv_NUN, qtrmv_NLU, qtrmv_NLN, - qtrmv_TUU, qtrmv_TUN, qtrmv_TLU, qtrmv_TLN, -#elif defined(DOUBLE) - dtrmv_NUU, dtrmv_NUN, dtrmv_NLU, dtrmv_NLN, - dtrmv_TUU, dtrmv_TUN, dtrmv_TLU, dtrmv_TLN, -#else - strmv_NUU, strmv_NUN, strmv_NLU, strmv_NLN, - strmv_TUU, strmv_TUN, strmv_TLU, strmv_TLN, -#endif -}; - -#ifdef SMP -static int (*trmv_thread[])(BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { -#ifdef XDOUBLE - qtrmv_thread_NUU, qtrmv_thread_NUN, qtrmv_thread_NLU, qtrmv_thread_NLN, - qtrmv_thread_TUU, qtrmv_thread_TUN, qtrmv_thread_TLU, qtrmv_thread_TLN, -#elif defined(DOUBLE) - dtrmv_thread_NUU, dtrmv_thread_NUN, dtrmv_thread_NLU, dtrmv_thread_NLN, - dtrmv_thread_TUU, dtrmv_thread_TUN, dtrmv_thread_TLU, dtrmv_thread_TLN, -#else - strmv_thread_NUU, strmv_thread_NUN, strmv_thread_NLU, strmv_thread_NLN, - strmv_thread_TUU, strmv_thread_TUN, strmv_thread_TLU, strmv_thread_TLN, -#endif -}; -#endif - -#ifndef CBLAS - -void NAME(char *UPLO, char *TRANS, char *DIAG, - blasint *N, FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){ - - char uplo_arg = *UPLO; - char trans_arg = *TRANS; - char diag_arg = *DIAG; - - blasint n = *N; - blasint lda = *LDA; - blasint incx = *INCX; - - blasint info; - int uplo; - int unit; - int trans; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - TOUPPER(trans_arg); - TOUPPER(diag_arg); - - trans = -1; - unit = -1; - uplo = -1; - - if (trans_arg == 'N') trans = 0; - if (trans_arg == 'T') trans = 1; - if (trans_arg == 'R') trans = 0; - if (trans_arg == 'C') trans = 1; - - if (diag_arg == 'U') unit = 0; - if (diag_arg == 'N') unit = 1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incx == 0) info = 8; - if (lda < MAX(1, n)) info = 6; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, - enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, - blasint n, FLOAT *a, blasint lda, FLOAT *x, blasint incx) { - - int trans, uplo, unit; - blasint info; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_CNAME; - - unit = -1; - uplo = -1; - trans = -1; - info = 0; - - if (order == CblasColMajor) { - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - if (TransA == CblasNoTrans) trans = 0; - if (TransA == CblasTrans) trans = 1; - if (TransA == CblasConjNoTrans) trans = 0; - if (TransA == CblasConjTrans) trans = 1; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 8; - if (lda < MAX(1, n)) info = 6; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - if (TransA == CblasNoTrans) trans = 1; - if (TransA == CblasTrans) trans = 0; - if (TransA == CblasConjNoTrans) trans = 1; - if (TransA == CblasConjTrans) trans = 0; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 8; - if (lda < MAX(1, n)) info = 6; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (trmv[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer); - -#ifdef SMP - } else { - - (trmv_thread[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(1, n * n / 2 + n, n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/trsm.c b/interface/trsm.c deleted file mode 100644 index 5836ce2f0..000000000 --- a/interface/trsm.c +++ /dev/null @@ -1,391 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifndef TRMM -#ifndef COMPLEX -#ifdef XDOUBLE -#define ERROR_NAME "QTRSM " -#elif defined(DOUBLE) -#define ERROR_NAME "DTRSM " -#else -#define ERROR_NAME "STRSM " -#endif -#else -#ifdef XDOUBLE -#define ERROR_NAME "XTRSM " -#elif defined(DOUBLE) -#define ERROR_NAME "ZTRSM " -#else -#define ERROR_NAME "CTRSM " -#endif -#endif -#else -#ifndef COMPLEX -#ifdef XDOUBLE -#define ERROR_NAME "QTRMM " -#elif defined(DOUBLE) -#define ERROR_NAME "DTRMM " -#else -#define ERROR_NAME "STRMM " -#endif -#else -#ifdef XDOUBLE -#define ERROR_NAME "XTRMM " -#elif defined(DOUBLE) -#define ERROR_NAME "ZTRMM " -#else -#define ERROR_NAME "CTRMM " -#endif -#endif -#endif - -static int (*trsm[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { -#ifndef TRMM - TRSM_LNUU, TRSM_LNUN, TRSM_LNLU, TRSM_LNLN, - TRSM_LTUU, TRSM_LTUN, TRSM_LTLU, TRSM_LTLN, - TRSM_LRUU, TRSM_LRUN, TRSM_LRLU, TRSM_LRLN, - TRSM_LCUU, TRSM_LCUN, TRSM_LCLU, TRSM_LCLN, - TRSM_RNUU, TRSM_RNUN, TRSM_RNLU, TRSM_RNLN, - TRSM_RTUU, TRSM_RTUN, TRSM_RTLU, TRSM_RTLN, - TRSM_RRUU, TRSM_RRUN, TRSM_RRLU, TRSM_RRLN, - TRSM_RCUU, TRSM_RCUN, TRSM_RCLU, TRSM_RCLN, -#else - TRMM_LNUU, TRMM_LNUN, TRMM_LNLU, TRMM_LNLN, - TRMM_LTUU, TRMM_LTUN, TRMM_LTLU, TRMM_LTLN, - TRMM_LRUU, TRMM_LRUN, TRMM_LRLU, TRMM_LRLN, - TRMM_LCUU, TRMM_LCUN, TRMM_LCLU, TRMM_LCLN, - TRMM_RNUU, TRMM_RNUN, TRMM_RNLU, TRMM_RNLN, - TRMM_RTUU, TRMM_RTUN, TRMM_RTLU, TRMM_RTLN, - TRMM_RRUU, TRMM_RRUN, TRMM_RRLU, TRMM_RRLN, - TRMM_RCUU, TRMM_RCUN, TRMM_RCLU, TRMM_RCLN, -#endif -}; - -#ifndef CBLAS - -void NAME(char *SIDE, char *UPLO, char *TRANS, char *DIAG, - blasint *M, blasint *N, FLOAT *alpha, - FLOAT *a, blasint *ldA, FLOAT *b, blasint *ldB){ - - char side_arg = *SIDE; - char uplo_arg = *UPLO; - char trans_arg = *TRANS; - char diag_arg = *DIAG; - - blas_arg_t args; - - FLOAT *buffer; - FLOAT *sa, *sb; - -#ifdef SMP -#ifndef COMPLEX -#ifdef XDOUBLE - int mode = BLAS_XDOUBLE | BLAS_REAL; -#elif defined(DOUBLE) - int mode = BLAS_DOUBLE | BLAS_REAL; -#else - int mode = BLAS_SINGLE | BLAS_REAL; -#endif -#else -#ifdef XDOUBLE - int mode = BLAS_XDOUBLE | BLAS_COMPLEX; -#elif defined(DOUBLE) - int mode = BLAS_DOUBLE | BLAS_COMPLEX; -#else - int mode = BLAS_SINGLE | BLAS_COMPLEX; -#endif -#endif -#endif - - blasint info; - int side; - int uplo; - int unit; - int trans; - int nrowa; - - PRINT_DEBUG_NAME; - - args.m = *M; - args.n = *N; - - args.a = (void *)a; - args.b = (void *)b; - - args.lda = *ldA; - args.ldb = *ldB; - - args.beta = (void *)alpha; - - TOUPPER(side_arg); - TOUPPER(uplo_arg); - TOUPPER(trans_arg); - TOUPPER(diag_arg); - - side = -1; - trans = -1; - unit = -1; - uplo = -1; - - if (side_arg == 'L') side = 0; - if (side_arg == 'R') side = 1; - - if (trans_arg == 'N') trans = 0; - if (trans_arg == 'T') trans = 1; - if (trans_arg == 'R') trans = 2; - if (trans_arg == 'C') trans = 3; - - if (diag_arg == 'U') unit = 0; - if (diag_arg == 'N') unit = 1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - nrowa = args.m; - if (side & 1) nrowa = args.n; - - info = 0; - - if (args.ldb < MAX(1,args.m)) info = 11; - if (args.lda < MAX(1,nrowa)) info = 9; - if (args.n < 0) info = 6; - if (args.m < 0) info = 5; - if (unit < 0) info = 4; - if (trans < 0) info = 3; - if (uplo < 0) info = 2; - if (side < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, - enum CBLAS_SIDE Side, enum CBLAS_UPLO Uplo, - enum CBLAS_TRANSPOSE Trans, enum CBLAS_DIAG Diag, - blasint m, blasint n, -#ifndef COMPLEX - FLOAT alpha, -#else - FLOAT *alpha, -#endif - FLOAT *a, blasint lda, - FLOAT *b, blasint ldb) { - - blas_arg_t args; - int side, uplo, trans, unit; - blasint info, nrowa; - - XFLOAT *buffer; - XFLOAT *sa, *sb; - -#ifdef SMP -#ifndef COMPLEX -#ifdef XDOUBLE - int mode = BLAS_XDOUBLE | BLAS_REAL; -#elif defined(DOUBLE) - int mode = BLAS_DOUBLE | BLAS_REAL; -#else - int mode = BLAS_SINGLE | BLAS_REAL; -#endif -#else -#ifdef XDOUBLE - int mode = BLAS_XDOUBLE | BLAS_COMPLEX; -#elif defined(DOUBLE) - int mode = BLAS_DOUBLE | BLAS_COMPLEX; -#else - int mode = BLAS_SINGLE | BLAS_COMPLEX; -#endif -#endif -#endif - - PRINT_DEBUG_CNAME; - - args.a = (void *)a; - args.b = (void *)b; - - args.lda = lda; - args.ldb = ldb; - -#ifndef COMPLEX - args.beta = (void *)α -#else - args.beta = (void *)alpha; -#endif - - side = -1; - uplo = -1; - trans = -1; - unit = -1; - info = 0; - - if (order == CblasColMajor) { - args.m = m; - args.n = n; - - if (Side == CblasLeft) side = 0; - if (Side == CblasRight) side = 1; - - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - if (Trans == CblasNoTrans) trans = 0; - if (Trans == CblasTrans) trans = 1; -#ifndef COMPLEX - if (Trans == CblasConjNoTrans) trans = 0; - if (Trans == CblasConjTrans) trans = 1; -#else - if (Trans == CblasConjNoTrans) trans = 2; - if (Trans == CblasConjTrans) trans = 3; -#endif - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - nrowa = args.m; - if (side & 1) nrowa = args.n; - - if (args.ldb < MAX(1,args.m)) info = 11; - if (args.lda < MAX(1,nrowa)) info = 9; - if (args.n < 0) info = 6; - if (args.m < 0) info = 5; - if (unit < 0) info = 4; - if (trans < 0) info = 3; - if (uplo < 0) info = 2; - if (side < 0) info = 1; - } - - if (order == CblasRowMajor) { - args.m = n; - args.n = m; - - if (Side == CblasLeft) side = 1; - if (Side == CblasRight) side = 0; - - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - if (Trans == CblasNoTrans) trans = 0; - if (Trans == CblasTrans) trans = 1; -#ifndef COMPLEX - if (Trans == CblasConjNoTrans) trans = 0; - if (Trans == CblasConjTrans) trans = 1; -#else - if (Trans == CblasConjNoTrans) trans = 2; - if (Trans == CblasConjTrans) trans = 3; -#endif - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - nrowa = args.m; - if (side & 1) nrowa = args.n; - - if (args.ldb < MAX(1,args.m)) info = 11; - if (args.lda < MAX(1,nrowa)) info = 9; - if (args.n < 0) info = 6; - if (args.m < 0) info = 5; - if (unit < 0) info = 4; - if (trans < 0) info = 3; - if (uplo < 0) info = 2; - if (side < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if ((args.m == 0) || (args.n == 0)) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - buffer = (FLOAT *)blas_memory_alloc(0); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); - -#ifdef SMP - mode |= (trans << BLAS_TRANSA_SHIFT); - mode |= (side << BLAS_RSIDE_SHIFT); - - args.nthreads = num_cpu_avail(3); - - if (args.nthreads == 1) { -#endif - - (trsm[(side<<4) | (trans<<2) | (uplo<<1) | unit])(&args, NULL, NULL, sa, sb, 0); - -#ifdef SMP - } else { - if (!side) { - gemm_thread_n(mode, &args, NULL, NULL, trsm[(side<<4) | (trans<<2) | (uplo<<1) | unit], sa, sb, args.nthreads); - } else { - gemm_thread_m(mode, &args, NULL, NULL, trsm[(side<<4) | (trans<<2) | (uplo<<1) | unit], sa, sb, args.nthreads); - } - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, - (!side) ? args.m * (args.m + args.n) : args.n * (args.m + args.n), - (!side) ? args.m * args.m * args.n : args.m * args.n * args.n); - - IDEBUG_END; - - return; -} - diff --git a/interface/trsv.c b/interface/trsv.c deleted file mode 100644 index 8ef6998db..000000000 --- a/interface/trsv.c +++ /dev/null @@ -1,208 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QTRSV " -#elif defined(DOUBLE) -#define ERROR_NAME "DTRSV " -#else -#define ERROR_NAME "STRSV " -#endif - -static int (*trsv[])(BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { -#ifdef XDOUBLE - qtrsv_NUU, qtrsv_NUN, qtrsv_NLU, qtrsv_NLN, - qtrsv_TUU, qtrsv_TUN, qtrsv_TLU, qtrsv_TLN, -#elif defined(DOUBLE) - dtrsv_NUU, dtrsv_NUN, dtrsv_NLU, dtrsv_NLN, - dtrsv_TUU, dtrsv_TUN, dtrsv_TLU, dtrsv_TLN, -#else - strsv_NUU, strsv_NUN, strsv_NLU, strsv_NLN, - strsv_TUU, strsv_TUN, strsv_TLU, strsv_TLN, -#endif -}; - -#ifndef CBLAS - -void NAME(char *UPLO, char *TRANS, char *DIAG, - blasint *N, FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){ - - char uplo_arg = *UPLO; - char trans_arg = *TRANS; - char diag_arg = *DIAG; - - blasint n = *N; - blasint lda = *LDA; - blasint incx = *INCX; - - blasint info; - int uplo; - int unit; - int trans; - FLOAT *buffer; - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - TOUPPER(trans_arg); - TOUPPER(diag_arg); - - trans = -1; - unit = -1; - uplo = -1; - - if (trans_arg == 'N') trans = 0; - if (trans_arg == 'T') trans = 1; - if (trans_arg == 'R') trans = 0; - if (trans_arg == 'C') trans = 1; - - if (diag_arg == 'U') unit = 0; - if (diag_arg == 'N') unit = 1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incx == 0) info = 8; - if (lda < MAX(1, n)) info = 6; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, - enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, - blasint n, FLOAT *a, blasint lda, FLOAT *x, blasint incx) { - - int trans, uplo, unit; - blasint info; - FLOAT *buffer; - - PRINT_DEBUG_CNAME; - - unit = -1; - uplo = -1; - trans = -1; - info = 0; - - if (order == CblasColMajor) { - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - if (TransA == CblasNoTrans) trans = 0; - if (TransA == CblasTrans) trans = 1; - if (TransA == CblasConjNoTrans) trans = 0; - if (TransA == CblasConjTrans) trans = 1; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 8; - if (lda < MAX(1, n)) info = 6; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - if (TransA == CblasNoTrans) trans = 1; - if (TransA == CblasTrans) trans = 0; - if (TransA == CblasConjNoTrans) trans = 1; - if (TransA == CblasConjTrans) trans = 0; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 8; - if (lda < MAX(1, n)) info = 6; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx; - - buffer = (FLOAT *)blas_memory_alloc(1); - - (trsv[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer); - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(1, n * n / 2 + n, n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/trti2.c b/interface/trti2.c deleted file mode 100644 index e119b45af..000000000 --- a/interface/trti2.c +++ /dev/null @@ -1,134 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QTRTI2" -#elif defined(DOUBLE) -#define ERROR_NAME "DTRTI2" -#else -#define ERROR_NAME "STRTI2" -#endif - -static blasint (*trti2[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { -#ifdef XDOUBLE - qtrti2_UU, qtrti2_UN, qtrti2_LU, qtrti2_LN, -#elif defined(DOUBLE) - dtrti2_UU, dtrti2_UN, dtrti2_LU, dtrti2_LN, -#else - strti2_UU, strti2_UN, strti2_LU, strti2_LN, -#endif - }; - -int NAME(char *UPLO, char *DIAG, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ - - blas_arg_t args; - - blasint uplo_arg = *UPLO; - blasint diag_arg = *DIAG; - blasint uplo, diag; - blasint info; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.n = *N; - args.a = (void *)a; - args.lda = *ldA; - - TOUPPER(uplo_arg); - TOUPPER(diag_arg); - - uplo = -1; - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - diag = -1; - if (diag_arg == 'U') diag = 0; - if (diag_arg == 'N') diag = 1; - - info = 0; - if (args.lda < MAX(1,args.n)) info = 5; - if (args.n < 0) info = 3; - if (diag < 0) info = 2; - if (uplo < 0) info = 1; - if (info) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - *Info = - info; - return 0; - } - - *Info = 0; - - if (args.n <= 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - - info = (trti2[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0); - - *Info = info; - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, .5 * args.n * args.n, - args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) - + args.n * (1./3. + args.n * (-1./2. + args.n * 1./6.))); - - IDEBUG_END; - - return 0; -} diff --git a/interface/trtri.c b/interface/trtri.c deleted file mode 100644 index 5aa5e9b9b..000000000 --- a/interface/trtri.c +++ /dev/null @@ -1,156 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QTRTRI" -#elif defined(DOUBLE) -#define ERROR_NAME "DTRTRI" -#else -#define ERROR_NAME "STRTRI" -#endif - -static blasint (*trtri_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ - TRTRI_UU_SINGLE, TRTRI_UN_SINGLE, TRTRI_LU_SINGLE, TRTRI_LN_SINGLE, -}; - -#ifdef SMP -static blasint (*trtri_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ - TRTRI_UU_PARALLEL, TRTRI_UN_PARALLEL, TRTRI_LU_PARALLEL, TRTRI_LN_PARALLEL, -}; -#endif - - -int NAME(char *UPLO, char *DIAG, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ - - blas_arg_t args; - - blasint uplo_arg = *UPLO; - blasint diag_arg = *DIAG; - blasint uplo, diag; - blasint info; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.n = *N; - args.a = (void *)a; - args.lda = *ldA; - - TOUPPER(uplo_arg); - TOUPPER(diag_arg); - - - uplo = -1; - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - diag = -1; - if (diag_arg == 'U') diag = 0; - if (diag_arg == 'N') diag = 1; - - - info = 0; - if (args.lda < MAX(1,args.n)) info = 5; - if (args.n < 0) info = 3; - if (diag < 0) info = 2; - if (uplo < 0) info = 1; - if (info) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - *Info = - info; - return 0; - } - - *Info = 0; - - if (args.n == 0) return 0; - - if (diag) { - if (AMIN_K(args.n, args.a, args.lda + 1) == ZERO) { - *Info = IAMIN_K(args.n, args.a, args.lda + 1); - return 0; - } - } - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - -#ifdef SMP - args.nthreads = num_cpu_avail(4); - - if (args.nthreads == 1) { -#endif - - *Info = (trtri_single[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0); - -#ifdef SMP - } else { - - *Info = (trtri_parallel[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0); - - } -#endif - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, .5 * args.n * args.n, - args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) - + args.n * (1./3. + args.n * (-1./2. + args.n * 1./6.))); - - IDEBUG_END; - - return 0; -} diff --git a/interface/zaxpy.c b/interface/zaxpy.c deleted file mode 100644 index 9ed72efb9..000000000 --- a/interface/zaxpy.c +++ /dev/null @@ -1,127 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifndef CBLAS - -void NAME(blasint *N, FLOAT *ALPHA, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){ - - blasint n = *N; - blasint incx = *INCX; - blasint incy = *INCY; - -#else - -void CNAME(blasint n, FLOAT *ALPHA, FLOAT *x, blasint incx, FLOAT *y, blasint incy){ - -#endif - - FLOAT alpha_r = *(ALPHA + 0); - FLOAT alpha_i = *(ALPHA + 1); - -#ifdef SMP - int mode, nthreads; -#endif - -#ifndef CBLAS - PRINT_DEBUG_CNAME; -#else - PRINT_DEBUG_CNAME; -#endif - - if (n <= 0) return; - - if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0) x -= (n - 1) * incx * 2; - if (incy < 0) y -= (n - 1) * incy * 2; - -#ifdef SMP - nthreads = num_cpu_avail(1); - - //disable multi-thread when incx==0 or incy==0 - //In that case, the threads would be dependent. - if (incx == 0 || incy == 0) - nthreads = 1; - - if (nthreads == 1) { -#endif - -#ifndef CONJ - AXPYU_K (n, 0, 0, alpha_r, alpha_i, x, incx, y, incy, NULL, 0); -#else - AXPYC_K(n, 0, 0, alpha_r, alpha_i, x, incx, y, incy, NULL, 0); -#endif - -#ifdef SMP - } else { - -#ifdef XDOUBLE - mode = BLAS_XDOUBLE | BLAS_COMPLEX; -#elif defined(DOUBLE) - mode = BLAS_DOUBLE | BLAS_COMPLEX; -#else - mode = BLAS_SINGLE | BLAS_COMPLEX; -#endif - - blas_level1_thread(mode, n, 0, 0, ALPHA, x, incx, y, incy, NULL, 0, -#ifndef CONJ - (void *)AXPYU_K, -#else - (void *)AXPYC_K, -#endif - nthreads); - } -#endif - - FUNCTION_PROFILE_END(4, 2 * n, 2 * n); - - IDEBUG_END; - - return; - -} diff --git a/interface/zdot.c b/interface/zdot.c deleted file mode 100644 index 1380ce292..000000000 --- a/interface/zdot.c +++ /dev/null @@ -1,202 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef RETURN_BY_STRUCT -#ifdef XDOUBLE -#define MYTYPE myxcomplex_t -#elif defined DOUBLE -#define MYTYPE myzcomplex_t -#else -#define MYTYPE myccomplex_t -#endif -#endif - -#ifndef CBLAS - -#ifdef RETURN_BY_STRUCT -MYTYPE NAME( blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY) { -#elif defined RETURN_BY_STACK -void NAME(FLOAT _Complex *result, blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY) { -#else -FLOAT _Complex NAME( blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY) { -#endif - - BLASLONG n = *N; - BLASLONG incx = *INCX; - BLASLONG incy = *INCY; -#ifndef RETURN_BY_STACK - FLOAT _Complex ret; -#endif -#ifdef RETURN_BY_STRUCT - MYTYPE myret; -#endif - - PRINT_DEBUG_NAME; - - if (n <= 0) { -#ifdef RETURN_BY_STRUCT - myret.r = 0.; - myret.i = 0.; - return myret; -#elif defined RETURN_BY_STACK - *result = ZERO; - return; -#else - return ZERO; -#endif - } - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0) x -= (n - 1) * incx * 2; - if (incy < 0) y -= (n - 1) * incy * 2; - -#ifdef RETURN_BY_STRUCT - -#ifndef CONJ - ret = DOTU_K(n, x, incx, y, incy); -#else - ret = DOTC_K(n, x, incx, y, incy); -#endif - - myret.r = CREAL ret; - myret.i = CIMAG ret; - - FUNCTION_PROFILE_END(4, 2 * n, 2 * n); - - IDEBUG_END; - - return myret; - -#elif defined RETURN_BY_STACK - -#ifndef CONJ - *result = DOTU_K(n, x, incx, y, incy); -#else - *result = DOTC_K(n, x, incx, y, incy); -#endif - - FUNCTION_PROFILE_END(4, 2 * n, 2 * n); - - IDEBUG_END; - -#else - -#ifndef CONJ - ret = DOTU_K(n, x, incx, y, incy); -#else - ret = DOTC_K(n, x, incx, y, incy); -#endif - - FUNCTION_PROFILE_END(4, 2 * n, 2 * n); - - IDEBUG_END; - - return ret; - -#endif - -} - -#else - -#ifdef FORCE_USE_STACK -void CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy, FLOAT _Complex *result){ -#else -FLOAT _Complex CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy){ - - FLOAT _Complex ret; -#endif - - PRINT_DEBUG_CNAME; - - if (n <= 0) { -#ifdef FORCE_USE_STACK - *result = ZERO; - return; -#else - return ZERO; -#endif - } - - if (incx < 0) x -= (n - 1) * incx * 2; - if (incy < 0) y -= (n - 1) * incy * 2; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifdef FORCE_USE_STACK - -#ifndef CONJ - *result = DOTU_K(n, x, incx, y, incy); -#else - *result = DOTC_K(n, x, incx, y, incy); -#endif - - FUNCTION_PROFILE_END(4, 2 * n, 2 * n); - - IDEBUG_END; - -#else - -#ifndef CONJ - ret = DOTU_K(n, x, incx, y, incy); -#else - ret = DOTC_K(n, x, incx, y, incy); -#endif - - FUNCTION_PROFILE_END(4, 2 * n, 2 * n); - - IDEBUG_END; - - return ret; - -#endif - -} - -#endif diff --git a/interface/zgbmv.c b/interface/zgbmv.c deleted file mode 100644 index ae1fd24bf..000000000 --- a/interface/zgbmv.c +++ /dev/null @@ -1,271 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XGBMV " -#elif defined(DOUBLE) -#define ERROR_NAME "ZGBMV " -#else -#define ERROR_NAME "CGBMV " -#endif - -static void (*gbmv[])(BLASLONG, BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT, - FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { -#ifdef XDOUBLE - xgbmv_n, xgbmv_t, xgbmv_r, xgbmv_c, - xgbmv_o, xgbmv_u, xgbmv_s, xgbmv_d, -#elif defined(DOUBLE) - zgbmv_n, zgbmv_t, zgbmv_r, zgbmv_c, - zgbmv_o, zgbmv_u, zgbmv_s, zgbmv_d, -#else - cgbmv_n, cgbmv_t, cgbmv_r, cgbmv_c, - cgbmv_o, cgbmv_u, cgbmv_s, cgbmv_d, -#endif -}; - -#ifdef SMP -static int (*gbmv_thread[])(BLASLONG, BLASLONG, BLASLONG, BLASLONG, FLOAT *, - FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { -#ifdef XDOUBLE - xgbmv_thread_n, xgbmv_thread_t, xgbmv_thread_r, xgbmv_thread_c, - xgbmv_thread_o, xgbmv_thread_u, xgbmv_thread_s, xgbmv_thread_d, -#elif defined(DOUBLE) - zgbmv_thread_n, zgbmv_thread_t, zgbmv_thread_r, zgbmv_thread_c, - zgbmv_thread_o, zgbmv_thread_u, zgbmv_thread_s, zgbmv_thread_d, -#else - cgbmv_thread_n, cgbmv_thread_t, cgbmv_thread_r, cgbmv_thread_c, - cgbmv_thread_o, cgbmv_thread_u, cgbmv_thread_s, cgbmv_thread_d, -#endif -}; -#endif - -#ifndef CBLAS - -void NAME(char *TRANS, blasint *M, blasint *N, - blasint *KU, blasint *KL, - FLOAT *ALPHA, FLOAT *a, blasint *LDA, - FLOAT *x, blasint *INCX, - FLOAT *BETA, FLOAT *y, blasint *INCY){ - - char trans = *TRANS; - blasint m = *M; - blasint n = *N; - blasint ku = *KU; - blasint kl = *KL; - blasint lda = *LDA; - blasint incx = *INCX; - blasint incy = *INCY; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - FLOAT alpha_r = ALPHA[0]; - FLOAT alpha_i = ALPHA[1]; - FLOAT beta_r = BETA[0]; - FLOAT beta_i = BETA[1]; - - blasint info; - blasint lenx, leny; - blasint i; - - PRINT_DEBUG_NAME; - - TOUPPER(trans); - - info = 0; - - i = -1; - - if (trans == 'N') i = 0; - if (trans == 'T') i = 1; - if (trans == 'R') i = 2; - if (trans == 'C') i = 3; - if (trans == 'O') i = 4; - if (trans == 'U') i = 5; - if (trans == 'S') i = 6; - if (trans == 'D') i = 7; - - if (incy == 0) info = 13; - if (incx == 0) info = 10; - if (lda < kl + ku + 1) info = 8; - if (kl < 0) info = 5; - if (ku < 0) info = 4; - if (n < 0) info = 3; - if (m < 0) info = 2; - if (i < 0) info = 1; - - trans = i; - - if (info != 0){ - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, - enum CBLAS_TRANSPOSE TransA, - blasint m, blasint n, - blasint ku, blasint kl, - FLOAT *ALPHA, - FLOAT *a, blasint lda, - FLOAT *x, blasint incx, - FLOAT *BETA, - FLOAT *y, blasint incy){ - - FLOAT alpha_r = ALPHA[0]; - FLOAT alpha_i = ALPHA[1]; - FLOAT beta_r = BETA[0]; - FLOAT beta_i = BETA[1]; - - FLOAT *buffer; - blasint lenx, leny; - int trans; - blasint info, t; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_CNAME; - - trans = -1; - info = 0; - - if (order == CblasColMajor) { - if (TransA == CblasNoTrans) trans = 0; - if (TransA == CblasTrans) trans = 1; - if (TransA == CblasConjNoTrans) trans = 2; - if (TransA == CblasConjTrans) trans = 3; - - info = -1; - - if (incy == 0) info = 13; - if (incx == 0) info = 10; - if (lda < kl + ku + 1) info = 8; - if (kl < 0) info = 5; - if (ku < 0) info = 4; - if (n < 0) info = 3; - if (m < 0) info = 2; - if (trans < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (TransA == CblasNoTrans) trans = 1; - if (TransA == CblasTrans) trans = 0; - if (TransA == CblasConjNoTrans) trans = 3; - if (TransA == CblasConjTrans) trans = 2; - - info = -1; - - t = n; - n = m; - m = t; - - t = ku; - ku = kl; - kl = t; - - if (incy == 0) info = 13; - if (incx == 0) info = 10; - if (lda < kl + ku + 1) info = 8; - if (kl < 0) info = 5; - if (ku < 0) info = 4; - if (n < 0) info = 3; - if (m < 0) info = 2; - if (trans < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if ((m==0) || (n==0)) return; - - lenx = n; - leny = m; - if (trans & 1) lenx = m; - if (trans & 1) leny = n; - - if (beta_r != ONE || beta_i != ZERO) SCAL_K(leny, 0, 0, beta_r, beta_i, y, abs(incy), NULL, 0, NULL, 0); - - if (alpha_r == ZERO && alpha_i == ZERO) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0) x -= (lenx - 1) * incx * 2; - if (incy < 0) y -= (leny - 1) * incy * 2; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (gbmv[(int)trans])(m, n, kl, ku, alpha_r, alpha_i, a, lda, x, incx, y, incy, buffer); - -#ifdef SMP - - } else { - - (gbmv_thread[(int)trans])(m, n, kl, ku, ALPHA, a, lda, x, incx, y, incy, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, m * n / 2 + n, m * n); - - IDEBUG_END; - - return; -} diff --git a/interface/zgemv.c b/interface/zgemv.c deleted file mode 100644 index fb4784202..000000000 --- a/interface/zgemv.c +++ /dev/null @@ -1,259 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XGEMV " -#elif defined(DOUBLE) -#define ERROR_NAME "ZGEMV " -#else -#define ERROR_NAME "CGEMV " -#endif - -#ifdef SMP -static int (*gemv_thread[])(BLASLONG, BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { -#ifdef XDOUBLE - xgemv_thread_n, xgemv_thread_t, xgemv_thread_r, xgemv_thread_c, xgemv_thread_o, xgemv_thread_u, xgemv_thread_s, xgemv_thread_d, -#elif defined DOUBLE - zgemv_thread_n, zgemv_thread_t, zgemv_thread_r, zgemv_thread_c, zgemv_thread_o, zgemv_thread_u, zgemv_thread_s, zgemv_thread_d, -#else - cgemv_thread_n, cgemv_thread_t, cgemv_thread_r, cgemv_thread_c, cgemv_thread_o, cgemv_thread_u, cgemv_thread_s, cgemv_thread_d, -#endif -}; -#endif - -#ifndef CBLAS - -void NAME(char *TRANS, blasint *M, blasint *N, - FLOAT *ALPHA, FLOAT *a, blasint *LDA, - FLOAT *x, blasint *INCX, - FLOAT *BETA, FLOAT *y, blasint *INCY){ - - char trans = *TRANS; - blasint m = *M; - blasint n = *N; - blasint lda = *LDA; - blasint incx = *INCX; - blasint incy = *INCY; - - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - int (*gemv[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, - FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { - GEMV_N, GEMV_T, GEMV_R, GEMV_C, - GEMV_O, GEMV_U, GEMV_S, GEMV_D, - }; - - blasint info; - blasint lenx, leny; - blasint i; - - PRINT_DEBUG_NAME; - - FLOAT alpha_r = *(ALPHA + 0); - FLOAT alpha_i = *(ALPHA + 1); - - FLOAT beta_r = *(BETA + 0); - FLOAT beta_i = *(BETA + 1); - - TOUPPER(trans); - - info = 0; - - i = -1; - - if (trans == 'N') i = 0; - if (trans == 'T') i = 1; - if (trans == 'R') i = 2; - if (trans == 'C') i = 3; - if (trans == 'O') i = 4; - if (trans == 'U') i = 5; - if (trans == 'S') i = 6; - if (trans == 'D') i = 7; - - if (incy == 0) info = 11; - if (incx == 0) info = 8; - if (lda < MAX(1,m)) info = 6; - if (n < 0) info = 3; - if (m < 0) info = 2; - if (i < 0) info = 1; - - trans = i; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, - enum CBLAS_TRANSPOSE TransA, - blasint m, blasint n, - FLOAT *ALPHA, - FLOAT *a, blasint lda, - FLOAT *x, blasint incx, - FLOAT *BETA, - FLOAT *y, blasint incy){ - - FLOAT *buffer; - blasint lenx, leny; - int trans; - blasint info, t; -#ifdef SMP - int nthreads; -#endif - - int (*gemv[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, - FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { - GEMV_N, GEMV_T, GEMV_R, GEMV_C, - GEMV_O, GEMV_U, GEMV_S, GEMV_D, - }; - - PRINT_DEBUG_CNAME; - - FLOAT alpha_r = *(ALPHA + 0); - FLOAT alpha_i = *(ALPHA + 1); - - FLOAT beta_r = *(BETA + 0); - FLOAT beta_i = *(BETA + 1); - - trans = -1; - info = 0; - - if (order == CblasColMajor) { - if (TransA == CblasNoTrans) trans = 0; - if (TransA == CblasTrans) trans = 1; - if (TransA == CblasConjNoTrans) trans = 2; - if (TransA == CblasConjTrans) trans = 3; - - info = -1; - - if (incy == 0) info = 11; - if (incx == 0) info = 8; - if (lda < MAX(1, m)) info = 6; - if (n < 0) info = 3; - if (m < 0) info = 2; - if (trans < 0) info = 1; - - } - - if (order == CblasRowMajor) { - if (TransA == CblasNoTrans) trans = 1; - if (TransA == CblasTrans) trans = 0; - if (TransA == CblasConjNoTrans) trans = 3; - if (TransA == CblasConjTrans) trans = 2; - - info = -1; - - t = n; - n = m; - m = t; - - if (incy == 0) info = 11; - if (incx == 0) info = 8; - if (lda < MAX(1, m)) info = 6; - if (n < 0) info = 3; - if (m < 0) info = 2; - if (trans < 0) info = 1; - - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - /* Quick return if possible. */ - - if (m == 0 || n == 0) return; - - lenx = n; - leny = m; - - if (trans & 1) lenx = m; - if (trans & 1) leny = n; - - if (beta_r != ONE || beta_i != ZERO) SCAL_K(leny, 0, 0, beta_r, beta_i, y, abs(incy), NULL, 0, NULL, 0); - - if (alpha_r == ZERO && alpha_i == ZERO) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0) x -= (lenx - 1) * incx * 2; - if (incy < 0) y -= (leny - 1) * incy * 2; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (gemv[(int)trans])(m, n, 0, alpha_r, alpha_i, a, lda, x, incx, y, incy, buffer); - -#ifdef SMP - - } else { - - (gemv_thread[(int)trans])(m, n, ALPHA, a, lda, x, incx, y, incy, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, m * n + m + n, 2 * m * n); - - IDEBUG_END; - - return; -} diff --git a/interface/zger.c b/interface/zger.c deleted file mode 100644 index ad52f40bb..000000000 --- a/interface/zger.c +++ /dev/null @@ -1,249 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#ifndef CONJ -#define ERROR_NAME "XGERU " -#else -#define ERROR_NAME "XGERC " -#endif -#elif defined DOUBLE -#ifndef CONJ -#define ERROR_NAME "ZGERU " -#else -#define ERROR_NAME "ZGERC " -#endif -#else -#ifndef CONJ -#define ERROR_NAME "CGERU " -#else -#define ERROR_NAME "CGERC " -#endif -#endif - -#if defined XDOUBLE -#ifndef CONJ -#define GER GERU_K -#define GER_THREAD xger_thread_U -#else -#define GER GERC_K -#define GER_THREAD xger_thread_C -#define GERV GERV_K -#define GERV_THREAD xger_thread_V -#endif -#elif defined DOUBLE -#ifndef CONJ -#define GER GERU_K -#define GER_THREAD zger_thread_U -#else -#define GER GERC_K -#define GER_THREAD zger_thread_C -#define GERV GERV_K -#define GERV_THREAD zger_thread_V -#endif -#else -#ifndef CONJ -#define GER GERU_K -#define GER_THREAD cger_thread_U -#else -#define GER GERC_K -#define GER_THREAD cger_thread_C -#define GERV GERV_K -#define GERV_THREAD cger_thread_V -#endif -#endif - -#ifndef CBLAS - -void NAME(blasint *M, blasint *N, FLOAT *Alpha, - FLOAT *x, blasint *INCX, - FLOAT *y, blasint *INCY, - FLOAT *a, blasint *LDA){ - - blasint m = *M; - blasint n = *N; - FLOAT alpha_r = Alpha[0]; - FLOAT alpha_i = Alpha[1]; - blasint incx = *INCX; - blasint incy = *INCY; - blasint lda = *LDA; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - blasint info; - - PRINT_DEBUG_NAME; - - info = 0; - - if (lda < MAX(1,m)) info = 9; - if (incy == 0) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (m < 0) info = 1; - - if (info){ - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, - blasint m, blasint n, - FLOAT *Alpha, - FLOAT *x, blasint incx, - FLOAT *y, blasint incy, - FLOAT *a, blasint lda) { - - FLOAT alpha_r = Alpha[0]; - FLOAT alpha_i = Alpha[1]; - - FLOAT *buffer; - blasint info, t; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_CNAME; - - info = 0; - - if (order == CblasColMajor) { - info = -1; - - if (lda < MAX(1,m)) info = 9; - if (incy == 0) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (m < 0) info = 1; - } - - if (order == CblasRowMajor) { - info = -1; - - t = n; - n = m; - m = t; - - t = incx; - incx = incy; - incy = t; - - buffer = x; - x = y; - y = buffer; - - if (lda < MAX(1,m)) info = 9; - if (incy == 0) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (m < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - /* Quick return if possible. */ - if (m == 0 || n == 0) return; - - if ((alpha_r == 0.) && (alpha_i == 0.)) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incy < 0) y -= (n - 1) * incy * 2; - if (incx < 0) x -= (m - 1) * incx * 2; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - -#if !defined(CBLAS) || !defined(CONJ) - GER(m, n, 0, alpha_r, alpha_i, x, incx, y, incy, a, lda, buffer); -#else - if (order == CblasColMajor) { - GER(m, n, 0, alpha_r, alpha_i, x, incx, y, incy, a, lda, buffer); - } else { - GERV(m, n, 0, alpha_r, alpha_i, x, incx, y, incy, a, lda, buffer); - } -#endif - -#ifdef SMP - - } else { - -#if !defined(CBLAS) || !defined(CONJ) - GER_THREAD(m, n, Alpha, x, incx, y, incy, a, lda, buffer, nthreads); -#else - if (order == CblasColMajor) { - GER_THREAD(m, n, Alpha, x, incx, y, incy, a, lda, buffer, nthreads); - } else { - GERV_THREAD(m, n, Alpha, x, incx, y, incy, a, lda, buffer, nthreads); - } -#endif - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, m * n + m + n, 2 * m * n); - - IDEBUG_END; - - return; - -} diff --git a/interface/zgetf2.c b/interface/zgetf2.c deleted file mode 100644 index 950ef46e9..000000000 --- a/interface/zgetf2.c +++ /dev/null @@ -1,109 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XGETF2" -#elif defined(DOUBLE) -#define ERROR_NAME "ZGETF2" -#else -#define ERROR_NAME "CGETF2" -#endif - -int NAME(blasint *M, blasint *N, FLOAT *a, blasint *ldA, blasint *ipiv, blasint *Info){ - - blas_arg_t args; - - blasint info; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.m = *M; - args.n = *N; - args.a = (void *)a; - args.lda = *ldA; - args.c = (void *)ipiv; - - info = 0; - if (args.lda < MAX(1,args.m)) info = 4; - if (args.n < 0) info = 2; - if (args.m < 0) info = 1; - if (info) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - *Info = - info; - return 0; - } - - *Info = 0; - if (args.m == 0 || args.n == 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - - info = GETF2(&args, NULL, NULL, sa, sb, 0); - - *Info = info; - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.m * args.n, 2. / 3. * args.m * args.n * args.n); - - IDEBUG_END; - - return 0; -} diff --git a/interface/zgetrf.c b/interface/zgetrf.c deleted file mode 100644 index 9f041d9bd..000000000 --- a/interface/zgetrf.c +++ /dev/null @@ -1,122 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XGETRF" -#elif defined(DOUBLE) -#define ERROR_NAME "ZGETRF" -#else -#define ERROR_NAME "CGETRF" -#endif - -int NAME(blasint *M, blasint *N, FLOAT *a, blasint *ldA, blasint *ipiv, blasint *Info){ - - blas_arg_t args; - - blasint info; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.m = *M; - args.n = *N; - args.a = (void *)a; - args.lda = *ldA; - args.c = (void *)ipiv; - - info = 0; - if (args.lda < MAX(1,args.m)) info = 4; - if (args.n < 0) info = 2; - if (args.m < 0) info = 1; - if (info) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - *Info = - info; - return 0; - } - - *Info = 0; - if (args.m == 0 || args.n == 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - -#ifdef SMP - args.common = NULL; - args.nthreads = num_cpu_avail(4); - - if (args.nthreads == 1) { -#endif - - *Info = GETRF_SINGLE(&args, NULL, NULL, sa, sb, 0); - -#ifdef SMP - } else { - - *Info = GETRF_PARALLEL(&args, NULL, NULL, sa, sb, 0); - - } -#endif - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.m * args.n, 2. / 3. * args.m * args.n * args.n); - - IDEBUG_END; - - return 0; -} diff --git a/interface/zgetrs.c b/interface/zgetrs.c deleted file mode 100644 index 81d50e34f..000000000 --- a/interface/zgetrs.c +++ /dev/null @@ -1,153 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XGETRS" -#elif defined(DOUBLE) -#define ERROR_NAME "ZGETRS" -#else -#define ERROR_NAME "CGETRS" -#endif - -static blasint (*getrs_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ - GETRS_N_SINGLE, GETRS_T_SINGLE, GETRS_R_SINGLE, GETRS_C_SINGLE, -}; - -#ifdef SMP -static blasint (*getrs_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ - GETRS_N_PARALLEL, GETRS_T_PARALLEL, GETRS_R_PARALLEL, GETRS_C_PARALLEL, -}; -#endif - -int NAME(char *TRANS, blasint *N, blasint *NRHS, FLOAT *a, blasint *ldA, - blasint *ipiv, FLOAT *b, blasint *ldB, blasint *Info){ - - char trans_arg = *TRANS; - - blas_arg_t args; - - blasint info; - int trans; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.m = *N; - args.n = *NRHS; - args.a = (void *)a; - args.lda = *ldA; - args.b = (void *)b; - args.ldb = *ldB; - args.c = (void *)ipiv; - - info = 0; - - TOUPPER(trans_arg); - trans = -1; - - if (trans_arg == 'N') trans = 0; - if (trans_arg == 'T') trans = 1; - if (trans_arg == 'R') trans = 2; - if (trans_arg == 'C') trans = 3; - - if (args.ldb < MAX(1, args.m)) info = 8; - if (args.lda < MAX(1, args.m)) info = 5; - if (args.n < 0) info = 3; - if (args.m < 0) info = 2; - if (trans < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return 0; - } - - args.alpha = NULL; - args.beta = NULL; - - *Info = info; - - if (args.m == 0 || args.n == 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - -#ifdef SMP - args.nthreads = num_cpu_avail(4); - - if (args.nthreads == 1) { -#endif - - (getrs_single[trans])(&args, NULL, NULL, sa, sb, 0); - -#ifdef SMP - } else { - - (getrs_parallel[trans])(&args, NULL, NULL, sa, sb, 0); - - } -#endif - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.m * args.n, 2 * args.m * args.m * args.n); - - IDEBUG_END; - - return 0; - -} diff --git a/interface/zhbmv.c b/interface/zhbmv.c deleted file mode 100644 index c14ad9859..000000000 --- a/interface/zhbmv.c +++ /dev/null @@ -1,223 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XHBMV " -#elif defined(DOUBLE) -#define ERROR_NAME "ZHBMV " -#else -#define ERROR_NAME "CHBMV " -#endif - -static int (*hbmv[])(BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { -#ifdef XDOUBLE - xhbmv_U, xhbmv_L, xhbmv_V, xhbmv_M, -#elif defined(DOUBLE) - zhbmv_U, zhbmv_L, zhbmv_V, zhbmv_M, -#else - chbmv_U, chbmv_L, chbmv_V, chbmv_M, -#endif -}; - -#ifdef SMP -static int (*hbmv_thread[])(BLASLONG, BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { -#ifdef XDOUBLE - xhbmv_thread_U, xhbmv_thread_L, xhbmv_thread_V, xhbmv_thread_M, -#elif defined(DOUBLE) - zhbmv_thread_U, zhbmv_thread_L, zhbmv_thread_V, zhbmv_thread_M, -#else - chbmv_thread_U, chbmv_thread_L, chbmv_thread_V, chbmv_thread_M, -#endif -}; -#endif - -#ifndef CBLAS - -void NAME(char *UPLO, blasint *N, blasint *K, FLOAT *ALPHA, FLOAT *a, blasint *LDA, - FLOAT *x, blasint *INCX, FLOAT *BETA, FLOAT *y, blasint *INCY){ - - char uplo_arg = *UPLO; - blasint n = *N; - blasint k = *K; - FLOAT alpha_r = ALPHA[0]; - FLOAT alpha_i = ALPHA[1]; - blasint lda = *LDA; - blasint incx = *INCX; - FLOAT beta_r = BETA[0]; - FLOAT beta_i = BETA[1]; - blasint incy = *INCY; - - blasint info; - int uplo; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - uplo = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - if (uplo_arg == 'V') uplo = 2; - if (uplo_arg == 'M') uplo = 3; - - info = 0; - - if (incy == 0) info = 11; - if (incx == 0) info = 8; - if (lda < k + 1) info = 6; - if (k < 0) info = 3; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, - enum CBLAS_UPLO Uplo, - blasint n, blasint k, - FLOAT *ALPHA, - FLOAT *a, blasint lda, - FLOAT *x, blasint incx, - FLOAT *BETA, - FLOAT *y, blasint incy){ - - FLOAT alpha_r = ALPHA[0]; - FLOAT alpha_i = ALPHA[1]; - FLOAT beta_r = BETA[0]; - FLOAT beta_i = BETA[1]; - FLOAT *buffer; - int uplo; - blasint info; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_CNAME; - - uplo = -1; - info = 0; - - if (order == CblasColMajor) { - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - info = -1; - - if (incy == 0) info = 11; - if (incx == 0) info = 8; - if (lda < k + 1) info = 6; - if (k < 0) info = 3; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (Uplo == CblasUpper) uplo = 3; - if (Uplo == CblasLower) uplo = 2; - - info = -1; - - if (incy == 0) info = 11; - if (incx == 0) info = 8; - if (lda < k + 1) info = 6; - if (k < 0) info = 3; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - if ((beta_r != ONE) || (beta_i != ZERO)) SCAL_K(n, 0, 0, beta_r, beta_i, y, abs(incy), NULL, 0, NULL, 0); - - if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx * COMPSIZE; - if (incy < 0 ) y -= (n - 1) * incy * COMPSIZE; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (hbmv[uplo])(n, k, alpha_r, alpha_i, a, lda, x, incx, y, incy, buffer); - -#ifdef SMP - } else { - - (hbmv_thread[uplo])(n, k, ALPHA, a, lda, x, incx, y, incy, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, n * k / 2 + n, n * k); - - IDEBUG_END; - - return; -} diff --git a/interface/zhemv.c b/interface/zhemv.c deleted file mode 100644 index 3cba445c2..000000000 --- a/interface/zhemv.c +++ /dev/null @@ -1,215 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XHEMV " -#elif defined(DOUBLE) -#define ERROR_NAME "ZHEMV " -#else -#define ERROR_NAME "CHEMV " -#endif - -#ifndef CBLAS - -void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, blasint *LDA, - FLOAT *x, blasint *INCX, FLOAT *BETA, FLOAT *y, blasint *INCY){ - - char uplo_arg = *UPLO; - blasint n = *N; - FLOAT alpha_r = ALPHA[0]; - FLOAT alpha_i = ALPHA[1]; - blasint lda = *LDA; - blasint incx = *INCX; - FLOAT beta_r = BETA[0]; - FLOAT beta_i = BETA[1]; - blasint incy = *INCY; -#ifdef SMP - int nthreads; -#endif - - int (*hemv[])(BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { - HEMV_U, HEMV_L, HEMV_V, HEMV_M, - }; - -#ifdef SMP - int (*hemv_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { - HEMV_THREAD_U, HEMV_THREAD_L, HEMV_THREAD_V, HEMV_THREAD_M, - }; -#endif - - blasint info; - int uplo; - FLOAT *buffer; - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - uplo = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - if (uplo_arg == 'V') uplo = 2; - if (uplo_arg == 'M') uplo = 3; - - info = 0; - - if (incy == 0) info = 10; - if (incx == 0) info = 7; - if (lda < MAX(1, n)) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT *ALPHA, - FLOAT *a, blasint lda, FLOAT *x, blasint incx, FLOAT *BETA, FLOAT *y, blasint incy) { - - FLOAT alpha_r = ALPHA[0]; - FLOAT alpha_i = ALPHA[1]; - FLOAT beta_r = BETA[0]; - FLOAT beta_i = BETA[1]; - - FLOAT *buffer; - int trans, uplo; - blasint info; -#ifdef SMP - int nthreads; -#endif - - int (*hemv[])(BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { - HEMV_U, HEMV_L, HEMV_V, HEMV_M, - }; - -#ifdef SMP - int (*hemv_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { - HEMV_THREAD_U, HEMV_THREAD_L, HEMV_THREAD_V, HEMV_THREAD_M, - }; -#endif - - PRINT_DEBUG_CNAME; - - trans = -1; - uplo = -1; - info = 0; - - if (order == CblasColMajor) { - - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - info = -1; - - if (incy == 0) info = 10; - if (incx == 0) info = 7; - if (lda < MAX(1, n)) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - - if (Uplo == CblasUpper) uplo = 3; - if (Uplo == CblasLower) uplo = 2; - - info = -1; - - if (incy == 0) info = 10; - if (incx == 0) info = 7; - if (lda < MAX(1, n)) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - if ((beta_r != ONE) || (beta_i != ZERO)) SCAL_K(n, 0, 0, beta_r, beta_i, y, abs(incy), NULL, 0, NULL, 0); - - if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx * 2; - if (incy < 0 ) y -= (n - 1) * incy * 2; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (hemv[uplo])(n, n, alpha_r, alpha_i, a, lda, x, incx, y, incy, buffer); - -#ifdef SMP - } else { - - (hemv_thread[uplo])(n, ALPHA, a, lda, x, incx, y, incy, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, n * n / 2 + n, 2 * n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/zher.c b/interface/zher.c deleted file mode 100644 index ad982dd68..000000000 --- a/interface/zher.c +++ /dev/null @@ -1,200 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XHER " -#elif defined(DOUBLE) -#define ERROR_NAME "ZHER " -#else -#define ERROR_NAME "CHER " -#endif - -static int (*her[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { -#ifdef XDOUBLE - xher_U, xher_L, xher_V, xher_M, -#elif defined(DOUBLE) - zher_U, zher_L, zher_V, zher_M, -#else - cher_U, cher_L, cher_V, cher_M, -#endif -}; - -#ifdef SMP -static int (*her_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { -#ifdef XDOUBLE - xher_thread_U, xher_thread_L, xher_thread_V, xher_thread_M, -#elif defined(DOUBLE) - zher_thread_U, zher_thread_L, zher_thread_V, zher_thread_M, -#else - cher_thread_U, cher_thread_L, cher_thread_V, cher_thread_M, -#endif -}; -#endif - -#ifndef CBLAS - -void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, - FLOAT *x, blasint *INCX, FLOAT *a, blasint *LDA){ - - char uplo_arg = *UPLO; - blasint n = *N; - FLOAT alpha = *ALPHA; - blasint lda = *LDA; - blasint incx = *INCX; - - blasint info; - int uplo; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - uplo = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (lda < MAX(1, n)) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, FLOAT *x, blasint incx, FLOAT *a, blasint lda) { - - FLOAT *buffer; - int trans, uplo; - blasint info; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_CNAME; - - trans = -1; - uplo = -1; - info = 0; - - if (order == CblasColMajor) { - - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - info = -1; - - if (lda < MAX(1, n)) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - } - - if (order == CblasRowMajor) { - - if (Uplo == CblasUpper) uplo = 3; - if (Uplo == CblasLower) uplo = 2; - - info = -1; - - if (lda < MAX(1, n)) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - if (alpha == ZERO) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx * 2; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (her[uplo])(n, alpha, x, incx, a, lda, buffer); - -#ifdef SMP - } else { - - (her_thread[uplo])(n, alpha, x, incx, a, lda, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/zher2.c b/interface/zher2.c deleted file mode 100644 index 88fececf7..000000000 --- a/interface/zher2.c +++ /dev/null @@ -1,207 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XHER2 " -#elif defined(DOUBLE) -#define ERROR_NAME "ZHER2 " -#else -#define ERROR_NAME "CHER2 " -#endif - -static int (*her2[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { -#ifdef XDOUBLE - xher2_U, xher2_L, xher2_V, xher2_M, -#elif defined(DOUBLE) - zher2_U, zher2_L, zher2_V, zher2_M, -#else - cher2_U, cher2_L, cher2_V, cher2_M, -#endif -}; - -#ifdef SMP -static int (*her2_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { -#ifdef XDOUBLE - xher2_thread_U, xher2_thread_L, xher2_thread_V, xher2_thread_M, -#elif defined(DOUBLE) - zher2_thread_U, zher2_thread_L, zher2_thread_V, zher2_thread_M, -#else - cher2_thread_U, cher2_thread_L, cher2_thread_V, cher2_thread_M, -#endif -}; -#endif - -#ifndef CBLAS - -void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, - FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *a, blasint *LDA){ - - char uplo_arg = *UPLO; - blasint n = *N; - FLOAT alpha_r = ALPHA[0]; - FLOAT alpha_i = ALPHA[1]; - blasint lda = *LDA; - blasint incx = *INCX; - blasint incy = *INCY; - - blasint info; - int uplo; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - uplo = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (lda < MAX(1, n)) info = 9; - if (incy == 0) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT *ALPHA, FLOAT *x, blasint incx, FLOAT *y, blasint incy, FLOAT *a, blasint lda) { - - FLOAT alpha_r = ALPHA[0]; - FLOAT alpha_i = ALPHA[1]; - FLOAT *buffer; - int trans, uplo; - blasint info; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_CNAME; - - trans = -1; - uplo = -1; - info = 0; - - if (order == CblasColMajor) { - - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - info = -1; - - if (lda < MAX(1, n)) info = 9; - if (incy == 0) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - - if (Uplo == CblasUpper) uplo = 3; - if (Uplo == CblasLower) uplo = 2; - - info = -1; - - if (lda < MAX(1, n)) info = 9; - if (incx == 0) info = 7; - if (incy == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx * 2; - if (incy < 0 ) y -= (n - 1) * incy * 2; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (her2[uplo])(n, alpha_r, alpha_i, x, incx, y, incy, a, lda, buffer); - -#ifdef SMP - } else { - - (her2_thread[uplo])(n, ALPHA, x, incx, y, incy, a, lda, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, n * n / 2 + 2 * n, 2 * n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/zhpmv.c b/interface/zhpmv.c deleted file mode 100644 index d7013e668..000000000 --- a/interface/zhpmv.c +++ /dev/null @@ -1,213 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XHPMV " -#elif defined(DOUBLE) -#define ERROR_NAME "ZHPMV " -#else -#define ERROR_NAME "CHPMV " -#endif - -static int (*hpmv[])(BLASLONG, FLOAT, FLOAT, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { -#ifdef XDOUBLE - xhpmv_U, xhpmv_L, xhpmv_V, xhpmv_M, -#elif defined(DOUBLE) - zhpmv_U, zhpmv_L, zhpmv_V, zhpmv_M, -#else - chpmv_U, chpmv_L, chpmv_V, chpmv_M, -#endif -}; - -#ifdef SMP -static int (*hpmv_thread[])(BLASLONG, FLOAT *, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { -#ifdef XDOUBLE - xhpmv_thread_U, xhpmv_thread_L, xhpmv_thread_V, xhpmv_thread_M, -#elif defined(DOUBLE) - zhpmv_thread_U, zhpmv_thread_L, zhpmv_thread_V, zhpmv_thread_M, -#else - chpmv_thread_U, chpmv_thread_L, chpmv_thread_V, chpmv_thread_M, -#endif -}; -#endif - -#ifndef CBLAS - -void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, - FLOAT *x, blasint *INCX, FLOAT *BETA, FLOAT *y, blasint *INCY){ - - char uplo_arg = *UPLO; - blasint n = *N; - FLOAT alpha_r = ALPHA[0]; - FLOAT alpha_i = ALPHA[1]; - blasint incx = *INCX; - FLOAT beta_r = BETA[0]; - FLOAT beta_i = BETA[1]; - blasint incy = *INCY; - - blasint info; - int uplo; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - uplo = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incy == 0) info = 9; - if (incx == 0) info = 6; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, - enum CBLAS_UPLO Uplo, - blasint n, - FLOAT *ALPHA, - FLOAT *a, - FLOAT *x, blasint incx, - FLOAT *BETA, - FLOAT *y, blasint incy){ - - FLOAT alpha_r = ALPHA[0]; - FLOAT alpha_i = ALPHA[1]; - FLOAT beta_r = BETA[0]; - FLOAT beta_i = BETA[1]; - FLOAT *buffer; - int uplo; - blasint info; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_CNAME; - - uplo = -1; - info = 0; - - if (order == CblasColMajor) { - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - info = -1; - - if (incy == 0) info = 9; - if (incx == 0) info = 6; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (Uplo == CblasUpper) uplo = 3; - if (Uplo == CblasLower) uplo = 2; - - info = -1; - - if (incy == 0) info = 9; - if (incx == 0) info = 6; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - if ((beta_r != ONE) || (beta_i != ZERO)) SCAL_K(n, 0, 0, beta_r, beta_i, y, abs(incy), NULL, 0, NULL, 0); - - if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx * 2; - if (incy < 0 ) y -= (n - 1) * incy * 2; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (hpmv[uplo])(n, alpha_r, alpha_i, a, x, incx, y, incy, buffer); - -#ifdef SMP - } else { - - (hpmv_thread[uplo])(n, ALPHA, a, x, incx, y, incy, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/zhpr.c b/interface/zhpr.c deleted file mode 100644 index c48e35238..000000000 --- a/interface/zhpr.c +++ /dev/null @@ -1,198 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XHPR " -#elif defined(DOUBLE) -#define ERROR_NAME "ZHPR " -#else -#define ERROR_NAME "CHPR " -#endif - -static int (*hpr[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, FLOAT *) = { -#ifdef XDOUBLE - xhpr_U, xhpr_L, xhpr_V, xhpr_M, -#elif defined(DOUBLE) - zhpr_U, zhpr_L, zhpr_V, zhpr_M, -#else - chpr_U, chpr_L, chpr_V, chpr_M, -#endif -}; - -#ifdef SMP -static int (*hpr_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = { -#ifdef XDOUBLE - xhpr_thread_U, xhpr_thread_L, xhpr_thread_V, xhpr_thread_M, -#elif defined(DOUBLE) - zhpr_thread_U, zhpr_thread_L, zhpr_thread_V, zhpr_thread_M, -#else - chpr_thread_U, chpr_thread_L, chpr_thread_V, chpr_thread_M, -#endif -}; -#endif - -#ifndef CBLAS - -void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, - FLOAT *x, blasint *INCX, FLOAT *a){ - - char uplo_arg = *UPLO; - blasint n = *N; - FLOAT alpha = *ALPHA; - blasint incx = *INCX; - - blasint info; - int uplo; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - uplo = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, - enum CBLAS_UPLO Uplo, - blasint n, - FLOAT alpha, - FLOAT *x, blasint incx, - FLOAT *a) { - - FLOAT *buffer; - int uplo; - blasint info; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_CNAME; - - uplo = -1; - info = 0; - - if (order == CblasColMajor) { - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - info = -1; - - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (Uplo == CblasUpper) uplo = 3; - if (Uplo == CblasLower) uplo = 2; - - info = -1; - - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - if (alpha == ZERO) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx * 2; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (hpr[uplo])(n, alpha, x, incx, a, buffer); - -#ifdef SMP - - } else { - - (hpr_thread[uplo])(n, alpha, x, incx, a, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/zhpr2.c b/interface/zhpr2.c deleted file mode 100644 index cf1d5f9fc..000000000 --- a/interface/zhpr2.c +++ /dev/null @@ -1,207 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XHPR2 " -#elif defined(DOUBLE) -#define ERROR_NAME "ZHPR2 " -#else -#define ERROR_NAME "CHPR2 " -#endif - -static int (*hpr2[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, FLOAT *) = { -#ifdef XDOUBLE - xhpr2_U, xhpr2_L, xhpr2_V, xhpr2_M, -#elif defined(DOUBLE) - zhpr2_U, zhpr2_L, zhpr2_V, zhpr2_M, -#else - chpr2_U, chpr2_L, chpr2_V, chpr2_M, -#endif -}; - -#ifdef SMP -static int (*hpr2_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = { -#ifdef XDOUBLE - xhpr2_thread_U, xhpr2_thread_L, xhpr2_thread_V, xhpr2_thread_M, -#elif defined(DOUBLE) - zhpr2_thread_U, zhpr2_thread_L, zhpr2_thread_V, zhpr2_thread_M, -#else - chpr2_thread_U, chpr2_thread_L, chpr2_thread_V, chpr2_thread_M, -#endif -}; -#endif - -#ifndef CBLAS - -void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, - FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *a){ - - char uplo_arg = *UPLO; - blasint n = *N; - FLOAT alpha_r = ALPHA[0]; - FLOAT alpha_i = ALPHA[1]; - blasint incx = *INCX; - blasint incy = *INCY; - - blasint info; - int uplo; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - uplo = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incy == 0) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, - enum CBLAS_UPLO Uplo, - blasint n, - FLOAT *ALPHA, - FLOAT *x, blasint incx, - FLOAT *y, blasint incy, - FLOAT *a) { - - FLOAT alpha_r = ALPHA[0]; - FLOAT alpha_i = ALPHA[1]; - FLOAT *buffer; - int uplo; - blasint info; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_CNAME; - - uplo = -1; - info = 0; - - if (order == CblasColMajor) { - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - info = -1; - - if (incy == 0) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (Uplo == CblasUpper) uplo = 3; - if (Uplo == CblasLower) uplo = 2; - - info = -1; - - if (incx == 0) info = 7; - if (incy == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; - - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx * 2; - if (incy < 0 ) y -= (n - 1) * incy * 2; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (hpr2[uplo])(n, alpha_r, alpha_i, x, incx, y, incy, a, buffer); - -#ifdef SMP - } else { - - (hpr2_thread[uplo])(n, ALPHA, x, incx, y, incy, a, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, n * n / 2 + 2 * n, 2 * n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/zlaswp.c b/interface/zlaswp.c deleted file mode 100644 index 85ead2c86..000000000 --- a/interface/zlaswp.c +++ /dev/null @@ -1,108 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -static int (*laswp[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, blasint *, BLASLONG) = { -#ifdef XDOUBLE - xlaswp_plus, xlaswp_minus, -#elif defined(DOUBLE) - zlaswp_plus, zlaswp_minus, -#else - claswp_plus, claswp_minus, -#endif -}; - -int NAME(blasint *N, FLOAT *a, blasint *LDA, blasint *K1, blasint *K2, blasint *ipiv, blasint *INCX){ - - blasint n = *N; - blasint lda = *LDA; - blasint k1 = *K1; - blasint k2 = *K2; - blasint incx = *INCX; - int flag; - -#ifdef SMP - int mode; - FLOAT dummyalpha[2] = {ZERO, ZERO}; - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - if (incx == 0 || n <= 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - flag = (incx < 0); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (laswp[flag])(n, k1, k2, ZERO, ZERO, a, lda, NULL, 0, ipiv, incx); - -#ifdef SMP - } else { - -#ifdef XDOUBLE - mode = BLAS_XDOUBLE | BLAS_COMPLEX; -#elif defined(DOUBLE) - mode = BLAS_DOUBLE | BLAS_COMPLEX; -#else - mode = BLAS_SINGLE | BLAS_COMPLEX; -#endif - - blas_level1_thread(mode, n, k1, k2, dummyalpha, a, lda, NULL, 0, ipiv, incx, laswp[flag], nthreads); - } -#endif - - FUNCTION_PROFILE_END(COMPSIZE, n * (k2 - k1), 0); - - IDEBUG_END; - - return 0; -} diff --git a/interface/zlauu2.c b/interface/zlauu2.c deleted file mode 100644 index 05603fe1b..000000000 --- a/interface/zlauu2.c +++ /dev/null @@ -1,129 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QLAUU2" -#elif defined(DOUBLE) -#define ERROR_NAME "ZLAUU2" -#else -#define ERROR_NAME "CLAUU2" -#endif - -static blasint (*lauu2[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { - -#ifdef XDOUBLE - xlauu2_U, xlauu2_L, -#elif defined(DOUBLE) - zlauu2_U, zlauu2_L, -#else - clauu2_U, clauu2_L, -#endif - }; - -int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ - - blas_arg_t args; - - blasint uplo_arg = *UPLO; - blasint uplo; - blasint info; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.n = *N; - args.a = (void *)a; - args.lda = *ldA; - - TOUPPER(uplo_arg); - - uplo = -1; - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - if (args.lda < MAX(1,args.n)) info = 4; - if (args.n < 0) info = 2; - if (uplo < 0) info = 1; - if (info) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - *Info = - info; - return 0; - } - - *Info = 0; - - if (args.n <= 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - - info = (lauu2[uplo])(&args, NULL, NULL, sa, sb, 0); - - *Info = info; - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(1, .5 * args.n * args.n, - 2. * args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) - + 6. * 1./6. * args.n * (args.n * args.n - 1)); - - IDEBUG_END; - - return 0; -} diff --git a/interface/zlauum.c b/interface/zlauum.c deleted file mode 100644 index 23990e8e4..000000000 --- a/interface/zlauum.c +++ /dev/null @@ -1,141 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XLAUUM" -#elif defined(DOUBLE) -#define ERROR_NAME "ZLAUUM" -#else -#define ERROR_NAME "CLAUUM" -#endif - -static blasint (*lauum_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { - LAUUM_U_SINGLE, LAUUM_L_SINGLE, -}; - -#ifdef SMP -static blasint (*lauum_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { - LAUUM_U_PARALLEL, LAUUM_L_PARALLEL, -}; -#endif - -int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ - - blas_arg_t args; - - blasint uplo_arg = *UPLO; - blasint uplo; - blasint info; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.n = *N; - args.a = (void *)a; - args.lda = *ldA; - - TOUPPER(uplo_arg); - - uplo = -1; - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - if (args.lda < MAX(1,args.n)) info = 4; - if (args.n < 0) info = 2; - if (uplo < 0) info = 1; - if (info) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - *Info = - info; - return 0; - } - - *Info = 0; - - if (args.n == 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - -#ifdef SMP - args.common = NULL; - args.nthreads = num_cpu_avail(4); - - if (args.nthreads == 1) { -#endif - - *Info = (lauum_single[uplo])(&args, NULL, NULL, sa, sb, 0); - -#ifdef SMP - } else { - - *Info = (lauum_parallel[uplo])(&args, NULL, NULL, sa, sb, 0); - - } -#endif - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(1, .5 * args.n * args.n, - 2. * args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) - + args.n * (args.n * args.n - 1)); - - IDEBUG_END; - - return 0; -} diff --git a/interface/zpotf2.c b/interface/zpotf2.c deleted file mode 100644 index f8f81e2c5..000000000 --- a/interface/zpotf2.c +++ /dev/null @@ -1,129 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XPOTF2" -#elif defined(DOUBLE) -#define ERROR_NAME "ZPOTF2" -#else -#define ERROR_NAME "CPOTF2" -#endif - -static blasint (*potf2[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { - -#ifdef XDOUBLE - xpotf2_U, xpotf2_L, -#elif defined(DOUBLE) - zpotf2_U, zpotf2_L, -#else - cpotf2_U, cpotf2_L, -#endif - }; - -int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ - - blas_arg_t args; - - blasint uplo_arg = *UPLO; - blasint uplo; - blasint info; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.n = *N; - args.a = (void *)a; - args.lda = *ldA; - - TOUPPER(uplo_arg); - - uplo = -1; - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - if (args.lda < MAX(1,args.n)) info = 4; - if (args.n < 0) info = 2; - if (uplo < 0) info = 1; - if (info) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - *Info = - info; - return 0; - } - - *Info = 0; - - if (args.n <= 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - - info = (potf2[uplo])(&args, NULL, NULL, sa, sb, 0); - - *Info = info; - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(1, .5 * args.n * args.n, - 2. * args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) - + 6. * 1./6. * args.n * (args.n * args.n - 1)); - - IDEBUG_END; - - return 0; -} diff --git a/interface/zpotrf.c b/interface/zpotrf.c deleted file mode 100644 index e2004d744..000000000 --- a/interface/zpotrf.c +++ /dev/null @@ -1,141 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XPOTRF" -#elif defined(DOUBLE) -#define ERROR_NAME "ZPOTRF" -#else -#define ERROR_NAME "CPOTRF" -#endif - -static blasint (*potrf_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ - POTRF_U_SINGLE, POTRF_L_SINGLE, -}; - -#ifdef SMP -static blasint (*potrf_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ - POTRF_U_PARALLEL, POTRF_L_PARALLEL, -}; -#endif - -int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ - - blas_arg_t args; - - blasint uplo_arg = *UPLO; - blasint uplo; - blasint info; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.n = *N; - args.a = (void *)a; - args.lda = *ldA; - - TOUPPER(uplo_arg); - - uplo = -1; - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - if (args.lda < MAX(1,args.n)) info = 4; - if (args.n < 0) info = 2; - if (uplo < 0) info = 1; - if (info) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - *Info = - info; - return 0; - } - - *Info = 0; - - if (args.n == 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - -#ifdef SMP - args.common = NULL; - args.nthreads = num_cpu_avail(4); - - if (args.nthreads == 1) { -#endif - - *Info = (potrf_single[uplo])(&args, NULL, NULL, sa, sb, 0); - -#ifdef SMP - } else { - - *Info = (potrf_parallel[uplo])(&args, NULL, NULL, sa, sb, 0); - - } -#endif - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(1, .5 * args.n * args.n, - 2. * args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) - + 6. * 1./6. * args.n * (args.n * args.n - 1)); - - IDEBUG_END; - - return 0; -} diff --git a/interface/zpotri.c b/interface/zpotri.c deleted file mode 100644 index df325424e..000000000 --- a/interface/zpotri.c +++ /dev/null @@ -1,157 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XPOTRI" -#elif defined(DOUBLE) -#define ERROR_NAME "ZPOTRI" -#else -#define ERROR_NAME "CPOTRI" -#endif - -static blasint (*trtri_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ - TRTRI_UN_SINGLE, TRTRI_LN_SINGLE, -}; - -static blasint (*lauum_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ - LAUUM_U_SINGLE, LAUUM_L_SINGLE, -}; - -#ifdef SMP -static blasint (*trtri_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ - TRTRI_UN_PARALLEL, TRTRI_LN_PARALLEL, -}; - -static blasint (*lauum_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ - LAUUM_U_PARALLEL, LAUUM_L_PARALLEL, -}; -#endif - -int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ - - blas_arg_t args; - - blasint uplo_arg = *UPLO; - blasint uplo; - blasint info; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.n = *N; - args.a = (void *)a; - args.lda = *ldA; - - TOUPPER(uplo_arg); - - uplo = -1; - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - if (args.lda < MAX(1,args.n)) info = 4; - if (args.n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - *Info = - info; - return 0; - } - - *Info = 0; - - if (args.n == 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - -#ifdef SMP - args.nthreads = num_cpu_avail(4); - - if (args.nthreads == 1) { -#endif - - info = (trtri_single[uplo])(&args, NULL, NULL, sa, sb, 0); - - if (!info) { - info = (lauum_single[uplo])(&args, NULL, NULL, sa, sb, 0); - } - - *Info = info; - -#ifdef SMP - } else { - info = (trtri_parallel[uplo])(&args, NULL, NULL, sa, sb, 0); - - if (!info) { - info = (lauum_parallel[uplo])(&args, NULL, NULL, sa, sb, 0); - } - - *Info = info; - } -#endif - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.m * args.n, 2. / 3. * args.m * args.n * args.n); - - IDEBUG_END; - - return 0; -} diff --git a/interface/zrot.c b/interface/zrot.c deleted file mode 100644 index f18bbc6d1..000000000 --- a/interface/zrot.c +++ /dev/null @@ -1,72 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -void NAME(blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *C, FLOAT *S){ - - BLASLONG n = *N; - BLASLONG incx = *INCX; - BLASLONG incy = *INCY; - FLOAT c = *C; - FLOAT s = *S; - - PRINT_DEBUG_NAME; - - if (n <= 0) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0) x -= (n - 1) * 2 * incx; - if (incy < 0) y -= (n - 1) * 2 * incy; - - ROT_K(n, x, incx, y, incy, c, s); - - FUNCTION_PROFILE_END(4, n, n); - - IDEBUG_END; - - return; - -} diff --git a/interface/zrotg.c b/interface/zrotg.c deleted file mode 100644 index e9e8a11df..000000000 --- a/interface/zrotg.c +++ /dev/null @@ -1,115 +0,0 @@ -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -void NAME(FLOAT *DA, FLOAT *DB, FLOAT *C, FLOAT *S){ - - PRINT_DEBUG_NAME; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__) - - long double da_r = *(DA + 0); - long double da_i = *(DA + 1); - long double db_r = *(DB + 0); - long double db_i = *(DB + 1); - long double r; - - long double ada = fabs(da_r) + fabs(da_i); - - if (ada == ZERO) { - *C = ZERO; - *(S + 0) = ONE; - *(S + 1) = ZERO; - *(DA + 0) = db_r; - *(DA + 1) = db_i; - } else { - long double alpha_r, alpha_i; - - ada = sqrt(da_r * da_r + da_i * da_i); - - r = sqrt(da_r * da_r + da_i * da_i + db_r * db_r + db_i * db_i); - - alpha_r = da_r / ada; - alpha_i = da_i / ada; - - *(C + 0) = ada / r; - *(S + 0) = (alpha_r * db_r + alpha_i *db_i) / r; - *(S + 1) = (alpha_i * db_r - alpha_r *db_i) / r; - *(DA + 0) = alpha_r * r; - *(DA + 1) = alpha_i * r; - } -#else - FLOAT da_r = *(DA + 0); - FLOAT da_i = *(DA + 1); - FLOAT db_r = *(DB + 0); - FLOAT db_i = *(DB + 1); - FLOAT r; - - FLOAT ada = fabs(da_r) + fabs(da_i); - FLOAT adb; - - if (ada == ZERO) { - *C = ZERO; - *(S + 0) = ONE; - *(S + 1) = ZERO; - *(DA + 0) = db_r; - *(DA + 1) = db_i; - } else { - FLOAT scale; - FLOAT aa_r, aa_i, bb_r, bb_i; - FLOAT alpha_r, alpha_i; - - aa_r = fabs(da_r); - aa_i = fabs(da_i); - - if (aa_i > aa_r) { - aa_r = fabs(da_i); - aa_i = fabs(da_r); - } - - scale = (aa_i / aa_r); - ada = aa_r * sqrt(ONE + scale * scale); - - bb_r = fabs(db_r); - bb_i = fabs(db_i); - - if (bb_i > bb_r) { - bb_r = fabs(bb_i); - bb_i = fabs(bb_r); - } - - scale = (bb_i / bb_r); - adb = bb_r * sqrt(ONE + scale * scale); - - scale = ada + adb; - - aa_r = da_r / scale; - aa_i = da_i / scale; - bb_r = db_r / scale; - bb_i = db_i / scale; - - r = scale * sqrt(aa_r * aa_r + aa_i * aa_i + bb_r * bb_r + bb_i * bb_i); - - alpha_r = da_r / ada; - alpha_i = da_i / ada; - - *(C + 0) = ada / r; - *(S + 0) = (alpha_r * db_r + alpha_i *db_i) / r; - *(S + 1) = (alpha_i * db_r - alpha_r *db_i) / r; - *(DA + 0) = alpha_r * r; - *(DA + 1) = alpha_i * r; - } -#endif - - FUNCTION_PROFILE_END(4, 4, 4); - - IDEBUG_END; - - return; -} diff --git a/interface/zsbmv.c b/interface/zsbmv.c deleted file mode 100644 index 71c03a660..000000000 --- a/interface/zsbmv.c +++ /dev/null @@ -1,157 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XSBMV " -#elif defined(DOUBLE) -#define ERROR_NAME "ZSBMV " -#else -#define ERROR_NAME "CSBMV " -#endif - -static int (*sbmv[])(BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { -#ifdef XDOUBLE - xsbmv_U, xsbmv_L, -#elif defined(DOUBLE) - zsbmv_U, zsbmv_L, -#else - csbmv_U, csbmv_L, -#endif -}; - -#ifdef SMP -static int (*sbmv_thread[])(BLASLONG, BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { -#ifdef XDOUBLE - xsbmv_thread_U, xsbmv_thread_L, -#elif defined(DOUBLE) - zsbmv_thread_U, zsbmv_thread_L, -#else - csbmv_thread_U, csbmv_thread_L, -#endif -}; -#endif - -void NAME(char *UPLO, blasint *N, blasint *K, FLOAT *ALPHA, FLOAT *a, blasint *LDA, - FLOAT *b, blasint *INCX, FLOAT *BETA, FLOAT *c, blasint *INCY){ - - char uplo_arg = *UPLO; - blasint n = *N; - blasint k = *K; - FLOAT alpha_r = ALPHA[0]; - FLOAT alpha_i = ALPHA[1]; - blasint lda = *LDA; - blasint incx = *INCX; - FLOAT beta_r = BETA[0]; - FLOAT beta_i = BETA[1]; - blasint incy = *INCY; - - blasint info; - int uplo; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - uplo = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incy == 0) info = 11; - if (incx == 0) info = 8; - if (lda < k + 1) info = 6; - if (k < 0) info = 3; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - - if (n == 0) return; - - if ((beta_r != ONE) || (beta_i != ZERO)) SCAL_K(n, 0, 0, beta_r, beta_i, c, abs(incy), NULL, 0, NULL, 0); - - if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) b -= (n - 1) * incx * COMPSIZE; - if (incy < 0 ) c -= (n - 1) * incy * COMPSIZE; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (sbmv[uplo])(n, k, alpha_r, alpha_i, a, lda, b, incx, c, incy, buffer); - -#ifdef SMP - } else { - - (sbmv_thread[uplo])(n, k, ALPHA, a, lda, b, incx, c, incy, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, n * k / 2 + n, n * k); - - IDEBUG_END; - - return; -} diff --git a/interface/zscal.c b/interface/zscal.c deleted file mode 100644 index ad99874dc..000000000 --- a/interface/zscal.c +++ /dev/null @@ -1,117 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifndef CBLAS - -void NAME(blasint *N, FLOAT *ALPHA, FLOAT *x, blasint *INCX){ - - blasint n = *N; - blasint incx = *INCX; - -#ifndef SSCAL - FLOAT *alpha=ALPHA; -#else - FLOAT alpha[2] = {ALPHA[0], ZERO}; -#endif - -#else - -#ifndef SSCAL -void CNAME(blasint n, FLOAT *ALPHA, FLOAT *x, blasint incx){ - - FLOAT *alpha=ALPHA; -#else -void CNAME(blasint n, FLOAT alpha_r, FLOAT *x, blasint incx){ - - FLOAT alpha[2] = {alpha_r, ZERO}; -#endif -#endif - -#ifdef SMP - int mode; - int nthreads; -#endif - -#ifndef CBLAS - PRINT_DEBUG_NAME; -#else - PRINT_DEBUG_CNAME; -#endif - - if (incx <= 0 || n <= 0) return; - - if ((alpha[0] == ONE) && (alpha[1] == ZERO)) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifdef SMP - nthreads = num_cpu_avail(1); - - if (nthreads == 1) { -#endif - - SCAL_K(n, 0, 0, alpha[0], alpha[1], x, incx, NULL, 0, NULL, 0); - -#ifdef SMP - } else { -#ifdef DOUBLE - mode = BLAS_DOUBLE | BLAS_COMPLEX; -#else - mode = BLAS_SINGLE | BLAS_COMPLEX; -#endif - - blas_level1_thread(mode, n, 0, 0, alpha, x, incx, NULL, 0, NULL, 0, (void *)SCAL_K, nthreads); - - } -#endif - - FUNCTION_PROFILE_END(4, n, n); - - IDEBUG_END; - - return; - -} diff --git a/interface/zspmv.c b/interface/zspmv.c deleted file mode 100644 index ecf1af586..000000000 --- a/interface/zspmv.c +++ /dev/null @@ -1,154 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "ZSPMV " -#elif defined(DOUBLE) -#define ERROR_NAME "ZSPMV " -#else -#define ERROR_NAME "CSPMV " -#endif - -static int (*spmv[])(BLASLONG, FLOAT, FLOAT, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { -#ifdef XDOUBLE - xspmv_U, xspmv_L, -#elif defined(DOUBLE) - zspmv_U, zspmv_L, -#else - cspmv_U, cspmv_L, -#endif -}; - -#ifdef SMP -static int (*spmv_thread[])(BLASLONG, FLOAT *, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { -#ifdef XDOUBLE - xspmv_thread_U, xspmv_thread_L, -#elif defined(DOUBLE) - zspmv_thread_U, zspmv_thread_L, -#else - cspmv_thread_U, cspmv_thread_L, -#endif -}; -#endif - -void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, - FLOAT *b, blasint *INCX, FLOAT *BETA, FLOAT *c, blasint *INCY){ - - char uplo_arg = *UPLO; - blasint n = *N; - FLOAT alpha_r = ALPHA[0]; - FLOAT alpha_i = ALPHA[1]; - blasint incx = *INCX; - FLOAT beta_r = BETA[0]; - FLOAT beta_i = BETA[1]; - blasint incy = *INCY; - - blasint info; - int uplo; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - uplo = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incy == 0) info = 9; - if (incx == 0) info = 6; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - - if (n == 0) return; - - if ((beta_r != ONE) || (beta_i != ZERO)) SCAL_K(n, 0, 0, beta_r, beta_i, c, abs(incy), NULL, 0, NULL, 0); - - if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) b -= (n - 1) * incx * COMPSIZE; - if (incy < 0 ) c -= (n - 1) * incy * COMPSIZE; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (spmv[uplo])(n, alpha_r, alpha_i, a, b, incx, c, incy, buffer); - -#ifdef SMP - - } else { - - (spmv_thread[uplo])(n, ALPHA, a, b, incx, c, incy, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/zspr.c b/interface/zspr.c deleted file mode 100644 index 0021bcda4..000000000 --- a/interface/zspr.c +++ /dev/null @@ -1,146 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XSPR " -#elif defined(DOUBLE) -#define ERROR_NAME "ZSPR " -#else -#define ERROR_NAME "CSPR " -#endif - -static int (*spr[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, FLOAT *) = { -#ifdef XDOUBLE - xspr_U, xspr_L, -#elif defined(DOUBLE) - zspr_U, zspr_L, -#else - cspr_U, cspr_L, -#endif -}; - -#ifdef SMP -static int (*spr_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = { -#ifdef XDOUBLE - xspr_thread_U, xspr_thread_L, -#elif defined(DOUBLE) - zspr_thread_U, zspr_thread_L, -#else - cspr_thread_U, cspr_thread_L, -#endif -}; -#endif - -void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, - FLOAT *x, blasint *INCX, FLOAT *a){ - - char uplo_arg = *UPLO; - blasint n = *N; - FLOAT alpha_r = ALPHA[0]; - FLOAT alpha_i = ALPHA[1]; - blasint incx = *INCX; - - blasint info; - int uplo; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - uplo = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - - if (n == 0) return; - - if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (spr[uplo])(n, alpha_r, alpha_i, x, incx, a, buffer); - -#ifdef SMP - } else { - - (spr_thread[uplo])(n, ALPHA, x, incx, a, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/zspr2.c b/interface/zspr2.c deleted file mode 100644 index b54e1651a..000000000 --- a/interface/zspr2.c +++ /dev/null @@ -1,149 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XSPR2 " -#elif defined(DOUBLE) -#define ERROR_NAME "ZSPR2 " -#else -#define ERROR_NAME "CSPR2 " -#endif - -static int (*spr2[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, FLOAT *) = { -#ifdef XDOUBLE - xspr2_U, xspr2_L, -#elif defined(DOUBLE) - zspr2_U, zspr2_L, -#else - cspr2_U, cspr2_L, -#endif -}; - -#ifdef SMP -static int (*spr2_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = { -#ifdef XDOUBLE - xspr2_thread_U, xspr2_thread_L, -#elif defined(DOUBLE) - zspr2_thread_U, zspr2_thread_L, -#else - cspr2_thread_U, cspr2_thread_L, -#endif -}; -#endif - -void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, - FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *a){ - - char uplo_arg = *UPLO; - blasint n = *N; - FLOAT alpha_r = ALPHA[0]; - FLOAT alpha_i = ALPHA[1]; - blasint incx = *INCX; - blasint incy = *INCY; - - blasint info; - int uplo; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - uplo = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incy == 0) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - - if (n == 0) return; - - if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx; - if (incy < 0 ) y -= (n - 1) * incy; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (spr2[uplo])(n, alpha_r, alpha_i, x, incx, y, incy, a, buffer); - -#ifdef SMP - } else { - - (spr2_thread[uplo])(n, ALPHA, x, incx, y, incy, a, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, n * n / 2 + 2 * n, 2 * n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/zswap.c b/interface/zswap.c deleted file mode 100644 index 06a889204..000000000 --- a/interface/zswap.c +++ /dev/null @@ -1,116 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifndef CBLAS - -void NAME(blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){ - - blasint n = *N; - blasint incx = *INCX; - blasint incy = *INCY; - -#else - -void CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy){ - -#endif - -#ifdef SMP - int mode; - FLOAT dummyalpha[2] = {ZERO, ZERO}; - int nthreads; -#endif - -#ifndef CBLAS - PRINT_DEBUG_NAME; -#else - PRINT_DEBUG_CNAME; -#endif - - if (n <= 0) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0) x -= (n - 1) * incx * 2; - if (incy < 0) y -= (n - 1) * incy * 2; - -#ifdef SMP - nthreads = num_cpu_avail(1); - - //disable multi-thread when incx==0 or incy==0 - //In that case, the threads would be dependent. - if (incx == 0 || incy == 0) - nthreads = 1; - - if (nthreads == 1) { -#endif - - SWAP_K(n, 0, 0, ZERO, ZERO, x, incx, y, incy, NULL, 0); - -#ifdef SMP - } else { - -#ifdef XDOUBLE - mode = BLAS_XDOUBLE | BLAS_COMPLEX; -#elif defined(DOUBLE) - mode = BLAS_DOUBLE | BLAS_COMPLEX; -#else - mode = BLAS_SINGLE | BLAS_COMPLEX; -#endif - - blas_level1_thread(mode, n, 0, 0, dummyalpha, - x, incx, y, incy, NULL, 0, (void *)SWAP_K, nthreads); - - } -#endif - - FUNCTION_PROFILE_END(2, 2 * n, 0); - - IDEBUG_END; - - return; - -} diff --git a/interface/zsymv.c b/interface/zsymv.c deleted file mode 100644 index afb2c1734..000000000 --- a/interface/zsymv.c +++ /dev/null @@ -1,143 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XSYMV " -#elif defined(DOUBLE) -#define ERROR_NAME "ZSYMV " -#else -#define ERROR_NAME "CSYMV " -#endif - -void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, blasint *LDA, - FLOAT *b, blasint *INCX, FLOAT *BETA, FLOAT *c, blasint *INCY){ - - char uplo_arg = *UPLO; - blasint n = *N; - FLOAT alpha_r = ALPHA[0]; - FLOAT alpha_i = ALPHA[1]; - blasint lda = *LDA; - blasint incx = *INCX; - FLOAT beta_r = BETA[0]; - FLOAT beta_i = BETA[1]; - blasint incy = *INCY; - - int (*symv[])(BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { - SYMV_U, SYMV_L, - }; - -#ifdef SMP - int (*symv_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { - SYMV_THREAD_U, SYMV_THREAD_L, - }; -#endif - - blasint info; - int uplo; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - uplo = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incy == 0) info = 10; - if (incx == 0) info = 7; - if (lda < MAX(1, n)) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - - if (n == 0) return; - - if ((beta_r != ONE) || (beta_i != ZERO)) SCAL_K(n, 0, 0, beta_r, beta_i, c, abs(incy), NULL, 0, NULL, 0); - - if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) b -= (n - 1) * incx * COMPSIZE; - if (incy < 0 ) c -= (n - 1) * incy * COMPSIZE; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (symv[uplo])(n, n, alpha_r, alpha_i, a, lda, b, incx, c, incy, buffer); - -#ifdef SMP - } else { - - (symv_thread[uplo])(n, ALPHA, a, lda, b, incx, c, incy, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, n * n / 2 + 2 * n, 2 * n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/zsyr.c b/interface/zsyr.c deleted file mode 100644 index b6b5202ec..000000000 --- a/interface/zsyr.c +++ /dev/null @@ -1,203 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XSYR " -#elif defined(DOUBLE) -#define ERROR_NAME "ZSYR " -#else -#define ERROR_NAME "CSYR " -#endif - -static int (*syr[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { -#ifdef XDOUBLE - xsyr_U, xsyr_L, -#elif defined(DOUBLE) - zsyr_U, zsyr_L, -#else - csyr_U, csyr_L, -#endif -}; - -#ifdef SMP -static int (*syr_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { -#ifdef XDOUBLE - xsyr_thread_U, xsyr_thread_L, -#elif defined(DOUBLE) - zsyr_thread_U, zsyr_thread_L, -#else - csyr_thread_U, csyr_thread_L, -#endif -}; -#endif - - -#ifndef CBLAS - -void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, - FLOAT *x, blasint *INCX, FLOAT *a, blasint *LDA){ - - char uplo_arg = *UPLO; - blasint n = *N; - FLOAT alpha_r = ALPHA[0]; - FLOAT alpha_i = ALPHA[1]; - blasint lda = *LDA; - blasint incx = *INCX; - - blasint info; - int uplo; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - uplo = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (lda < MAX(1, n)) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, int n, FLOAT alpha, FLOAT *x, int incx, FLOAT *a, int lda) { - - FLOAT *buffer; - int trans, uplo; - blasint info; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_CNAME; - - trans = -1; - uplo = -1; - info = 0; - - if (order == CblasColMajor) { - - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - info = -1; - - if (lda < MAX(1, n)) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - } - - if (order == CblasRowMajor) { - - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - info = -1; - - if (lda < MAX(1, n)) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (syr[uplo])(n, alpha_r, alpha_i, x, incx, a, lda, buffer); - -#ifdef SMP - } else { - - (syr_thread[uplo])(n, ALPHA, x, incx, a, lda, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/zsyr2.c b/interface/zsyr2.c deleted file mode 100644 index 0c705cb12..000000000 --- a/interface/zsyr2.c +++ /dev/null @@ -1,151 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QSYR2 " -#elif defined(DOUBLE) -#define ERROR_NAME "ZSYR2 " -#else -#define ERROR_NAME "CSYR2 " -#endif - -static int (*syr2[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { -#ifdef XDOUBLE - xsyr2_U, xsyr2_L, -#elif defined(DOUBLE) - zsyr2_U, zsyr2_L, -#else - csyr2_U, csyr2_L, -#endif -}; - -#ifdef SMP -static int (*syr2_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { -#ifdef XDOUBLE - xsyr2_thread_U, xsyr2_thread_L, -#elif defined(DOUBLE) - zsyr2_thread_U, zsyr2_thread_L, -#else - csyr2_thread_U, csyr2_thread_L, -#endif -}; -#endif - -void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, - FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *a, blasint *LDA){ - - char uplo_arg = *UPLO; - blasint n = *N; - FLOAT alpha_r = ALPHA[0]; - FLOAT alpha_i = ALPHA[1]; - blasint lda = *LDA; - blasint incx = *INCX; - blasint incy = *INCY; - - blasint info; - int uplo; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - uplo = -1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (lda < MAX(1, n)) info = 9; - if (incy == 0) info = 7; - if (incx == 0) info = 5; - if (n < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - - if (n == 0) return; - - if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx; - if (incy < 0 ) y -= (n - 1) * incy; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (syr2[uplo])(n, alpha_r, alpha_i, x, incx, y, incy, a, lda, buffer); - -#ifdef SMP - } else { - - (syr2_thread[uplo])(n, ALPHA, x, incx, y, incy, a, lda, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, n * n / 2 + 2 * n, 2 * n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/ztbmv.c b/interface/ztbmv.c deleted file mode 100644 index 85f53c4be..000000000 --- a/interface/ztbmv.c +++ /dev/null @@ -1,260 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XTBMV " -#elif defined(DOUBLE) -#define ERROR_NAME "ZTBMV " -#else -#define ERROR_NAME "CTBMV " -#endif - -static int (*tbmv[])(BLASLONG, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { -#ifdef XDOUBLE - xtbmv_NUU, xtbmv_NUN, xtbmv_NLU, xtbmv_NLN, - xtbmv_TUU, xtbmv_TUN, xtbmv_TLU, xtbmv_TLN, - xtbmv_RUU, xtbmv_RUN, xtbmv_RLU, xtbmv_RLN, - xtbmv_CUU, xtbmv_CUN, xtbmv_CLU, xtbmv_CLN, -#elif defined(DOUBLE) - ztbmv_NUU, ztbmv_NUN, ztbmv_NLU, ztbmv_NLN, - ztbmv_TUU, ztbmv_TUN, ztbmv_TLU, ztbmv_TLN, - ztbmv_RUU, ztbmv_RUN, ztbmv_RLU, ztbmv_RLN, - ztbmv_CUU, ztbmv_CUN, ztbmv_CLU, ztbmv_CLN, -#else - ctbmv_NUU, ctbmv_NUN, ctbmv_NLU, ctbmv_NLN, - ctbmv_TUU, ctbmv_TUN, ctbmv_TLU, ctbmv_TLN, - ctbmv_RUU, ctbmv_RUN, ctbmv_RLU, ctbmv_RLN, - ctbmv_CUU, ctbmv_CUN, ctbmv_CLU, ctbmv_CLN, -#endif -}; - -#ifdef SMP -static int (*tbmv_thread[])(BLASLONG, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { -#ifdef XDOUBLE - xtbmv_thread_NUU, xtbmv_thread_NUN, xtbmv_thread_NLU, xtbmv_thread_NLN, - xtbmv_thread_TUU, xtbmv_thread_TUN, xtbmv_thread_TLU, xtbmv_thread_TLN, - xtbmv_thread_RUU, xtbmv_thread_RUN, xtbmv_thread_RLU, xtbmv_thread_RLN, - xtbmv_thread_CUU, xtbmv_thread_CUN, xtbmv_thread_CLU, xtbmv_thread_CLN, -#elif defined(DOUBLE) - ztbmv_thread_NUU, ztbmv_thread_NUN, ztbmv_thread_NLU, ztbmv_thread_NLN, - ztbmv_thread_TUU, ztbmv_thread_TUN, ztbmv_thread_TLU, ztbmv_thread_TLN, - ztbmv_thread_RUU, ztbmv_thread_RUN, ztbmv_thread_RLU, ztbmv_thread_RLN, - ztbmv_thread_CUU, ztbmv_thread_CUN, ztbmv_thread_CLU, ztbmv_thread_CLN, -#else - ctbmv_thread_NUU, ctbmv_thread_NUN, ctbmv_thread_NLU, ctbmv_thread_NLN, - ctbmv_thread_TUU, ctbmv_thread_TUN, ctbmv_thread_TLU, ctbmv_thread_TLN, - ctbmv_thread_RUU, ctbmv_thread_RUN, ctbmv_thread_RLU, ctbmv_thread_RLN, - ctbmv_thread_CUU, ctbmv_thread_CUN, ctbmv_thread_CLU, ctbmv_thread_CLN, -#endif -}; -#endif - -#ifndef CBLAS - -void NAME(char *UPLO, char *TRANS, char *DIAG, - blasint *N, blasint *K, - FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){ - - char uplo_arg = *UPLO; - char trans_arg = *TRANS; - char diag_arg = *DIAG; - - blasint n = *N; - blasint k = *K; - blasint lda = *LDA; - blasint incx = *INCX; - - blasint info; - int uplo; - int unit; - int trans; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - TOUPPER(trans_arg); - TOUPPER(diag_arg); - - trans = -1; - unit = -1; - uplo = -1; - - if (trans_arg == 'N') trans = 0; - if (trans_arg == 'T') trans = 1; - if (trans_arg == 'R') trans = 2; - if (trans_arg == 'C') trans = 3; - - if (diag_arg == 'U') unit = 0; - if (diag_arg == 'N') unit = 1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incx == 0) info = 9; - if (lda < k + 1) info = 7; - if (k < 0) info = 5; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, - enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, - blasint n, blasint k, FLOAT *a, blasint lda, FLOAT *x, blasint incx) { - - int trans, uplo, unit; - blasint info; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_CNAME; - - unit = -1; - uplo = -1; - trans = -1; - info = 0; - - if (order == CblasColMajor) { - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - if (TransA == CblasNoTrans) trans = 0; - if (TransA == CblasTrans) trans = 1; - if (TransA == CblasConjNoTrans) trans = 2; - if (TransA == CblasConjTrans) trans = 3; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 9; - if (lda < k + 1) info = 7; - if (k < 0) info = 5; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - if (TransA == CblasNoTrans) trans = 1; - if (TransA == CblasTrans) trans = 0; - if (TransA == CblasConjNoTrans) trans = 3; - if (TransA == CblasConjTrans) trans = 2; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 9; - if (lda < k + 1) info = 7; - if (k < 0) info = 5; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx * 2; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (tbmv[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer); - -#ifdef SMP - } else { - - (tbmv_thread[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, n * k / 2 + n, n * k); - - IDEBUG_END; - - return; -} diff --git a/interface/ztbsv.c b/interface/ztbsv.c deleted file mode 100644 index 3846a4b3d..000000000 --- a/interface/ztbsv.c +++ /dev/null @@ -1,219 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XTBSV " -#elif defined(DOUBLE) -#define ERROR_NAME "ZTBSV " -#else -#define ERROR_NAME "CTBSV " -#endif - -static int (*tbsv[])(BLASLONG, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { -#ifdef XDOUBLE - xtbsv_NUU, xtbsv_NUN, xtbsv_NLU, xtbsv_NLN, - xtbsv_TUU, xtbsv_TUN, xtbsv_TLU, xtbsv_TLN, - xtbsv_RUU, xtbsv_RUN, xtbsv_RLU, xtbsv_RLN, - xtbsv_CUU, xtbsv_CUN, xtbsv_CLU, xtbsv_CLN, -#elif defined(DOUBLE) - ztbsv_NUU, ztbsv_NUN, ztbsv_NLU, ztbsv_NLN, - ztbsv_TUU, ztbsv_TUN, ztbsv_TLU, ztbsv_TLN, - ztbsv_RUU, ztbsv_RUN, ztbsv_RLU, ztbsv_RLN, - ztbsv_CUU, ztbsv_CUN, ztbsv_CLU, ztbsv_CLN, -#else - ctbsv_NUU, ctbsv_NUN, ctbsv_NLU, ctbsv_NLN, - ctbsv_TUU, ctbsv_TUN, ctbsv_TLU, ctbsv_TLN, - ctbsv_RUU, ctbsv_RUN, ctbsv_RLU, ctbsv_RLN, - ctbsv_CUU, ctbsv_CUN, ctbsv_CLU, ctbsv_CLN, -#endif -}; - -#ifndef CBLAS - -void NAME(char *UPLO, char *TRANS, char *DIAG, - blasint *N, blasint *K, - FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){ - - char uplo_arg = *UPLO; - char trans_arg = *TRANS; - char diag_arg = *DIAG; - - blasint n = *N; - blasint k = *K; - blasint lda = *LDA; - blasint incx = *INCX; - - blasint info; - int uplo; - int unit; - int trans; - FLOAT *buffer; - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - TOUPPER(trans_arg); - TOUPPER(diag_arg); - - trans = -1; - unit = -1; - uplo = -1; - - if (trans_arg == 'N') trans = 0; - if (trans_arg == 'T') trans = 1; - if (trans_arg == 'R') trans = 2; - if (trans_arg == 'C') trans = 3; - - if (diag_arg == 'U') unit = 0; - if (diag_arg == 'N') unit = 1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incx == 0) info = 9; - if (lda < k + 1) info = 7; - if (k < 0) info = 5; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, - enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, - blasint n, blasint k, FLOAT *a, blasint lda, FLOAT *x, blasint incx) { - - int trans, uplo, unit; - blasint info; - FLOAT *buffer; - - PRINT_DEBUG_CNAME; - - unit = -1; - uplo = -1; - trans = -1; - info = 0; - - if (order == CblasColMajor) { - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - if (TransA == CblasNoTrans) trans = 0; - if (TransA == CblasTrans) trans = 1; - if (TransA == CblasConjNoTrans) trans = 2; - if (TransA == CblasConjTrans) trans = 3; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 9; - if (lda < k + 1) info = 7; - if (k < 0) info = 5; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - if (TransA == CblasNoTrans) trans = 1; - if (TransA == CblasTrans) trans = 0; - if (TransA == CblasConjNoTrans) trans = 3; - if (TransA == CblasConjTrans) trans = 2; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 9; - if (lda < k + 1) info = 7; - if (k < 0) info = 5; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx * 2; - - buffer = (FLOAT *)blas_memory_alloc(1); - - (tbsv[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer); - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, n * k / 2 + n, n * k); - - IDEBUG_END; - - return; -} diff --git a/interface/ztpmv.c b/interface/ztpmv.c deleted file mode 100644 index 2f9c48f5a..000000000 --- a/interface/ztpmv.c +++ /dev/null @@ -1,252 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XTPMV " -#elif defined(DOUBLE) -#define ERROR_NAME "ZTPMV " -#else -#define ERROR_NAME "CTPMV " -#endif - -static int (*tpmv[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, void *) = { -#ifdef XDOUBLE - xtpmv_NUU, xtpmv_NUN, xtpmv_NLU, xtpmv_NLN, - xtpmv_TUU, xtpmv_TUN, xtpmv_TLU, xtpmv_TLN, - xtpmv_RUU, xtpmv_RUN, xtpmv_RLU, xtpmv_RLN, - xtpmv_CUU, xtpmv_CUN, xtpmv_CLU, xtpmv_CLN, -#elif defined(DOUBLE) - ztpmv_NUU, ztpmv_NUN, ztpmv_NLU, ztpmv_NLN, - ztpmv_TUU, ztpmv_TUN, ztpmv_TLU, ztpmv_TLN, - ztpmv_RUU, ztpmv_RUN, ztpmv_RLU, ztpmv_RLN, - ztpmv_CUU, ztpmv_CUN, ztpmv_CLU, ztpmv_CLN, -#else - ctpmv_NUU, ctpmv_NUN, ctpmv_NLU, ctpmv_NLN, - ctpmv_TUU, ctpmv_TUN, ctpmv_TLU, ctpmv_TLN, - ctpmv_RUU, ctpmv_RUN, ctpmv_RLU, ctpmv_RLN, - ctpmv_CUU, ctpmv_CUN, ctpmv_CLU, ctpmv_CLN, -#endif -}; - -#ifdef SMP -static int (*tpmv_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, int) = { -#ifdef XDOUBLE - xtpmv_thread_NUU, xtpmv_thread_NUN, xtpmv_thread_NLU, xtpmv_thread_NLN, - xtpmv_thread_TUU, xtpmv_thread_TUN, xtpmv_thread_TLU, xtpmv_thread_TLN, - xtpmv_thread_RUU, xtpmv_thread_RUN, xtpmv_thread_RLU, xtpmv_thread_RLN, - xtpmv_thread_CUU, xtpmv_thread_CUN, xtpmv_thread_CLU, xtpmv_thread_CLN, -#elif defined(DOUBLE) - ztpmv_thread_NUU, ztpmv_thread_NUN, ztpmv_thread_NLU, ztpmv_thread_NLN, - ztpmv_thread_TUU, ztpmv_thread_TUN, ztpmv_thread_TLU, ztpmv_thread_TLN, - ztpmv_thread_RUU, ztpmv_thread_RUN, ztpmv_thread_RLU, ztpmv_thread_RLN, - ztpmv_thread_CUU, ztpmv_thread_CUN, ztpmv_thread_CLU, ztpmv_thread_CLN, -#else - ctpmv_thread_NUU, ctpmv_thread_NUN, ctpmv_thread_NLU, ctpmv_thread_NLN, - ctpmv_thread_TUU, ctpmv_thread_TUN, ctpmv_thread_TLU, ctpmv_thread_TLN, - ctpmv_thread_RUU, ctpmv_thread_RUN, ctpmv_thread_RLU, ctpmv_thread_RLN, - ctpmv_thread_CUU, ctpmv_thread_CUN, ctpmv_thread_CLU, ctpmv_thread_CLN, -#endif -}; -#endif - -#ifndef CBLAS - -void NAME(char *UPLO, char *TRANS, char *DIAG, - blasint *N, FLOAT *a, FLOAT *x, blasint *INCX){ - - char uplo_arg = *UPLO; - char trans_arg = *TRANS; - char diag_arg = *DIAG; - - blasint n = *N; - blasint incx = *INCX; - - blasint info; - int uplo; - int unit; - int trans; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - TOUPPER(trans_arg); - TOUPPER(diag_arg); - - trans = -1; - unit = -1; - uplo = -1; - - if (trans_arg == 'N') trans = 0; - if (trans_arg == 'T') trans = 1; - if (trans_arg == 'R') trans = 2; - if (trans_arg == 'C') trans = 3; - - if (diag_arg == 'U') unit = 0; - if (diag_arg == 'N') unit = 1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incx == 0) info = 7; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, - enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, - blasint n, FLOAT *a, FLOAT *x, blasint incx) { - - int trans, uplo, unit; - blasint info; - FLOAT *buffer; - - PRINT_DEBUG_CNAME; - - unit = -1; - uplo = -1; - trans = -1; - info = 0; -#ifdef SMP - int nthreads; -#endif - - if (order == CblasColMajor) { - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - if (TransA == CblasNoTrans) trans = 0; - if (TransA == CblasTrans) trans = 1; - if (TransA == CblasConjNoTrans) trans = 2; - if (TransA == CblasConjTrans) trans = 3; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 7; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - if (TransA == CblasNoTrans) trans = 1; - if (TransA == CblasTrans) trans = 0; - if (TransA == CblasConjNoTrans) trans = 3; - if (TransA == CblasConjTrans) trans = 2; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 7; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx * 2; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (tpmv[(trans<<2) | (uplo<<1) | unit])(n, a, x, incx, buffer); - -#ifdef SMP - - } else { - - (tpmv_thread[(trans<<2) | (uplo<<1) | unit])(n, a, x, incx, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/ztpsv.c b/interface/ztpsv.c deleted file mode 100644 index fde500e37..000000000 --- a/interface/ztpsv.c +++ /dev/null @@ -1,210 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XTPSV " -#elif defined(DOUBLE) -#define ERROR_NAME "ZTPSV " -#else -#define ERROR_NAME "CTPSV " -#endif - -static int (*tpsv[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, void *) = { -#ifdef XDOUBLE - xtpsv_NUU, xtpsv_NUN, xtpsv_NLU, xtpsv_NLN, - xtpsv_TUU, xtpsv_TUN, xtpsv_TLU, xtpsv_TLN, - xtpsv_RUU, xtpsv_RUN, xtpsv_RLU, xtpsv_RLN, - xtpsv_CUU, xtpsv_CUN, xtpsv_CLU, xtpsv_CLN, -#elif defined(DOUBLE) - ztpsv_NUU, ztpsv_NUN, ztpsv_NLU, ztpsv_NLN, - ztpsv_TUU, ztpsv_TUN, ztpsv_TLU, ztpsv_TLN, - ztpsv_RUU, ztpsv_RUN, ztpsv_RLU, ztpsv_RLN, - ztpsv_CUU, ztpsv_CUN, ztpsv_CLU, ztpsv_CLN, -#else - ctpsv_NUU, ctpsv_NUN, ctpsv_NLU, ctpsv_NLN, - ctpsv_TUU, ctpsv_TUN, ctpsv_TLU, ctpsv_TLN, - ctpsv_RUU, ctpsv_RUN, ctpsv_RLU, ctpsv_RLN, - ctpsv_CUU, ctpsv_CUN, ctpsv_CLU, ctpsv_CLN, -#endif -}; - -#ifndef CBLAS - -void NAME(char *UPLO, char *TRANS, char *DIAG, - blasint *N, FLOAT *a, FLOAT *x, blasint *INCX){ - - char uplo_arg = *UPLO; - char trans_arg = *TRANS; - char diag_arg = *DIAG; - - blasint n = *N; - blasint incx = *INCX; - - blasint info; - int uplo; - int unit; - int trans; - FLOAT *buffer; - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - TOUPPER(trans_arg); - TOUPPER(diag_arg); - - trans = -1; - unit = -1; - uplo = -1; - - if (trans_arg == 'N') trans = 0; - if (trans_arg == 'T') trans = 1; - if (trans_arg == 'R') trans = 2; - if (trans_arg == 'C') trans = 3; - - if (diag_arg == 'U') unit = 0; - if (diag_arg == 'N') unit = 1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incx == 0) info = 7; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, - enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, - blasint n, FLOAT *a, FLOAT *x, blasint incx) { - - int trans, uplo, unit; - blasint info; - FLOAT *buffer; - - PRINT_DEBUG_CNAME; - - unit = -1; - uplo = -1; - trans = -1; - info = 0; - - if (order == CblasColMajor) { - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - if (TransA == CblasNoTrans) trans = 0; - if (TransA == CblasTrans) trans = 1; - if (TransA == CblasConjNoTrans) trans = 2; - if (TransA == CblasConjTrans) trans = 3; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 7; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - if (TransA == CblasNoTrans) trans = 1; - if (TransA == CblasTrans) trans = 0; - if (TransA == CblasConjNoTrans) trans = 3; - if (TransA == CblasConjTrans) trans = 2; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 7; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx * 2; - - buffer = (FLOAT *)blas_memory_alloc(1); - - (tpsv[(trans<<2) | (uplo<<1) | unit])(n, a, x, incx, buffer); - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/ztrmv.c b/interface/ztrmv.c deleted file mode 100644 index 5a18a85b1..000000000 --- a/interface/ztrmv.c +++ /dev/null @@ -1,255 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XTRMV " -#elif defined(DOUBLE) -#define ERROR_NAME "ZTRMV " -#else -#define ERROR_NAME "CTRMV " -#endif - -static int (*trmv[])(BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { -#ifdef XDOUBLE - xtrmv_NUU, xtrmv_NUN, xtrmv_NLU, xtrmv_NLN, - xtrmv_TUU, xtrmv_TUN, xtrmv_TLU, xtrmv_TLN, - xtrmv_RUU, xtrmv_RUN, xtrmv_RLU, xtrmv_RLN, - xtrmv_CUU, xtrmv_CUN, xtrmv_CLU, xtrmv_CLN, -#elif defined(DOUBLE) - ztrmv_NUU, ztrmv_NUN, ztrmv_NLU, ztrmv_NLN, - ztrmv_TUU, ztrmv_TUN, ztrmv_TLU, ztrmv_TLN, - ztrmv_RUU, ztrmv_RUN, ztrmv_RLU, ztrmv_RLN, - ztrmv_CUU, ztrmv_CUN, ztrmv_CLU, ztrmv_CLN, -#else - ctrmv_NUU, ctrmv_NUN, ctrmv_NLU, ctrmv_NLN, - ctrmv_TUU, ctrmv_TUN, ctrmv_TLU, ctrmv_TLN, - ctrmv_RUU, ctrmv_RUN, ctrmv_RLU, ctrmv_RLN, - ctrmv_CUU, ctrmv_CUN, ctrmv_CLU, ctrmv_CLN, -#endif -}; - -#ifdef SMP -static int (*trmv_thread[])(BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { -#ifdef XDOUBLE - xtrmv_thread_NUU, xtrmv_thread_NUN, xtrmv_thread_NLU, xtrmv_thread_NLN, - xtrmv_thread_TUU, xtrmv_thread_TUN, xtrmv_thread_TLU, xtrmv_thread_TLN, - xtrmv_thread_RUU, xtrmv_thread_RUN, xtrmv_thread_RLU, xtrmv_thread_RLN, - xtrmv_thread_CUU, xtrmv_thread_CUN, xtrmv_thread_CLU, xtrmv_thread_CLN, -#elif defined(DOUBLE) - ztrmv_thread_NUU, ztrmv_thread_NUN, ztrmv_thread_NLU, ztrmv_thread_NLN, - ztrmv_thread_TUU, ztrmv_thread_TUN, ztrmv_thread_TLU, ztrmv_thread_TLN, - ztrmv_thread_RUU, ztrmv_thread_RUN, ztrmv_thread_RLU, ztrmv_thread_RLN, - ztrmv_thread_CUU, ztrmv_thread_CUN, ztrmv_thread_CLU, ztrmv_thread_CLN, -#else - ctrmv_thread_NUU, ctrmv_thread_NUN, ctrmv_thread_NLU, ctrmv_thread_NLN, - ctrmv_thread_TUU, ctrmv_thread_TUN, ctrmv_thread_TLU, ctrmv_thread_TLN, - ctrmv_thread_RUU, ctrmv_thread_RUN, ctrmv_thread_RLU, ctrmv_thread_RLN, - ctrmv_thread_CUU, ctrmv_thread_CUN, ctrmv_thread_CLU, ctrmv_thread_CLN, -#endif -}; -#endif - -#ifndef CBLAS - -void NAME(char *UPLO, char *TRANS, char *DIAG, - blasint *N, FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){ - - char uplo_arg = *UPLO; - char trans_arg = *TRANS; - char diag_arg = *DIAG; - - blasint n = *N; - blasint lda = *LDA; - blasint incx = *INCX; - - blasint info; - int uplo; - int unit; - int trans; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - TOUPPER(trans_arg); - TOUPPER(diag_arg); - - trans = -1; - unit = -1; - uplo = -1; - - if (trans_arg == 'N') trans = 0; - if (trans_arg == 'T') trans = 1; - if (trans_arg == 'R') trans = 2; - if (trans_arg == 'C') trans = 3; - - if (diag_arg == 'U') unit = 0; - if (diag_arg == 'N') unit = 1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - - if (incx == 0) info = 8; - if (lda < MAX(1, n)) info = 6; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, - enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, - blasint n, FLOAT *a, blasint lda, FLOAT *x, blasint incx) { - - int trans, uplo, unit; - blasint info; - FLOAT *buffer; -#ifdef SMP - int nthreads; -#endif - - PRINT_DEBUG_CNAME; - - unit = -1; - uplo = -1; - trans = -1; - info = 0; - - if (order == CblasColMajor) { - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - if (TransA == CblasNoTrans) trans = 0; - if (TransA == CblasTrans) trans = 1; - if (TransA == CblasConjNoTrans) trans = 2; - if (TransA == CblasConjTrans) trans = 3; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 8; - if (lda < MAX(1, n)) info = 6; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - if (TransA == CblasNoTrans) trans = 1; - if (TransA == CblasTrans) trans = 0; - if (TransA == CblasConjNoTrans) trans = 3; - if (TransA == CblasConjTrans) trans = 2; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 8; - if (lda < MAX(1, n)) info = 6; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx * 2; - - buffer = (FLOAT *)blas_memory_alloc(1); - -#ifdef SMP - nthreads = num_cpu_avail(2); - - if (nthreads == 1) { -#endif - - (trmv[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer); - -#ifdef SMP - } else { - - (trmv_thread[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer, nthreads); - - } -#endif - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/ztrsv.c b/interface/ztrsv.c deleted file mode 100644 index 08f7dc68c..000000000 --- a/interface/ztrsv.c +++ /dev/null @@ -1,216 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XTRSV " -#elif defined(DOUBLE) -#define ERROR_NAME "ZTRSV " -#else -#define ERROR_NAME "CTRSV " -#endif - -static int (*trsv[])(BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { -#ifdef XDOUBLE - xtrsv_NUU, xtrsv_NUN, xtrsv_NLU, xtrsv_NLN, - xtrsv_TUU, xtrsv_TUN, xtrsv_TLU, xtrsv_TLN, - xtrsv_RUU, xtrsv_RUN, xtrsv_RLU, xtrsv_RLN, - xtrsv_CUU, xtrsv_CUN, xtrsv_CLU, xtrsv_CLN, -#elif defined(DOUBLE) - ztrsv_NUU, ztrsv_NUN, ztrsv_NLU, ztrsv_NLN, - ztrsv_TUU, ztrsv_TUN, ztrsv_TLU, ztrsv_TLN, - ztrsv_RUU, ztrsv_RUN, ztrsv_RLU, ztrsv_RLN, - ztrsv_CUU, ztrsv_CUN, ztrsv_CLU, ztrsv_CLN, -#else - ctrsv_NUU, ctrsv_NUN, ctrsv_NLU, ctrsv_NLN, - ctrsv_TUU, ctrsv_TUN, ctrsv_TLU, ctrsv_TLN, - ctrsv_RUU, ctrsv_RUN, ctrsv_RLU, ctrsv_RLN, - ctrsv_CUU, ctrsv_CUN, ctrsv_CLU, ctrsv_CLN, -#endif -}; - -#ifndef CBLAS - -void NAME(char *UPLO, char *TRANS, char *DIAG, - blasint *N, FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){ - - char uplo_arg = *UPLO; - char trans_arg = *TRANS; - char diag_arg = *DIAG; - - blasint n = *N; - blasint lda = *LDA; - blasint incx = *INCX; - - blasint info; - int uplo; - int unit; - int trans; - FLOAT *buffer; - - PRINT_DEBUG_NAME; - - TOUPPER(uplo_arg); - TOUPPER(trans_arg); - TOUPPER(diag_arg); - - trans = -1; - unit = -1; - uplo = -1; - - if (trans_arg == 'N') trans = 0; - if (trans_arg == 'T') trans = 1; - if (trans_arg == 'R') trans = 2; - if (trans_arg == 'C') trans = 3; - - if (diag_arg == 'U') unit = 0; - if (diag_arg == 'N') unit = 1; - - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - - info = 0; - - if (incx == 0) info = 8; - if (lda < MAX(1, n)) info = 6; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - - if (info != 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - - -#else - -void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, - enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, - blasint n, FLOAT *a, blasint lda, FLOAT *x, blasint incx) { - - int trans, uplo, unit; - blasint info; - FLOAT *buffer; - - PRINT_DEBUG_CNAME; - - unit = -1; - uplo = -1; - trans = -1; - info = 0; - - if (order == CblasColMajor) { - if (Uplo == CblasUpper) uplo = 0; - if (Uplo == CblasLower) uplo = 1; - - if (TransA == CblasNoTrans) trans = 0; - if (TransA == CblasTrans) trans = 1; - if (TransA == CblasConjNoTrans) trans = 2; - if (TransA == CblasConjTrans) trans = 3; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 8; - if (lda < MAX(1, n)) info = 6; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (order == CblasRowMajor) { - if (Uplo == CblasUpper) uplo = 1; - if (Uplo == CblasLower) uplo = 0; - - if (TransA == CblasNoTrans) trans = 1; - if (TransA == CblasTrans) trans = 0; - if (TransA == CblasConjNoTrans) trans = 3; - if (TransA == CblasConjTrans) trans = 2; - - if (Diag == CblasUnit) unit = 0; - if (Diag == CblasNonUnit) unit = 1; - - info = -1; - - if (incx == 0) info = 8; - if (lda < MAX(1, n)) info = 6; - if (n < 0) info = 4; - if (unit < 0) info = 3; - if (trans < 0) info = 2; - if (uplo < 0) info = 1; - } - - if (info >= 0) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - return; - } - -#endif - - if (n == 0) return; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - - if (incx < 0 ) x -= (n - 1) * incx * 2; - - buffer = (FLOAT *)blas_memory_alloc(1); - - (trsv[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer); - - blas_memory_free(buffer); - - FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n); - - IDEBUG_END; - - return; -} diff --git a/interface/ztrti2.c b/interface/ztrti2.c deleted file mode 100644 index 017374c37..000000000 --- a/interface/ztrti2.c +++ /dev/null @@ -1,134 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XTRTI2" -#elif defined(DOUBLE) -#define ERROR_NAME "ZTRTI2" -#else -#define ERROR_NAME "CTRTI2" -#endif - -static blasint (*trti2[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { -#ifdef XDOUBLE - xtrti2_UU, xtrti2_UN, xtrti2_LU, xtrti2_LN, -#elif defined(DOUBLE) - ztrti2_UU, ztrti2_UN, ztrti2_LU, ztrti2_LN, -#else - ctrti2_UU, ctrti2_UN, ctrti2_LU, ctrti2_LN, -#endif - }; - -int NAME(char *UPLO, char *DIAG, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ - - blas_arg_t args; - - blasint uplo_arg = *UPLO; - blasint diag_arg = *DIAG; - blasint uplo, diag; - blasint info; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.n = *N; - args.a = (void *)a; - args.lda = *ldA; - - TOUPPER(uplo_arg); - TOUPPER(diag_arg); - - uplo = -1; - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - diag = -1; - if (diag_arg == 'U') diag = 0; - if (diag_arg == 'N') diag = 1; - - info = 0; - if (args.lda < MAX(1,args.n)) info = 5; - if (args.n < 0) info = 3; - if (diag < 0) info = 2; - if (uplo < 0) info = 1; - if (info) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - *Info = - info; - return 0; - } - - *Info = 0; - - if (args.n <= 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - - info = (trti2[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0); - - *Info = info; - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(1, .5 * args.n * args.n, - 2. * args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) - + 6. * args.n * (1./3. + args.n * (-1./2. + args.n * 1./6.))); - - IDEBUG_END; - - return 0; -} diff --git a/interface/ztrtri.c b/interface/ztrtri.c deleted file mode 100644 index 89caf80d3..000000000 --- a/interface/ztrtri.c +++ /dev/null @@ -1,154 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XTRTRI" -#elif defined(DOUBLE) -#define ERROR_NAME "ZTRTRI" -#else -#define ERROR_NAME "CTRTRI" -#endif - -static blasint (*trtri_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ - TRTRI_UU_SINGLE, TRTRI_UN_SINGLE, TRTRI_LU_SINGLE, TRTRI_LN_SINGLE, -}; - -#ifdef SMP -static blasint (*trtri_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ - TRTRI_UU_PARALLEL, TRTRI_UN_PARALLEL, TRTRI_LU_PARALLEL, TRTRI_LN_PARALLEL, -}; -#endif - -int NAME(char *UPLO, char *DIAG, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ - - blas_arg_t args; - - blasint uplo_arg = *UPLO; - blasint diag_arg = *DIAG; - blasint uplo, diag; - blasint info; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.n = *N; - args.a = (void *)a; - args.lda = *ldA; - - TOUPPER(uplo_arg); - TOUPPER(diag_arg); - - uplo = -1; - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - diag = -1; - if (diag_arg == 'U') diag = 0; - if (diag_arg == 'N') diag = 1; - - info = 0; - if (args.lda < MAX(1,args.n)) info = 5; - if (args.n < 0) info = 3; - if (diag < 0) info = 2; - if (uplo < 0) info = 1; - if (info) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - *Info = - info; - return 0; - } - - *Info = 0; - - if (args.n == 0) return 0; - - if (diag) { - if (AMIN_K(args.n, args.a, args.lda + 1) == ZERO) { - *Info = IAMIN_K(args.n, args.a, args.lda + 1); - return 0; - } - } - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - -#ifdef SMP - args.common = NULL; - args.nthreads = num_cpu_avail(4); - - if (args.nthreads == 1) { -#endif - - *Info = (trtri_single[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0); - -#ifdef SMP - } else { - - *Info = (trtri_parallel[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0); - - } -#endif - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(1, .5 * args.n * args.n, - 2. * args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) - + 6. * args.n * (1./3. + args.n * (-1./2. + args.n * 1./6.))); - - IDEBUG_END; - - return 0; -} From e265c4ec8685e05c79ef47ced26a35b3d4d76e41 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sat, 10 May 2014 21:27:47 +0200 Subject: [PATCH 08/70] added C files in interface --- interface/asum.c | 93 +++++++++ interface/axpy.c | 121 ++++++++++++ interface/copy.c | 80 ++++++++ interface/dot.c | 101 ++++++++++ interface/dsdot.c | 102 ++++++++++ interface/gbmv.c | 252 +++++++++++++++++++++++++ interface/gemm.c | 461 +++++++++++++++++++++++++++++++++++++++++++++ interface/gemv.c | 237 +++++++++++++++++++++++ interface/ger.c | 193 +++++++++++++++++++ interface/gesv.c | 154 +++++++++++++++ interface/imax.c | 171 +++++++++++++++++ interface/max.c | 169 +++++++++++++++++ interface/nrm2.c | 93 +++++++++ interface/rot.c | 82 ++++++++ interface/rotg.c | 109 +++++++++++ interface/rotm.c | 155 +++++++++++++++ interface/rotmg.c | 235 +++++++++++++++++++++++ interface/sbmv.c | 215 +++++++++++++++++++++ interface/scal.c | 112 +++++++++++ interface/sdsdot.c | 101 ++++++++++ interface/spmv.c | 207 ++++++++++++++++++++ interface/spr.c | 197 +++++++++++++++++++ interface/spr2.c | 203 ++++++++++++++++++++ interface/swap.c | 115 +++++++++++ interface/symm.c | 442 +++++++++++++++++++++++++++++++++++++++++++ interface/symv.c | 205 ++++++++++++++++++++ interface/syr.c | 200 ++++++++++++++++++++ interface/syr2.c | 204 ++++++++++++++++++++ interface/syr2k.c | 377 ++++++++++++++++++++++++++++++++++++ interface/syrk.c | 366 +++++++++++++++++++++++++++++++++++ interface/tbmv.c | 248 ++++++++++++++++++++++++ interface/tbsv.c | 213 +++++++++++++++++++++ interface/tpmv.c | 239 +++++++++++++++++++++++ interface/tpsv.c | 204 ++++++++++++++++++++ interface/trmv.c | 243 ++++++++++++++++++++++++ interface/trsm.c | 391 ++++++++++++++++++++++++++++++++++++++ interface/trsv.c | 208 ++++++++++++++++++++ interface/trti2.c | 134 +++++++++++++ interface/trtri.c | 156 +++++++++++++++ interface/zaxpy.c | 127 +++++++++++++ interface/zdot.c | 202 ++++++++++++++++++++ interface/zgbmv.c | 271 ++++++++++++++++++++++++++ interface/zgemv.c | 259 +++++++++++++++++++++++++ interface/zger.c | 249 ++++++++++++++++++++++++ interface/zhbmv.c | 223 ++++++++++++++++++++++ interface/zhemv.c | 215 +++++++++++++++++++++ interface/zher.c | 200 ++++++++++++++++++++ interface/zher2.c | 207 ++++++++++++++++++++ interface/zhpmv.c | 213 +++++++++++++++++++++ interface/zhpr.c | 198 +++++++++++++++++++ interface/zhpr2.c | 207 ++++++++++++++++++++ interface/zrot.c | 72 +++++++ interface/zrotg.c | 115 +++++++++++ interface/zsbmv.c | 157 +++++++++++++++ interface/zscal.c | 117 ++++++++++++ interface/zspmv.c | 154 +++++++++++++++ interface/zspr.c | 146 ++++++++++++++ interface/zspr2.c | 149 +++++++++++++++ interface/zswap.c | 116 ++++++++++++ interface/zsymv.c | 143 ++++++++++++++ interface/zsyr.c | 203 ++++++++++++++++++++ interface/zsyr2.c | 151 +++++++++++++++ interface/ztbmv.c | 260 +++++++++++++++++++++++++ interface/ztbsv.c | 219 +++++++++++++++++++++ interface/ztpmv.c | 252 +++++++++++++++++++++++++ interface/ztpsv.c | 210 +++++++++++++++++++++ interface/ztrmv.c | 255 +++++++++++++++++++++++++ interface/ztrsv.c | 216 +++++++++++++++++++++ interface/ztrti2.c | 134 +++++++++++++ interface/ztrtri.c | 154 +++++++++++++++ 70 files changed, 13582 insertions(+) create mode 100644 interface/asum.c create mode 100644 interface/axpy.c create mode 100644 interface/copy.c create mode 100644 interface/dot.c create mode 100644 interface/dsdot.c create mode 100644 interface/gbmv.c create mode 100644 interface/gemm.c create mode 100644 interface/gemv.c create mode 100644 interface/ger.c create mode 100644 interface/gesv.c create mode 100644 interface/imax.c create mode 100644 interface/max.c create mode 100644 interface/nrm2.c create mode 100644 interface/rot.c create mode 100644 interface/rotg.c create mode 100644 interface/rotm.c create mode 100644 interface/rotmg.c create mode 100644 interface/sbmv.c create mode 100644 interface/scal.c create mode 100644 interface/sdsdot.c create mode 100644 interface/spmv.c create mode 100644 interface/spr.c create mode 100644 interface/spr2.c create mode 100644 interface/swap.c create mode 100644 interface/symm.c create mode 100644 interface/symv.c create mode 100644 interface/syr.c create mode 100644 interface/syr2.c create mode 100644 interface/syr2k.c create mode 100644 interface/syrk.c create mode 100644 interface/tbmv.c create mode 100644 interface/tbsv.c create mode 100644 interface/tpmv.c create mode 100644 interface/tpsv.c create mode 100644 interface/trmv.c create mode 100644 interface/trsm.c create mode 100644 interface/trsv.c create mode 100644 interface/trti2.c create mode 100644 interface/trtri.c create mode 100644 interface/zaxpy.c create mode 100644 interface/zdot.c create mode 100644 interface/zgbmv.c create mode 100644 interface/zgemv.c create mode 100644 interface/zger.c create mode 100644 interface/zhbmv.c create mode 100644 interface/zhemv.c create mode 100644 interface/zher.c create mode 100644 interface/zher2.c create mode 100644 interface/zhpmv.c create mode 100644 interface/zhpr.c create mode 100644 interface/zhpr2.c create mode 100644 interface/zrot.c create mode 100644 interface/zrotg.c create mode 100644 interface/zsbmv.c create mode 100644 interface/zscal.c create mode 100644 interface/zspmv.c create mode 100644 interface/zspr.c create mode 100644 interface/zspr2.c create mode 100644 interface/zswap.c create mode 100644 interface/zsymv.c create mode 100644 interface/zsyr.c create mode 100644 interface/zsyr2.c create mode 100644 interface/ztbmv.c create mode 100644 interface/ztbsv.c create mode 100644 interface/ztpmv.c create mode 100644 interface/ztpsv.c create mode 100644 interface/ztrmv.c create mode 100644 interface/ztrsv.c create mode 100644 interface/ztrti2.c create mode 100644 interface/ztrtri.c diff --git a/interface/asum.c b/interface/asum.c new file mode 100644 index 000000000..634836e28 --- /dev/null +++ b/interface/asum.c @@ -0,0 +1,93 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifndef CBLAS + +FLOATRET NAME(blasint *N, FLOAT *x, blasint *INCX){ + + BLASLONG n = *N; + BLASLONG incx = *INCX; + FLOATRET ret; + + PRINT_DEBUG_NAME; + + if (n <= 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + ret = (FLOATRET)ASUM_K(n, x, incx); + + FUNCTION_PROFILE_END(COMPSIZE, n, n); + + IDEBUG_END; + + return ret; +} + +#else + +FLOAT CNAME(blasint n, FLOAT *x, blasint incx){ + + FLOAT ret; + + PRINT_DEBUG_CNAME; + + if (n <= 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + ret = ASUM_K(n, x, incx); + + FUNCTION_PROFILE_END(COMPSIZE, n, n); + + IDEBUG_END; + + return ret; +} + +#endif diff --git a/interface/axpy.c b/interface/axpy.c new file mode 100644 index 000000000..b8a96c94e --- /dev/null +++ b/interface/axpy.c @@ -0,0 +1,121 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifndef CBLAS + +void NAME(blasint *N, FLOAT *ALPHA, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){ + + BLASLONG n = *N; + BLASLONG incx = *INCX; + BLASLONG incy = *INCY; + FLOAT alpha = *ALPHA; + +#else + +void CNAME(blasint n, FLOAT alpha, FLOAT *x, blasint incx, FLOAT *y, blasint incy){ + +#endif + +#ifdef SMPTEST + int mode, nthreads; +#endif + +#ifndef CBLAS + PRINT_DEBUG_NAME; +#else + PRINT_DEBUG_CNAME; +#endif + + if (n <= 0) return; + + if (alpha == ZERO) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0) x -= (n - 1) * incx; + if (incy < 0) y -= (n - 1) * incy; + +#ifdef SMPTEST + nthreads = num_cpu_avail(1); + + //disable multi-thread when incx==0 or incy==0 + //In that case, the threads would be dependent. + if (incx == 0 || incy == 0) + nthreads = 1; + + //Temporarily walk around the low performance issue with small imput size & multithreads. + if (n <= 10000) + nthreads = 1; + + if (nthreads == 1) { +#endif + + AXPYU_K(n, 0, 0, alpha, x, incx, y, incy, NULL, 0); + +#ifdef SMPTEST + } else { + +#ifdef XDOUBLE + mode = BLAS_XDOUBLE | BLAS_REAL; +#elif defined(DOUBLE) + mode = BLAS_DOUBLE | BLAS_REAL; +#else + mode = BLAS_SINGLE | BLAS_REAL; +#endif + + blas_level1_thread(mode, n, 0, 0, &alpha, + x, incx, y, incy, NULL, 0, (void *)AXPYU_K, nthreads); + + } +#endif + + FUNCTION_PROFILE_END(1, 2 * n, 2 * n); + + IDEBUG_END; + + return; + +} diff --git a/interface/copy.c b/interface/copy.c new file mode 100644 index 000000000..6965682ec --- /dev/null +++ b/interface/copy.c @@ -0,0 +1,80 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifndef CBLAS + +void NAME(blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){ + + BLASLONG n = *N; + BLASLONG incx = *INCX; + BLASLONG incy = *INCY; + + PRINT_DEBUG_NAME; + +#else + +void CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy){ + + PRINT_DEBUG_CNAME; + +#endif + + if (n <= 0) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0) x -= (n - 1) * incx * COMPSIZE; + if (incy < 0) y -= (n - 1) * incy * COMPSIZE; + + COPY_K(n, x, incx, y, incy); + + FUNCTION_PROFILE_END(COMPSIZE, COMPSIZE * n, 0); + + IDEBUG_END; + + return; + +} diff --git a/interface/dot.c b/interface/dot.c new file mode 100644 index 000000000..3744db5ea --- /dev/null +++ b/interface/dot.c @@ -0,0 +1,101 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifndef CBLAS + +FLOATRET NAME(blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){ + + BLASLONG n = *N; + BLASLONG incx = *INCX; + BLASLONG incy = *INCY; + FLOATRET ret; + + PRINT_DEBUG_NAME; + + if (n <= 0) return 0.; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0) x -= (n - 1) * incx; + if (incy < 0) y -= (n - 1) * incy; + + ret = (FLOATRET)DOTU_K(n, x, incx, y, incy); + + FUNCTION_PROFILE_END(1, 2 * n, 2 * n); + + IDEBUG_END; + + return ret; +} + +#else + +FLOAT CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy){ + + FLOAT ret; + + PRINT_DEBUG_CNAME; + + if (n <= 0) return 0.; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0) x -= (n - 1) * incx; + if (incy < 0) y -= (n - 1) * incy; + + ret = DOTU_K(n, x, incx, y, incy); + + FUNCTION_PROFILE_END(1, 2 * n, 2 * n); + + IDEBUG_END; + + return ret; + +} + +#endif diff --git a/interface/dsdot.c b/interface/dsdot.c new file mode 100644 index 000000000..94237e0c4 --- /dev/null +++ b/interface/dsdot.c @@ -0,0 +1,102 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifndef CBLAS + +double NAME(blasint *N, float *x, blasint *INCX, float *y, blasint *INCY){ + + BLASLONG n = *N; + BLASLONG incx = *INCX; + BLASLONG incy = *INCY; + double ret = 0.0; + + PRINT_DEBUG_NAME; + + if (n <= 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0) x -= (n - 1) * incx; + if (incy < 0) y -= (n - 1) * incy; + + ret=DSDOT_K(n, x, incx, y, incy); + + FUNCTION_PROFILE_END(1, n, n); + + IDEBUG_END; + + return ret; + +} + +#else + +double CNAME(blasint n, float *x, blasint incx, float *y, blasint incy){ + + double ret = 0.0; + + PRINT_DEBUG_CNAME; + + if (n <= 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0) x -= (n - 1) * incx; + if (incy < 0) y -= (n - 1) * incy; + + ret=DSDOT_K(n, x, incx, y, incy); + + FUNCTION_PROFILE_END(1, n, n); + + IDEBUG_END; + + return ret; + +} + +#endif diff --git a/interface/gbmv.c b/interface/gbmv.c new file mode 100644 index 000000000..d96d89f10 --- /dev/null +++ b/interface/gbmv.c @@ -0,0 +1,252 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QGBMV " +#elif defined(DOUBLE) +#define ERROR_NAME "DGBMV " +#else +#define ERROR_NAME "SGBMV " +#endif + +static void (*gbmv[])(BLASLONG, BLASLONG, BLASLONG, BLASLONG, FLOAT, + FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { +#ifdef XDOUBLE + qgbmv_n, qgbmv_t, +#elif defined(DOUBLE) + dgbmv_n, dgbmv_t, +#else + sgbmv_n, sgbmv_t, +#endif +}; + +#ifdef SMPTEST +static int (*gbmv_thread[])(BLASLONG, BLASLONG, BLASLONG, BLASLONG, FLOAT, + FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { +#ifdef XDOUBLE + qgbmv_thread_n, qgbmv_thread_t, +#elif defined(DOUBLE) + dgbmv_thread_n, dgbmv_thread_t, +#else + sgbmv_thread_n, sgbmv_thread_t, +#endif +}; +#endif + +#ifndef CBLAS + +void NAME(char *TRANS, blasint *M, blasint *N, + blasint *KU, blasint *KL, + FLOAT *ALPHA, FLOAT *a, blasint *LDA, + FLOAT *x, blasint *INCX, + FLOAT *BETA, FLOAT *y, blasint *INCY){ + + char trans = *TRANS; + blasint m = *M; + blasint n = *N; + blasint ku = *KU; + blasint kl = *KL; + blasint lda = *LDA; + blasint incx = *INCX; + blasint incy = *INCY; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + FLOAT alpha = *ALPHA; + FLOAT beta = *BETA; + + blasint info; + blasint lenx, leny; + blasint i; + + PRINT_DEBUG_NAME; + + TOUPPER(trans); + + info = 0; + + i = -1; + + if (trans == 'N') i = 0; + if (trans == 'T') i = 1; + if (trans == 'R') i = 0; + if (trans == 'C') i = 1; + + if (incy == 0) info = 13; + if (incx == 0) info = 10; + if (lda < kl + ku + 1) info = 8; + if (kl < 0) info = 5; + if (ku < 0) info = 4; + if (n < 0) info = 3; + if (m < 0) info = 2; + if (i < 0) info = 1; + + trans = i; + + if (info != 0){ + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, + enum CBLAS_TRANSPOSE TransA, + blasint m, blasint n, + blasint ku, blasint kl, + FLOAT alpha, + FLOAT *a, blasint lda, + FLOAT *x, blasint incx, + FLOAT beta, + FLOAT *y, blasint incy){ + + FLOAT *buffer; + blasint lenx, leny, info, t; + int trans; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_CNAME; + + trans = -1; + info = 0; + + if (order == CblasColMajor) { + if (TransA == CblasNoTrans) trans = 0; + if (TransA == CblasTrans) trans = 1; + if (TransA == CblasConjNoTrans) trans = 0; + if (TransA == CblasConjTrans) trans = 1; + + info = -1; + + if (incy == 0) info = 13; + if (incx == 0) info = 10; + if (lda < kl + ku + 1) info = 8; + if (kl < 0) info = 5; + if (ku < 0) info = 4; + if (n < 0) info = 3; + if (m < 0) info = 2; + if (trans < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (TransA == CblasNoTrans) trans = 1; + if (TransA == CblasTrans) trans = 0; + if (TransA == CblasConjNoTrans) trans = 1; + if (TransA == CblasConjTrans) trans = 0; + + info = -1; + + t = n; + n = m; + m = t; + + t = ku; + ku = kl; + kl = t; + + if (incy == 0) info = 13; + if (incx == 0) info = 10; + if (lda < kl + ku + 1) info = 8; + if (kl < 0) info = 5; + if (ku < 0) info = 4; + if (n < 0) info = 3; + if (m < 0) info = 2; + if (trans < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if ((m==0) || (n==0)) return; + + lenx = n; + leny = m; + if (trans) lenx = m; + if (trans) leny = n; + + if (beta != ONE) SCAL_K(leny, 0, 0, beta, y, abs(incy), NULL, 0, NULL, 0); + + if (alpha == ZERO) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0) x -= (lenx-1)*incx; + if (incy < 0) y -= (leny-1)*incy; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (gbmv[(int)trans])(m, n, kl, ku, alpha, a, lda, x, incx, y, incy, buffer); + +#ifdef SMPTEST + } else { + + (gbmv_thread[(int)trans])(m, n, kl, ku, alpha, a, lda, x, incx, y, incy, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(1, m * n / 2 + n, m * n); + + IDEBUG_END; + + return; +} diff --git a/interface/gemm.c b/interface/gemm.c new file mode 100644 index 000000000..ceb5ff355 --- /dev/null +++ b/interface/gemm.c @@ -0,0 +1,461 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifndef COMPLEX +#ifdef XDOUBLE +#define ERROR_NAME "QGEMM " +#elif defined(DOUBLE) +#define ERROR_NAME "DGEMM " +#else +#define ERROR_NAME "SGEMM " +#endif +#else +#ifndef GEMM3M +#ifdef XDOUBLE +#define ERROR_NAME "XGEMM " +#elif defined(DOUBLE) +#define ERROR_NAME "ZGEMM " +#else +#define ERROR_NAME "CGEMM " +#endif +#else +#ifdef XDOUBLE +#define ERROR_NAME "XGEMM3M " +#elif defined(DOUBLE) +#define ERROR_NAME "ZGEMM3M " +#else +#define ERROR_NAME "CGEMM3M " +#endif +#endif +#endif + +#ifndef GEMM_MULTITHREAD_THRESHOLD +# define GEMM_MULTITHREAD_THRESHOLD 4 +#endif + +static int (*gemm[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { +#ifndef GEMM3M + GEMM_NN, GEMM_TN, GEMM_RN, GEMM_CN, + GEMM_NT, GEMM_TT, GEMM_RT, GEMM_CT, + GEMM_NR, GEMM_TR, GEMM_RR, GEMM_CR, + GEMM_NC, GEMM_TC, GEMM_RC, GEMM_CC, +#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3) + GEMM_THREAD_NN, GEMM_THREAD_TN, GEMM_THREAD_RN, GEMM_THREAD_CN, + GEMM_THREAD_NT, GEMM_THREAD_TT, GEMM_THREAD_RT, GEMM_THREAD_CT, + GEMM_THREAD_NR, GEMM_THREAD_TR, GEMM_THREAD_RR, GEMM_THREAD_CR, + GEMM_THREAD_NC, GEMM_THREAD_TC, GEMM_THREAD_RC, GEMM_THREAD_CC, +#endif +#else + GEMM3M_NN, GEMM3M_TN, GEMM3M_RN, GEMM3M_CN, + GEMM3M_NT, GEMM3M_TT, GEMM3M_RT, GEMM3M_CT, + GEMM3M_NR, GEMM3M_TR, GEMM3M_RR, GEMM3M_CR, + GEMM3M_NC, GEMM3M_TC, GEMM3M_RC, GEMM3M_CC, +#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3) + GEMM3M_THREAD_NN, GEMM3M_THREAD_TN, GEMM3M_THREAD_RN, GEMM3M_THREAD_CN, + GEMM3M_THREAD_NT, GEMM3M_THREAD_TT, GEMM3M_THREAD_RT, GEMM3M_THREAD_CT, + GEMM3M_THREAD_NR, GEMM3M_THREAD_TR, GEMM3M_THREAD_RR, GEMM3M_THREAD_CR, + GEMM3M_THREAD_NC, GEMM3M_THREAD_TC, GEMM3M_THREAD_RC, GEMM3M_THREAD_CC, +#endif +#endif +}; + +#ifndef CBLAS + +void NAME(char *TRANSA, char *TRANSB, + blasint *M, blasint *N, blasint *K, + FLOAT *alpha, + FLOAT *a, blasint *ldA, + FLOAT *b, blasint *ldB, + FLOAT *beta, + FLOAT *c, blasint *ldC){ + + blas_arg_t args; + + int transa, transb, nrowa, nrowb; + blasint info; + + char transA, transB; + FLOAT *buffer; + FLOAT *sa, *sb; + +#ifdef SMPTEST +#ifndef COMPLEX +#ifdef XDOUBLE + int mode = BLAS_XDOUBLE | BLAS_REAL; +#elif defined(DOUBLE) + int mode = BLAS_DOUBLE | BLAS_REAL; +#else + int mode = BLAS_SINGLE | BLAS_REAL; +#endif +#else +#ifdef XDOUBLE + int mode = BLAS_XDOUBLE | BLAS_COMPLEX; +#elif defined(DOUBLE) + int mode = BLAS_DOUBLE | BLAS_COMPLEX; +#else + int mode = BLAS_SINGLE | BLAS_COMPLEX; +#endif +#endif +#endif + +#if defined(SMPTEST) && !defined(NO_AFFINITY) && !defined(USE_SIMPLE_THREADED_LEVEL3) + int nodes; +#endif + + PRINT_DEBUG_NAME; + + args.m = *M; + args.n = *N; + args.k = *K; + + args.a = (void *)a; + args.b = (void *)b; + args.c = (void *)c; + + args.lda = *ldA; + args.ldb = *ldB; + args.ldc = *ldC; + + args.alpha = (void *)alpha; + args.beta = (void *)beta; + + transA = *TRANSA; + transB = *TRANSB; + + TOUPPER(transA); + TOUPPER(transB); + + transa = -1; + transb = -1; + + if (transA == 'N') transa = 0; + if (transA == 'T') transa = 1; +#ifndef COMPLEX + if (transA == 'R') transa = 0; + if (transA == 'C') transa = 1; +#else + if (transA == 'R') transa = 2; + if (transA == 'C') transa = 3; +#endif + + if (transB == 'N') transb = 0; + if (transB == 'T') transb = 1; +#ifndef COMPLEX + if (transB == 'R') transb = 0; + if (transB == 'C') transb = 1; +#else + if (transB == 'R') transb = 2; + if (transB == 'C') transb = 3; +#endif + + nrowa = args.m; + if (transa & 1) nrowa = args.k; + nrowb = args.k; + if (transb & 1) nrowb = args.n; + + info = 0; + + if (args.ldc < args.m) info = 13; + if (args.ldb < nrowb) info = 10; + if (args.lda < nrowa) info = 8; + if (args.k < 0) info = 5; + if (args.n < 0) info = 4; + if (args.m < 0) info = 3; + if (transb < 0) info = 2; + if (transa < 0) info = 1; + + if (info){ + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_TRANSPOSE TransA, enum CBLAS_TRANSPOSE TransB, + blasint m, blasint n, blasint k, +#ifndef COMPLEX + FLOAT alpha, +#else + FLOAT *alpha, +#endif + FLOAT *a, blasint lda, + FLOAT *b, blasint ldb, +#ifndef COMPLEX + FLOAT beta, +#else + FLOAT *beta, +#endif + FLOAT *c, blasint ldc) { + + blas_arg_t args; + int transa, transb; + blasint nrowa, nrowb, info; + + XFLOAT *buffer; + XFLOAT *sa, *sb; + +#ifdef SMPTEST +#ifndef COMPLEX +#ifdef XDOUBLE + int mode = BLAS_XDOUBLE | BLAS_REAL; +#elif defined(DOUBLE) + int mode = BLAS_DOUBLE | BLAS_REAL; +#else + int mode = BLAS_SINGLE | BLAS_REAL; +#endif +#else +#ifdef XDOUBLE + int mode = BLAS_XDOUBLE | BLAS_COMPLEX; +#elif defined(DOUBLE) + int mode = BLAS_DOUBLE | BLAS_COMPLEX; +#else + int mode = BLAS_SINGLE | BLAS_COMPLEX; +#endif +#endif +#endif + +#if defined(SMPTEST) && !defined(NO_AFFINITY) && !defined(USE_SIMPLE_THREADED_LEVEL3) + int nodes; +#endif + + PRINT_DEBUG_CNAME; + +#ifndef COMPLEX + args.alpha = (void *)α + args.beta = (void *)β +#else + args.alpha = (void *)alpha; + args.beta = (void *)beta; +#endif + + transa = -1; + transb = -1; + info = 0; + + if (order == CblasColMajor) { + args.m = m; + args.n = n; + args.k = k; + + args.a = (void *)a; + args.b = (void *)b; + args.c = (void *)c; + + args.lda = lda; + args.ldb = ldb; + args.ldc = ldc; + + if (TransA == CblasNoTrans) transa = 0; + if (TransA == CblasTrans) transa = 1; +#ifndef COMPLEX + if (TransA == CblasConjNoTrans) transa = 0; + if (TransA == CblasConjTrans) transa = 1; +#else + if (TransA == CblasConjNoTrans) transa = 2; + if (TransA == CblasConjTrans) transa = 3; +#endif + if (TransB == CblasNoTrans) transb = 0; + if (TransB == CblasTrans) transb = 1; +#ifndef COMPLEX + if (TransB == CblasConjNoTrans) transb = 0; + if (TransB == CblasConjTrans) transb = 1; +#else + if (TransB == CblasConjNoTrans) transb = 2; + if (TransB == CblasConjTrans) transb = 3; +#endif + + nrowa = args.m; + if (transa & 1) nrowa = args.k; + nrowb = args.k; + if (transb & 1) nrowb = args.n; + + info = -1; + + if (args.ldc < args.m) info = 13; + if (args.ldb < nrowb) info = 10; + if (args.lda < nrowa) info = 8; + if (args.k < 0) info = 5; + if (args.n < 0) info = 4; + if (args.m < 0) info = 3; + if (transb < 0) info = 2; + if (transa < 0) info = 1; + } + + if (order == CblasRowMajor) { + args.m = n; + args.n = m; + args.k = k; + + args.a = (void *)b; + args.b = (void *)a; + args.c = (void *)c; + + args.lda = ldb; + args.ldb = lda; + args.ldc = ldc; + + if (TransB == CblasNoTrans) transa = 0; + if (TransB == CblasTrans) transa = 1; +#ifndef COMPLEX + if (TransB == CblasConjNoTrans) transa = 0; + if (TransB == CblasConjTrans) transa = 1; +#else + if (TransB == CblasConjNoTrans) transa = 2; + if (TransB == CblasConjTrans) transa = 3; +#endif + if (TransA == CblasNoTrans) transb = 0; + if (TransA == CblasTrans) transb = 1; +#ifndef COMPLEX + if (TransA == CblasConjNoTrans) transb = 0; + if (TransA == CblasConjTrans) transb = 1; +#else + if (TransA == CblasConjNoTrans) transb = 2; + if (TransA == CblasConjTrans) transb = 3; +#endif + + nrowa = args.m; + if (transa & 1) nrowa = args.k; + nrowb = args.k; + if (transb & 1) nrowb = args.n; + + info = -1; + + if (args.ldc < args.m) info = 13; + if (args.ldb < nrowb) info = 10; + if (args.lda < nrowa) info = 8; + if (args.k < 0) info = 5; + if (args.n < 0) info = 4; + if (args.m < 0) info = 3; + if (transb < 0) info = 2; + if (transa < 0) info = 1; + + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if ((args.m == 0) || (args.n == 0)) return; + +#if 0 + fprintf(stderr, "m = %4d n = %d k = %d lda = %4d ldb = %4d ldc = %4d\n", + args.m, args.n, args.k, args.lda, args.ldb, args.ldc); +#endif + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + buffer = (XFLOAT *)blas_memory_alloc(0); + + sa = (XFLOAT *)((BLASLONG)buffer +GEMM_OFFSET_A); + sb = (XFLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); + +#ifdef SMPTEST + mode |= (transa << BLAS_TRANSA_SHIFT); + mode |= (transb << BLAS_TRANSB_SHIFT); + + args.common = NULL; + + if(args.m <= GEMM_MULTITHREAD_THRESHOLD || args.n <= GEMM_MULTITHREAD_THRESHOLD + || args.k <=GEMM_MULTITHREAD_THRESHOLD){ + args.nthreads = 1; + }else{ + args.nthreads = num_cpu_avail(3); + } + if (args.nthreads == 1) { +#endif + + (gemm[(transb << 2) | transa])(&args, NULL, NULL, sa, sb, 0); + +#ifdef SMPTEST + + } else { + +#ifndef USE_SIMPLE_THREADED_LEVEL3 + +#ifndef NO_AFFINITY + nodes = get_num_nodes(); + + if ((nodes > 1) && get_node_equal()) { + + args.nthreads /= nodes; + + gemm_thread_mn(mode, &args, NULL, NULL, gemm[16 | (transb << 2) | transa], sa, sb, nodes); + + } else { +#endif + + (gemm[16 | (transb << 2) | transa])(&args, NULL, NULL, sa, sb, 0); + +#else + + GEMM_THREAD(mode, &args, NULL, NULL, gemm[(transb << 2) | transa], sa, sb, args.nthreads); + +#endif + +#ifndef USE_SIMPLE_THREADED_LEVEL3 +#ifndef NO_AFFINITY + } +#endif +#endif + +#endif + +#ifdef SMPTEST + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.m * args.k + args.k * args.n + args.m * args.n, 2 * args.m * args.n * args.k); + + IDEBUG_END; + + return; +} diff --git a/interface/gemv.c b/interface/gemv.c new file mode 100644 index 000000000..0c55c6fe6 --- /dev/null +++ b/interface/gemv.c @@ -0,0 +1,237 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QGEMV " +#elif defined(DOUBLE) +#define ERROR_NAME "DGEMV " +#else +#define ERROR_NAME "SGEMV " +#endif + +#ifdef SMPTEST +static int (*gemv_thread[])(BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { +#ifdef XDOUBLE + qgemv_thread_n, qgemv_thread_t, +#elif defined DOUBLE + dgemv_thread_n, dgemv_thread_t, +#else + sgemv_thread_n, sgemv_thread_t, +#endif +}; +#endif + +#ifndef CBLAS + +void NAME(char *TRANS, blasint *M, blasint *N, + FLOAT *ALPHA, FLOAT *a, blasint *LDA, + FLOAT *x, blasint *INCX, + FLOAT *BETA, FLOAT *y, blasint *INCY){ + + char trans = *TRANS; + blasint m = *M; + blasint n = *N; + blasint lda = *LDA; + blasint incx = *INCX; + blasint incy = *INCY; + FLOAT alpha = *ALPHA; + FLOAT beta = *BETA; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + int (*gemv[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { + GEMV_N, GEMV_T, + }; + + blasint info; + blasint lenx, leny; + blasint i; + + PRINT_DEBUG_NAME; + + TOUPPER(trans); + + info = 0; + + i = -1; + + if (trans == 'N') i = 0; + if (trans == 'T') i = 1; + if (trans == 'R') i = 0; + if (trans == 'C') i = 1; + + if (incy == 0) info = 11; + if (incx == 0) info = 8; + if (lda < MAX(1, m)) info = 6; + if (n < 0) info = 3; + if (m < 0) info = 2; + if (i < 0) info = 1; + + trans = i; + + if (info != 0){ + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, + enum CBLAS_TRANSPOSE TransA, + blasint m, blasint n, + FLOAT alpha, + FLOAT *a, blasint lda, + FLOAT *x, blasint incx, + FLOAT beta, + FLOAT *y, blasint incy){ + + FLOAT *buffer; + blasint lenx, leny; + int trans; + blasint info, t; +#ifdef SMPTEST + int nthreads; +#endif + + int (*gemv[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { + GEMV_N, GEMV_T, + }; + + PRINT_DEBUG_CNAME; + + trans = -1; + info = 0; + + if (order == CblasColMajor) { + if (TransA == CblasNoTrans) trans = 0; + if (TransA == CblasTrans) trans = 1; + if (TransA == CblasConjNoTrans) trans = 0; + if (TransA == CblasConjTrans) trans = 1; + + info = -1; + + if (incy == 0) info = 11; + if (incx == 0) info = 8; + if (lda < MAX(1, m)) info = 6; + if (n < 0) info = 3; + if (m < 0) info = 2; + if (trans < 0) info = 1; + + } + + if (order == CblasRowMajor) { + if (TransA == CblasNoTrans) trans = 1; + if (TransA == CblasTrans) trans = 0; + if (TransA == CblasConjNoTrans) trans = 1; + if (TransA == CblasConjTrans) trans = 0; + + info = -1; + + t = n; + n = m; + m = t; + + if (incy == 0) info = 11; + if (incx == 0) info = 8; + if (lda < MAX(1, m)) info = 6; + if (n < 0) info = 3; + if (m < 0) info = 2; + if (trans < 0) info = 1; + + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if ((m==0) || (n==0)) return; + + lenx = n; + leny = m; + if (trans) lenx = m; + if (trans) leny = n; + + if (beta != ONE) SCAL_K(leny, 0, 0, beta, y, abs(incy), NULL, 0, NULL, 0); + + if (alpha == ZERO) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0) x -= (lenx - 1) * incx; + if (incy < 0) y -= (leny - 1) * incy; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (gemv[(int)trans])(m, n, 0, alpha, a, lda, x, incx, y, incy, buffer); + +#ifdef SMPTEST + } else { + + (gemv_thread[(int)trans])(m, n, alpha, a, lda, x, incx, y, incy, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(1, m * n + m + n, 2 * m * n); + + IDEBUG_END; + + return; + +} diff --git a/interface/ger.c b/interface/ger.c new file mode 100644 index 000000000..eb3d224f0 --- /dev/null +++ b/interface/ger.c @@ -0,0 +1,193 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QGER " +#elif defined DOUBLE +#define ERROR_NAME "DGER " +#else +#define ERROR_NAME "SGER " +#endif + +#define GER GERU_K + +#if defined XDOUBLE +#define GER_THREAD qger_thread +#elif defined DOUBLE +#define GER_THREAD dger_thread +#else +#define GER_THREAD sger_thread +#endif + + +#ifndef CBLAS + +void NAME(blasint *M, blasint *N, FLOAT *Alpha, + FLOAT *x, blasint *INCX, + FLOAT *y, blasint *INCY, + FLOAT *a, blasint *LDA){ + + blasint m = *M; + blasint n = *N; + FLOAT alpha = *Alpha; + blasint incx = *INCX; + blasint incy = *INCY; + blasint lda = *LDA; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + blasint info; + + PRINT_DEBUG_NAME; + + info = 0; + + if (lda < MAX(1,m)) info = 9; + if (incy == 0) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (m < 0) info = 1; + + if (info){ + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, + blasint m, blasint n, + FLOAT alpha, + FLOAT *x, blasint incx, + FLOAT *y, blasint incy, + FLOAT *a, blasint lda) { + + FLOAT *buffer; + blasint info, t; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_CNAME; + + info = 0; + + if (order == CblasColMajor) { + info = -1; + + if (lda < MAX(1,m)) info = 9; + if (incy == 0) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (m < 0) info = 1; + } + + if (order == CblasRowMajor) { + info = -1; + + t = n; + n = m; + m = t; + + t = incx; + incx = incy; + incy = t; + + buffer = x; + x = y; + y = buffer; + + if (lda < MAX(1,m)) info = 9; + if (incy == 0) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (m < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + /* Quick return if possible. */ + if (m == 0 || n == 0) return; + if (alpha == 0.) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incy < 0) y -= (n - 1) * incy; + if (incx < 0) x -= (m - 1) * incx; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + GER(m, n, 0, alpha, x, incx, y, incy, a, lda, buffer); + +#ifdef SMPTEST + } else { + + GER_THREAD(m, n, alpha, x, incx, y, incy, a, lda, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(1, m * n + m + n, 2 * m * n); + + IDEBUG_END; + + return; +} diff --git a/interface/gesv.c b/interface/gesv.c new file mode 100644 index 000000000..920f6ab80 --- /dev/null +++ b/interface/gesv.c @@ -0,0 +1,154 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifndef COMPLEX +#ifdef XDOUBLE +#define ERROR_NAME "QGESV " +#elif defined(DOUBLE) +#define ERROR_NAME "DGESV " +#else +#define ERROR_NAME "SGESV " +#endif +#else +#ifdef XDOUBLE +#define ERROR_NAME "XGESV " +#elif defined(DOUBLE) +#define ERROR_NAME "ZGESV " +#else +#define ERROR_NAME "CGESV " +#endif +#endif + +int NAME(blasint *N, blasint *NRHS, FLOAT *a, blasint *ldA, blasint *ipiv, + FLOAT *b, blasint *ldB, blasint *Info){ + + blas_arg_t args; + + blasint info; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.m = *N; + args.n = *NRHS; + args.a = (void *)a; + args.lda = *ldA; + args.b = (void *)b; + args.ldb = *ldB; + args.c = (void *)ipiv; + + info = 0; + if (args.ldb < MAX(1,args.m)) info = 7; + if (args.lda < MAX(1,args.m)) info = 4; + if (args.n < 0) info = 2; + if (args.m < 0) info = 1; + + if (info) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + *Info = - info; + return 0; + } + + args.alpha = NULL; + args.beta = NULL; + + *Info = 0; + + if (args.m == 0 || args.n == 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + +#ifdef SMPTEST + args.common = NULL; + args.nthreads = num_cpu_avail(4); + + if (args.nthreads == 1) { +#endif + + args.n = *N; + info = GETRF_SINGLE(&args, NULL, NULL, sa, sb, 0); + + if (info == 0){ + args.n = *NRHS; + GETRS_N_SINGLE(&args, NULL, NULL, sa, sb, 0); + } + +#ifdef SMPTEST + } else { + + args.n = *N; + info = GETRF_PARALLEL(&args, NULL, NULL, sa, sb, 0); + + if (info == 0){ + args.n = *NRHS; + GETRS_N_PARALLEL(&args, NULL, NULL, sa, sb, 0); + } + } +#endif + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + *Info = info; + + FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, *N * *N, 2. / 3. * *N * *N * *N + *N * *N); + + IDEBUG_END; + + return 0; +} diff --git a/interface/imax.c b/interface/imax.c new file mode 100644 index 000000000..37396c7f8 --- /dev/null +++ b/interface/imax.c @@ -0,0 +1,171 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#undef MAX_K + +#ifdef USE_ABS + +#ifndef USE_MIN + +/* ABS & MAX */ +#ifndef COMPLEX +#ifdef XDOUBLE +#define MAX_K IQAMAX_K +#elif defined(DOUBLE) +#define MAX_K IDAMAX_K +#else +#define MAX_K ISAMAX_K +#endif +#else +#ifdef XDOUBLE +#define MAX_K IXAMAX_K +#elif defined(DOUBLE) +#define MAX_K IZAMAX_K +#else +#define MAX_K ICAMAX_K +#endif +#endif + +#else + +/* ABS & MIN */ +#ifndef COMPLEX +#ifdef XDOUBLE +#define MAX_K IQAMIN_K +#elif defined(DOUBLE) +#define MAX_K IDAMIN_K +#else +#define MAX_K ISAMIN_K +#endif +#else +#ifdef XDOUBLE +#define MAX_K IXAMIN_K +#elif defined(DOUBLE) +#define MAX_K IZAMIN_K +#else +#define MAX_K ICAMIN_K +#endif +#endif + +#endif + +#else + +#ifndef USE_MIN + +/* MAX */ +#ifdef XDOUBLE +#define MAX_K IQMAX_K +#elif defined(DOUBLE) +#define MAX_K IDMAX_K +#else +#define MAX_K ISMAX_K +#endif + +#else + +/* MIN */ +#ifdef XDOUBLE +#define MAX_K IQMIN_K +#elif defined(DOUBLE) +#define MAX_K IDMIN_K +#else +#define MAX_K ISMIN_K +#endif + +#endif + +#endif + +#ifndef CBLAS + +blasint NAME(blasint *N, FLOAT *x, blasint *INCX){ + + BLASLONG n = *N; + BLASLONG incx = *INCX; + blasint ret; + + PRINT_DEBUG_NAME; + + if (n <= 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + ret = (blasint)MAX_K(n, x, incx); + + FUNCTION_PROFILE_END(COMPSIZE, n, 0); + + IDEBUG_END; + + return ret; +} + +#else + +CBLAS_INDEX CNAME(blasint n, FLOAT *x, blasint incx){ + + CBLAS_INDEX ret; + + PRINT_DEBUG_CNAME; + + if (n <= 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + ret = MAX_K(n, x, incx); + + if (ret) ret --; + + FUNCTION_PROFILE_END(COMPSIZE, n, 0); + + IDEBUG_END; + + return ret; +} + +#endif diff --git a/interface/max.c b/interface/max.c new file mode 100644 index 000000000..9bedaddd0 --- /dev/null +++ b/interface/max.c @@ -0,0 +1,169 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#undef MAX_K + +#ifdef USE_ABS + +#ifndef USE_MIN + +/* ABS & MAX */ +#ifndef COMPLEX +#ifdef XDOUBLE +#define MAX_K QAMAX_K +#elif defined(DOUBLE) +#define MAX_K DAMAX_K +#else +#define MAX_K SAMAX_K +#endif +#else +#ifdef XDOUBLE +#define MAX_K XAMAX_K +#elif defined(DOUBLE) +#define MAX_K ZAMAX_K +#else +#define MAX_K CAMAX_K +#endif +#endif + +#else + +/* ABS & MIN */ +#ifndef COMPLEX +#ifdef XDOUBLE +#define MAX_K QAMIN_K +#elif defined(DOUBLE) +#define MAX_K DAMIN_K +#else +#define MAX_K SAMIN_K +#endif +#else +#ifdef XDOUBLE +#define MAX_K XAMIN_K +#elif defined(DOUBLE) +#define MAX_K ZAMIN_K +#else +#define MAX_K CAMIN_K +#endif +#endif + +#endif + +#else + +#ifndef USE_MIN + +/* MAX */ +#ifdef XDOUBLE +#define MAX_K QMAX_K +#elif defined(DOUBLE) +#define MAX_K DMAX_K +#else +#define MAX_K SMAX_K +#endif + +#else + +/* MIN */ +#ifdef XDOUBLE +#define MAX_K QMIN_K +#elif defined(DOUBLE) +#define MAX_K DMIN_K +#else +#define MAX_K SMIN_K +#endif + +#endif + +#endif + +#ifndef CBLAS + +FLOATRET NAME(blasint *N, FLOAT *x, blasint *INCX){ + + BLASLONG n = *N; + BLASLONG incx = *INCX; + FLOATRET ret; + + PRINT_DEBUG_NAME; + + if (n <= 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + ret = (FLOATRET)MAX_K(n, x, incx); + + FUNCTION_PROFILE_END(COMPSIZE, n, 0); + + IDEBUG_END; + + return ret; +} + +#else + +FLOAT CNAME(blasint n, FLOAT *x, blasint incx){ + + FLOAT ret; + + PRINT_DEBUG_CNAME; + + if (n <= 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + ret = MAX_K(n, x, incx); + + FUNCTION_PROFILE_END(COMPSIZE, n, 0); + + IDEBUG_END; + + return ret; +} + +#endif diff --git a/interface/nrm2.c b/interface/nrm2.c new file mode 100644 index 000000000..ff8ef6d0d --- /dev/null +++ b/interface/nrm2.c @@ -0,0 +1,93 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifndef CBLAS + +FLOATRET NAME(blasint *N, FLOAT *x, blasint *INCX){ + + BLASLONG n = *N; + BLASLONG incx = *INCX; + FLOATRET ret; + + PRINT_DEBUG_NAME; + + if (n <= 0) return 0.; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + ret = (FLOATRET)NRM2_K(n, x, incx); + + FUNCTION_PROFILE_END(COMPSIZE, n, 2 * n); + + IDEBUG_END; + + return ret; +} + +#else + +FLOAT CNAME(blasint n, FLOAT *x, blasint incx){ + + FLOAT ret; + + PRINT_DEBUG_CNAME; + + if (n <= 0) return 0.; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + ret = NRM2_K(n, x, incx); + + FUNCTION_PROFILE_END(COMPSIZE, n, 2 * n); + + IDEBUG_END; + + return ret; +} + +#endif diff --git a/interface/rot.c b/interface/rot.c new file mode 100644 index 000000000..2e458b12d --- /dev/null +++ b/interface/rot.c @@ -0,0 +1,82 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifndef CBLAS + +void NAME(blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *C, FLOAT *S){ + + BLASLONG n = *N; + BLASLONG incx = *INCX; + BLASLONG incy = *INCY; + FLOAT c = *C; + FLOAT s = *S; + + PRINT_DEBUG_NAME; + +#else + +void CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy, FLOAT c, FLOAT s){ + + PRINT_DEBUG_CNAME; + +#endif + + if (n <= 0) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0) x -= (n - 1) * incx; + if (incy < 0) y -= (n - 1) * incy; + + ROT_K(n, x, incx, y, incy, c, s); + + FUNCTION_PROFILE_END(1, n, n); + + IDEBUG_END; + + return; + +} diff --git a/interface/rotg.c b/interface/rotg.c new file mode 100644 index 000000000..49088ab02 --- /dev/null +++ b/interface/rotg.c @@ -0,0 +1,109 @@ +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifndef CBLAS + +void NAME(FLOAT *DA, FLOAT *DB, FLOAT *C, FLOAT *S){ + +#else + +void CNAME(FLOAT *DA, FLOAT *DB, FLOAT *C, FLOAT *S){ + +#endif + + +#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__) + + long double da = *DA; + long double db = *DB; + long double c; + long double s; + long double r, roe, z; + + long double ada = fabs(da); + long double adb = fabs(db); + long double scale = ada + adb; + +#ifndef CBLAS + PRINT_DEBUG_NAME; +#else + PRINT_DEBUG_CNAME; +#endif + + roe = db; + if (ada > adb) roe = da; + + if (scale == ZERO) { + *C = ONE; + *S = ZERO; + *DA = ZERO; + *DB = ZERO; + } else { + r = sqrt(da * da + db * db); + if (roe < 0) r = -r; + c = da / r; + s = db / r; + z = ONE; + if (da != ZERO) { + if (ada > adb){ + z = s; + } else { + z = ONE / c; + } + } + + *C = c; + *S = s; + *DA = r; + *DB = z; + } + +#else + FLOAT da = *DA; + FLOAT db = *DB; + FLOAT c = *C; + FLOAT s = *S; + FLOAT r, roe, z; + + FLOAT ada = fabs(da); + FLOAT adb = fabs(db); + FLOAT scale = ada + adb; + +#ifndef CBLAS + PRINT_DEBUG_NAME; +#else + PRINT_DEBUG_CNAME; +#endif + + roe = db; + if (ada > adb) roe = da; + + if (scale == ZERO) { + *C = ONE; + *S = ZERO; + *DA = ZERO; + *DB = ZERO; + } else { + FLOAT aa = da / scale; + FLOAT bb = db / scale; + + r = scale * sqrt(aa * aa + bb * bb); + if (roe < 0) r = -r; + c = da / r; + s = db / r; + z = ONE; + if (ada > adb) z = s; + if ((ada < adb) && (c != ZERO)) z = ONE / c; + + *C = c; + *S = s; + *DA = r; + *DB = z; + } +#endif + + return; +} diff --git a/interface/rotm.c b/interface/rotm.c new file mode 100644 index 000000000..4f026c75d --- /dev/null +++ b/interface/rotm.c @@ -0,0 +1,155 @@ +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifndef CBLAS + +void NAME(blasint *N, FLOAT *dx, blasint *INCX, FLOAT *dy, blasint *INCY, FLOAT *dparam){ + + blasint n = *N; + blasint incx = *INCX; + blasint incy = *INCY; + +#else + +void CNAME(blasint n, FLOAT *dx, blasint incx, FLOAT *dy, blasint incy, FLOAT *dparam){ + +#endif + + blasint i__1, i__2; + + blasint i__; + FLOAT w, z__; + blasint kx, ky; + FLOAT dh11, dh12, dh22, dh21, dflag; + blasint nsteps; + +#ifndef CBLAS + PRINT_DEBUG_CNAME; +#else + PRINT_DEBUG_CNAME; +#endif + + --dparam; + --dy; + --dx; + + dflag = dparam[1]; + if (n <= 0 || dflag == - 2.0) goto L140; + + if (! (incx == incy && incx > 0)) goto L70; + + nsteps = n * incx; + if (dflag < 0.) { + goto L50; + } else if (dflag == 0) { + goto L10; + } else { + goto L30; + } +L10: + dh12 = dparam[4]; + dh21 = dparam[3]; + i__1 = nsteps; + i__2 = incx; + for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) { + w = dx[i__]; + z__ = dy[i__]; + dx[i__] = w + z__ * dh12; + dy[i__] = w * dh21 + z__; +/* L20: */ + } + goto L140; +L30: + dh11 = dparam[2]; + dh22 = dparam[5]; + i__2 = nsteps; + i__1 = incx; + for (i__ = 1; i__1 < 0 ? i__ >= i__2 : i__ <= i__2; i__ += i__1) { + w = dx[i__]; + z__ = dy[i__]; + dx[i__] = w * dh11 + z__; + dy[i__] = -w + dh22 * z__; +/* L40: */ + } + goto L140; +L50: + dh11 = dparam[2]; + dh12 = dparam[4]; + dh21 = dparam[3]; + dh22 = dparam[5]; + i__1 = nsteps; + i__2 = incx; + for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) { + w = dx[i__]; + z__ = dy[i__]; + dx[i__] = w * dh11 + z__ * dh12; + dy[i__] = w * dh21 + z__ * dh22; +/* L60: */ + } + goto L140; +L70: + kx = 1; + ky = 1; + if (incx < 0) { + kx = (1 - n) * incx + 1; + } + if (incy < 0) { + ky = (1 - n) * incy + 1; + } + + if (dflag < 0.) { + goto L120; + } else if (dflag == 0) { + goto L80; + } else { + goto L100; + } +L80: + dh12 = dparam[4]; + dh21 = dparam[3]; + i__2 = n; + for (i__ = 1; i__ <= i__2; ++i__) { + w = dx[kx]; + z__ = dy[ky]; + dx[kx] = w + z__ * dh12; + dy[ky] = w * dh21 + z__; + kx += incx; + ky += incy; +/* L90: */ + } + goto L140; +L100: + dh11 = dparam[2]; + dh22 = dparam[5]; + i__2 = n; + for (i__ = 1; i__ <= i__2; ++i__) { + w = dx[kx]; + z__ = dy[ky]; + dx[kx] = w * dh11 + z__; + dy[ky] = -w + dh22 * z__; + kx += incx; + ky += incy; +/* L110: */ + } + goto L140; +L120: + dh11 = dparam[2]; + dh12 = dparam[4]; + dh21 = dparam[3]; + dh22 = dparam[5]; + i__2 = n; + for (i__ = 1; i__ <= i__2; ++i__) { + w = dx[kx]; + z__ = dy[ky]; + dx[kx] = w * dh11 + z__ * dh12; + dy[ky] = w * dh21 + z__ * dh22; + kx += incx; + ky += incy; +/* L130: */ + } +L140: + return; +} + diff --git a/interface/rotmg.c b/interface/rotmg.c new file mode 100644 index 000000000..4dbb580eb --- /dev/null +++ b/interface/rotmg.c @@ -0,0 +1,235 @@ +/*************************************************************************** +Copyright (c) 2013, The OpenBLAS Project +All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +2. 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. +3. Neither the name of the OpenBLAS project 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 OPENBLAS PROJECT 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. +*****************************************************************************/ + +/************************************************************************************** +* 2014/05/02 Saar +* fixed two bugs as reported by Brendan Tracey +* Test with lapack-3.5.0 : OK +* +**************************************************************************************/ + + +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#define GAM 4096.e0 +#define GAMSQ 16777216.e0 +#define RGAMSQ 5.9604645e-8 + +#define TWO 2.e0 + +#ifdef DOUBLE +#define ABS(x) fabs(x) +#else +#define ABS(x) fabsf(x) +#endif + +#ifndef CBLAS + +void NAME(FLOAT *dd1, FLOAT *dd2, FLOAT *dx1, FLOAT *DY1, FLOAT *dparam){ + + FLOAT dy1 = *DY1; + +#else + +void CNAME(FLOAT *dd1, FLOAT *dd2, FLOAT *dx1, FLOAT dy1, FLOAT *dparam){ + +#endif + + FLOAT du, dp1, dp2, dq2, dq1, dh11, dh21, dh12, dh22, dflag, dtemp; + + if(*dd1 < ZERO) + { + dflag = -ONE; + dh11 = ZERO; + dh12 = ZERO; + dh21 = ZERO; + dh22 = ZERO; + + *dd1 = ZERO; + *dd2 = ZERO; + *dx1 = ZERO; + } + else + { + dp2 = *dd2 * dy1; + if(dp2 == ZERO) + { + dflag = -TWO; + dparam[0] = dflag; + return; + } + dp1 = *dd1 * *dx1; + dq2 = dp2 * dy1; + dq1 = dp1 * *dx1; + if(ABS(dq1) > ABS(dq2)) + { + dh21 = - dy1 / *dx1; + dh12 = dp2 / dp1; + + du = ONE - dh12 * dh21; + if(du > ZERO) + { + dflag = ZERO; + *dd1 = *dd1 / du; + *dd2 = *dd2 / du; + *dx1 = *dx1 * du; + + } + } + else + { + if(dq2 < ZERO) + { + dflag = -ONE; + + dh11 = ZERO; + dh12 = ZERO; + dh21 = ZERO; + dh22 = ZERO; + + *dd1 = ZERO; + *dd2 = ZERO; + *dx1 = ZERO; + } + else + { + dflag = ONE; + + dh11 = dp1 / dp2; + dh22 = *dx1 / dy1; + du = ONE + dh11 * dh22; + dtemp = *dd2 / du; + + *dd2 = *dd1 / du; + *dd1 = dtemp; + *dx1 = dy1 * du; + } + } + + + if(*dd1 != ZERO) + { + while( (*dd1 <= RGAMSQ) || (*dd1 >= GAMSQ) ) + { + if(dflag == ZERO) + { + dh11 = ONE; + dh22 = ONE; + dflag = -ONE; + } + else + { + if(dflag == ONE) + { + dh21 = -ONE; + dh12 = ONE; + dflag = -ONE; + } + } + if( *dd1 <= RGAMSQ ) + { + *dd1 = *dd1 * (GAM * GAM); + *dx1 = *dx1 / GAM; + dh11 = dh11 / GAM; + dh12 = dh12 / GAM; + } + else + { + *dd1 = *dd1 / (GAM * GAM); + *dx1 = *dx1 * GAM; + dh11 = dh11 * GAM; + dh12 = dh12 * GAM; + } + } + } + + if(*dd2 != ZERO) + { + while( (ABS(*dd2) <= RGAMSQ) || (ABS(*dd2) >= GAMSQ) ) + { + if(dflag == ZERO) + { + dh11 = ONE; + dh22 = ONE; + dflag = -ONE; + } + else + { + if(dflag == ONE) + { + dh21 = -ONE; + dh12 = ONE; + dflag = -ONE; + } + } + if( ABS(*dd2) <= RGAMSQ ) + { + *dd2 = *dd2 * (GAM * GAM); + dh21 = dh21 / GAM; + dh22 = dh22 / GAM; + } + else + { + *dd2 = *dd2 / (GAM * GAM); + dh21 = dh21 * GAM; + dh22 = dh22 * GAM; + } + } + } + + } + + if(dflag < ZERO) + { + dparam[1] = dh11; + dparam[2] = dh21; + dparam[3] = dh12; + dparam[4] = dh22; + } + else + { + if(dflag == ZERO) + { + dparam[2] = dh21; + dparam[3] = dh12; + } + else + { + dparam[1] = dh11; + dparam[4] = dh22; + } + } + + + dparam[0] = dflag; + return; +} + + diff --git a/interface/sbmv.c b/interface/sbmv.c new file mode 100644 index 000000000..f82ca537c --- /dev/null +++ b/interface/sbmv.c @@ -0,0 +1,215 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QSBMV " +#elif defined(DOUBLE) +#define ERROR_NAME "DSBMV " +#else +#define ERROR_NAME "SSBMV " +#endif + +static int (*sbmv[])(BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { +#ifdef XDOUBLE + qsbmv_U, qsbmv_L, +#elif defined(DOUBLE) + dsbmv_U, dsbmv_L, +#else + ssbmv_U, ssbmv_L, +#endif +}; + +#ifdef SMPTEST +static int (*sbmv_thread[])(BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { +#ifdef XDOUBLE + qsbmv_thread_U, qsbmv_thread_L, +#elif defined(DOUBLE) + dsbmv_thread_U, dsbmv_thread_L, +#else + ssbmv_thread_U, ssbmv_thread_L, +#endif +}; +#endif + +#ifndef CBLAS + +void NAME(char *UPLO, blasint *N, blasint *K, FLOAT *ALPHA, FLOAT *a, blasint *LDA, + FLOAT *x, blasint *INCX, FLOAT *BETA, FLOAT *y, blasint *INCY){ + + char uplo_arg = *UPLO; + blasint n = *N; + blasint k = *K; + FLOAT alpha = *ALPHA; + blasint lda = *LDA; + blasint incx = *INCX; + FLOAT beta = *BETA; + blasint incy = *INCY; + + blasint info; + int uplo; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + uplo = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incy == 0) info = 11; + if (incx == 0) info = 8; + if (lda < k + 1) info = 6; + if (k < 0) info = 3; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, + enum CBLAS_UPLO Uplo, + blasint n, blasint k, + FLOAT alpha, + FLOAT *a, blasint lda, + FLOAT *x, blasint incx, + FLOAT beta, + FLOAT *y, blasint incy){ + + FLOAT *buffer; + int uplo; + blasint info; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_CNAME; + + uplo = -1; + info = 0; + + if (order == CblasColMajor) { + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + info = -1; + + if (incy == 0) info = 11; + if (incx == 0) info = 8; + if (lda < k + 1) info = 6; + if (k < 0) info = 3; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + info = -1; + + if (incy == 0) info = 11; + if (incx == 0) info = 8; + if (lda < k + 1) info = 6; + if (k < 0) info = 3; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + if (beta != ONE) SCAL_K(n, 0, 0, beta, y, abs(incy), NULL, 0, NULL, 0); + + if (alpha == ZERO) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx; + if (incy < 0 ) y -= (n - 1) * incy; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (sbmv[uplo])(n, k, alpha, a, lda, x, incx, y, incy, buffer); + +#ifdef SMPTEST + } else { + + (sbmv_thread[uplo])(n, k, alpha, a, lda, x, incx, y, incy, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(1, n * k / 2 + n, n * k); + + IDEBUG_END; + + return; +} diff --git a/interface/scal.c b/interface/scal.c new file mode 100644 index 000000000..7b72ca01c --- /dev/null +++ b/interface/scal.c @@ -0,0 +1,112 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifndef CBLAS + +void NAME(blasint *N, FLOAT *ALPHA, FLOAT *x, blasint *INCX){ + + blasint n = *N; + blasint incx = *INCX; + FLOAT alpha = *ALPHA; + +#else + +void CNAME(blasint n, FLOAT alpha, FLOAT *x, blasint incx){ + +#endif + +#ifdef SMP + int mode, nthreads; +#endif + +#ifndef CBLAS + PRINT_DEBUG_NAME; +#else + PRINT_DEBUG_CNAME; +#endif + + if (incx <= 0 || n <= 0) return; + + if (alpha == ONE) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + +#ifdef SMP + nthreads = num_cpu_avail(1); + + if (nthreads == 1) { +#endif + + SCAL_K(n, 0, 0, alpha, x, incx, NULL, 0, NULL, 0); + +#ifdef SMP + } else { + +#ifdef DOUBLE + mode = BLAS_DOUBLE | BLAS_REAL; +#else + mode = BLAS_SINGLE | BLAS_REAL; +#endif + + blas_level1_thread(mode, n, 0, 0, +#ifndef CBLAS + ALPHA, +#else + &alpha, +#endif + x, incx, NULL, 0, NULL, 0, (void *)SCAL_K, nthreads); + + } +#endif + + FUNCTION_PROFILE_END(1, n, n); + + IDEBUG_END; + + return; + +} diff --git a/interface/sdsdot.c b/interface/sdsdot.c new file mode 100644 index 000000000..168468c3a --- /dev/null +++ b/interface/sdsdot.c @@ -0,0 +1,101 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifndef CBLAS + +FLOATRET NAME(blasint *N, FLOAT *a, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){ + + BLASLONG n = *N; + BLASLONG incx = *INCX; + BLASLONG incy = *INCY; + FLOATRET ret; + + PRINT_DEBUG_NAME; + + if (n <= 0) return(*a) ; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0) x -= (n - 1) * incx; + if (incy < 0) y -= (n - 1) * incy; + + ret = (FLOATRET)(SDSDOT_K(n, x, incx, y, incy) + *a); + + FUNCTION_PROFILE_END(1, 2 * n, 2 * n); + + IDEBUG_END; + + return ret; + +} + +#else + +FLOAT CNAME(blasint n, FLOAT alpha, FLOAT *x, blasint incx, FLOAT *y, blasint incy){ + + FLOAT ret; + + PRINT_DEBUG_CNAME; + + if (n <= 0) return (alpha); + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0) x -= (n - 1) * incx; + if (incy < 0) y -= (n - 1) * incy; + + ret = SDSDOT_K(n, x, incx, y, incy) + alpha; + + FUNCTION_PROFILE_END(1, 2 * n, 2 * n); + + IDEBUG_END; + + return ret; +} + +#endif diff --git a/interface/spmv.c b/interface/spmv.c new file mode 100644 index 000000000..3f853e56e --- /dev/null +++ b/interface/spmv.c @@ -0,0 +1,207 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QSPMV " +#elif defined(DOUBLE) +#define ERROR_NAME "DSPMV " +#else +#define ERROR_NAME "SSPMV " +#endif + +static int (*spmv[])(BLASLONG, FLOAT, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { +#ifdef XDOUBLE + qspmv_U, qspmv_L, +#elif defined(DOUBLE) + dspmv_U, dspmv_L, +#else + sspmv_U, sspmv_L, +#endif +}; + +#ifdef SMPTEST +static int (*spmv_thread[])(BLASLONG, FLOAT, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { +#ifdef XDOUBLE + qspmv_thread_U, qspmv_thread_L, +#elif defined(DOUBLE) + dspmv_thread_U, dspmv_thread_L, +#else + sspmv_thread_U, sspmv_thread_L, +#endif +}; +#endif + +#ifndef CBLAS + +void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, + FLOAT *x, blasint *INCX, FLOAT *BETA, FLOAT *y, blasint *INCY){ + + char uplo_arg = *UPLO; + blasint n = *N; + FLOAT alpha = *ALPHA; + blasint incx = *INCX; + FLOAT beta = *BETA; + blasint incy = *INCY; + + blasint info; + int uplo; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + uplo = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incy == 0) info = 9; + if (incx == 0) info = 6; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, + enum CBLAS_UPLO Uplo, + blasint n, + FLOAT alpha, + FLOAT *a, + FLOAT *x, blasint incx, + FLOAT beta, + FLOAT *y, blasint incy){ + + FLOAT *buffer; + int uplo; + blasint info; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_CNAME; + + uplo = -1; + info = 0; + + if (order == CblasColMajor) { + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + info = -1; + + if (incy == 0) info = 9; + if (incx == 0) info = 6; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + info = -1; + + if (incy == 0) info = 9; + if (incx == 0) info = 6; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + if (beta != ONE) SCAL_K(n, 0, 0, beta, y, abs(incy), NULL, 0, NULL, 0); + + if (alpha == ZERO) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx; + if (incy < 0 ) y -= (n - 1) * incy; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (spmv[uplo])(n, alpha, a, x, incx, y, incy, buffer); + +#ifdef SMPTEST + } else { + + (spmv_thread[uplo])(n, alpha, a, x, incx, y, incy, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(1, n * n / 2 + n, n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/spr.c b/interface/spr.c new file mode 100644 index 000000000..874970904 --- /dev/null +++ b/interface/spr.c @@ -0,0 +1,197 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QSPR " +#elif defined(DOUBLE) +#define ERROR_NAME "DSPR " +#else +#define ERROR_NAME "SSPR " +#endif + +static int (*spr[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, FLOAT *) = { +#ifdef XDOUBLE + qspr_U, qspr_L, +#elif defined(DOUBLE) + dspr_U, dspr_L, +#else + sspr_U, sspr_L, +#endif +}; + +#ifdef SMPTEST +static int (*spr_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = { +#ifdef XDOUBLE + qspr_thread_U, qspr_thread_L, +#elif defined(DOUBLE) + dspr_thread_U, dspr_thread_L, +#else + sspr_thread_U, sspr_thread_L, +#endif +}; +#endif + +#ifndef CBLAS + +void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, + FLOAT *x, blasint *INCX, FLOAT *a){ + + char uplo_arg = *UPLO; + blasint n = *N; + FLOAT alpha = *ALPHA; + blasint incx = *INCX; + + blasint info; + int uplo; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + uplo = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, + enum CBLAS_UPLO Uplo, + blasint n, + FLOAT alpha, + FLOAT *x, blasint incx, + FLOAT *a) { + + FLOAT *buffer; + int uplo; + blasint info; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_CNAME; + + uplo = -1; + info = 0; + + if (order == CblasColMajor) { + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + info = -1; + + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + info = -1; + + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + if (alpha == ZERO) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (spr[uplo])(n, alpha, x, incx, a, buffer); + +#ifdef SMPTEST + } else { + + (spr_thread[uplo])(n, alpha, x, incx, a, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(1, n * n / 2 + n, n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/spr2.c b/interface/spr2.c new file mode 100644 index 000000000..6ff2110d3 --- /dev/null +++ b/interface/spr2.c @@ -0,0 +1,203 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QSPR2 " +#elif defined(DOUBLE) +#define ERROR_NAME "DSPR2 " +#else +#define ERROR_NAME "SSPR2 " +#endif + +static int (*spr2[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, FLOAT *) = { +#ifdef XDOUBLE + qspr2_U, qspr2_L, +#elif defined(DOUBLE) + dspr2_U, dspr2_L, +#else + sspr2_U, sspr2_L, +#endif +}; + +#ifdef SMPTEST +static int (*spr2_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = { +#ifdef XDOUBLE + qspr2_thread_U, qspr2_thread_L, +#elif defined(DOUBLE) + dspr2_thread_U, dspr2_thread_L, +#else + sspr2_thread_U, sspr2_thread_L, +#endif +}; +#endif + +#ifndef CBLAS + +void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, + FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *a){ + + char uplo_arg = *UPLO; + blasint n = *N; + FLOAT alpha = *ALPHA; + blasint incx = *INCX; + blasint incy = *INCY; + + blasint info; + int uplo; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + uplo = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incy == 0) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, + enum CBLAS_UPLO Uplo, + blasint n, + FLOAT alpha, + FLOAT *x, blasint incx, + FLOAT *y, blasint incy, + FLOAT *a) { + + FLOAT *buffer; + int uplo; + blasint info; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_CNAME; + + uplo = -1; + info = 0; + + if (order == CblasColMajor) { + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + info = -1; + + if (incy == 0) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + info = -1; + + if (incy == 0) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + if (alpha == ZERO) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx; + if (incy < 0 ) y -= (n - 1) * incy; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (spr2[uplo])(n, alpha, x, incx, y, incy, a, buffer); + +#ifdef SMPTEST + } else { + + (spr2_thread[uplo])(n, alpha, x, incx, y, incy, a, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(1, n * n / 2 + 2 * n, 2 * n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/swap.c b/interface/swap.c new file mode 100644 index 000000000..271fa083a --- /dev/null +++ b/interface/swap.c @@ -0,0 +1,115 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifndef CBLAS + +void NAME(blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){ + + blasint n = *N; + blasint incx = *INCX; + blasint incy = *INCY; + +#else + +void CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy){ + +#endif + +#ifdef SMP + int mode, nthreads; + FLOAT dummyalpha[2] = {ZERO, ZERO}; +#endif + +#ifndef CBLAS + PRINT_DEBUG_NAME; +#else + PRINT_DEBUG_CNAME; +#endif + + if (n <= 0) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0) x -= (n - 1) * incx; + if (incy < 0) y -= (n - 1) * incy; + +#ifdef SMP + nthreads = num_cpu_avail(1); + + //disable multi-thread when incx==0 or incy==0 + //In that case, the threads would be dependent. + if (incx == 0 || incy == 0) + nthreads = 1; + + if (nthreads == 1) { +#endif + + SWAP_K(n, 0, 0, ZERO, x, incx, y, incy, NULL, 0); + +#ifdef SMP + } else { + +#ifdef XDOUBLE + mode = BLAS_XDOUBLE | BLAS_REAL; +#elif defined(DOUBLE) + mode = BLAS_DOUBLE | BLAS_REAL; +#else + mode = BLAS_SINGLE | BLAS_REAL; +#endif + + blas_level1_thread(mode, n, 0, 0, dummyalpha, + x, incx, y, incy, NULL, 0, (void *)SWAP_K, nthreads); + } + +#endif + + FUNCTION_PROFILE_END(1, 2 * n, 0); + + IDEBUG_END; + + return; + +} diff --git a/interface/symm.c b/interface/symm.c new file mode 100644 index 000000000..e9765d557 --- /dev/null +++ b/interface/symm.c @@ -0,0 +1,442 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifndef COMPLEX +#ifdef XDOUBLE +#define ERROR_NAME "QSYMM " +#elif defined(DOUBLE) +#define ERROR_NAME "DSYMM " +#else +#define ERROR_NAME "SSYMM " +#endif +#else +#ifndef GEMM3M +#ifndef HEMM +#ifdef XDOUBLE +#define ERROR_NAME "XSYMM " +#elif defined(DOUBLE) +#define ERROR_NAME "ZSYMM " +#else +#define ERROR_NAME "CSYMM " +#endif +#else +#ifdef XDOUBLE +#define ERROR_NAME "XHEMM " +#elif defined(DOUBLE) +#define ERROR_NAME "ZHEMM " +#else +#define ERROR_NAME "CHEMM " +#endif +#endif +#else +#ifndef HEMM +#ifdef XDOUBLE +#define ERROR_NAME "XSYMM3M " +#elif defined(DOUBLE) +#define ERROR_NAME "ZSYMM3M " +#else +#define ERROR_NAME "CSYMM3M " +#endif +#else +#ifdef XDOUBLE +#define ERROR_NAME "XHEMM3M " +#elif defined(DOUBLE) +#define ERROR_NAME "ZHEMM3M " +#else +#define ERROR_NAME "CHEMM3M " +#endif +#endif +#endif +#endif + +static int (*symm[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { +#ifndef GEMM3M +#ifndef HEMM + SYMM_LU, SYMM_LL, SYMM_RU, SYMM_RL, +#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3) + SYMM_THREAD_LU, SYMM_THREAD_LL, SYMM_THREAD_RU, SYMM_THREAD_RL, +#endif +#else + HEMM_LU, HEMM_LL, HEMM_RU, HEMM_RL, +#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3) + HEMM_THREAD_LU, HEMM_THREAD_LL, HEMM_THREAD_RU, HEMM_THREAD_RL, +#endif +#endif +#else +#ifndef HEMM + SYMM3M_LU, SYMM3M_LL, SYMM3M_RU, SYMM3M_RL, +#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3) + SYMM3M_THREAD_LU, SYMM3M_THREAD_LL, SYMM3M_THREAD_RU, SYMM3M_THREAD_RL, +#endif +#else + HEMM3M_LU, HEMM3M_LL, HEMM3M_RU, HEMM3M_RL, +#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3) + HEMM3M_THREAD_LU, HEMM3M_THREAD_LL, HEMM3M_THREAD_RU, HEMM3M_THREAD_RL, +#endif +#endif +#endif +}; + +#ifndef CBLAS + +void NAME(char *SIDE, char *UPLO, + blasint *M, blasint *N, + FLOAT *alpha, FLOAT *a, blasint *ldA, + FLOAT *b, blasint *ldB, + FLOAT *beta, FLOAT *c, blasint *ldC){ + + char side_arg = *SIDE; + char uplo_arg = *UPLO; + + blas_arg_t args; + + FLOAT *buffer; + FLOAT *sa, *sb; + +#ifdef SMPTEST +#ifndef COMPLEX +#ifdef XDOUBLE + int mode = BLAS_XDOUBLE | BLAS_REAL; +#elif defined(DOUBLE) + int mode = BLAS_DOUBLE | BLAS_REAL; +#else + int mode = BLAS_SINGLE | BLAS_REAL; +#endif +#else +#ifdef XDOUBLE + int mode = BLAS_XDOUBLE | BLAS_COMPLEX; +#elif defined(DOUBLE) + int mode = BLAS_DOUBLE | BLAS_COMPLEX; +#else + int mode = BLAS_SINGLE | BLAS_COMPLEX; +#endif +#endif +#endif + +#if defined(SMPTEST) && !defined(NO_AFFINITY) + int nodes; +#endif + + blasint info; + int side; + int uplo; + + PRINT_DEBUG_NAME; + + args.alpha = (void *)alpha; + args.beta = (void *)beta; + + TOUPPER(side_arg); + TOUPPER(uplo_arg); + + side = -1; + uplo = -1; + + if (side_arg == 'L') side = 0; + if (side_arg == 'R') side = 1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + args.m = *M; + args.n = *N; + + args.c = (void *)c; + args.ldc = *ldC; + + info = 0; + + if (args.ldc < MAX(1, args.m)) info = 12; + + if (!side) { + args.a = (void *)a; + args.b = (void *)b; + + args.lda = *ldA; + args.ldb = *ldB; + + if (args.ldb < MAX(1, args.m)) info = 9; + if (args.lda < MAX(1, args.m)) info = 7; + + } else { + args.a = (void *)b; + args.b = (void *)a; + + args.lda = *ldB; + args.ldb = *ldA; + + if (args.lda < MAX(1, args.m)) info = 9; + if (args.ldb < MAX(1, args.n)) info = 7; + } + + if (args.n < 0) info = 4; + if (args.m < 0) info = 3; + if (uplo < 0) info = 2; + if (side < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_SIDE Side, enum CBLAS_UPLO Uplo, + blasint m, blasint n, +#ifndef COMPLEX + FLOAT alpha, +#else + FLOAT *alpha, +#endif + FLOAT *a, blasint lda, + FLOAT *b, blasint ldb, +#ifndef COMPLEX + FLOAT beta, +#else + FLOAT *beta, +#endif + FLOAT *c, blasint ldc) { + + blas_arg_t args; + int side, uplo; + blasint info; + + FLOAT *buffer; + FLOAT *sa, *sb; + +#ifdef SMPTEST +#ifndef COMPLEX +#ifdef XDOUBLE + int mode = BLAS_XDOUBLE | BLAS_REAL; +#elif defined(DOUBLE) + int mode = BLAS_DOUBLE | BLAS_REAL; +#else + int mode = BLAS_SINGLE | BLAS_REAL; +#endif +#else +#ifdef XDOUBLE + int mode = BLAS_XDOUBLE | BLAS_COMPLEX; +#elif defined(DOUBLE) + int mode = BLAS_DOUBLE | BLAS_COMPLEX; +#else + int mode = BLAS_SINGLE | BLAS_COMPLEX; +#endif +#endif +#endif + +#if defined(SMPTEST) && !defined(NO_AFFINITY) + int nodes; +#endif + + PRINT_DEBUG_CNAME; + +#ifndef COMPLEX + args.alpha = (void *)α + args.beta = (void *)β +#else + args.alpha = (void *)alpha; + args.beta = (void *)beta; +#endif + + args.c = (void *)c; + args.ldc = ldc; + + side = -1; + uplo = -1; + info = 0; + + if (order == CblasColMajor) { + if (Side == CblasLeft) side = 0; + if (Side == CblasRight) side = 1; + + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + info = -1; + + args.m = m; + args.n = n; + + if (args.ldc < MAX(1, args.m)) info = 12; + + if (!side) { + args.a = (void *)a; + args.b = (void *)b; + + args.lda = lda; + args.ldb = ldb; + + if (args.ldb < MAX(1, args.m)) info = 9; + if (args.lda < MAX(1, args.m)) info = 7; + + } else { + args.a = (void *)b; + args.b = (void *)a; + + args.lda = ldb; + args.ldb = lda; + + if (args.lda < MAX(1, args.m)) info = 9; + if (args.ldb < MAX(1, args.n)) info = 7; + } + + if (args.n < 0) info = 4; + if (args.m < 0) info = 3; + if (uplo < 0) info = 2; + if (side < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (Side == CblasLeft) side = 1; + if (Side == CblasRight) side = 0; + + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + info = -1; + + args.m = n; + args.n = m; + + if (args.ldc < MAX(1, args.m)) info = 12; + + if (!side) { + args.a = (void *)a; + args.b = (void *)b; + + args.lda = lda; + args.ldb = ldb; + + if (args.ldb < MAX(1, args.m)) info = 9; + if (args.lda < MAX(1, args.m)) info = 7; + + } else { + args.a = (void *)b; + args.b = (void *)a; + + args.lda = ldb; + args.ldb = lda; + + if (args.lda < MAX(1, args.m)) info = 9; + if (args.ldb < MAX(1, args.n)) info = 7; + } + + if (args.n < 0) info = 4; + if (args.m < 0) info = 3; + if (uplo < 0) info = 2; + if (side < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (args.m == 0 || args.n == 0) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + buffer = (FLOAT *)blas_memory_alloc(0); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); + +#ifdef SMPTEST + args.common = NULL; + args.nthreads = num_cpu_avail(3); + + if (args.nthreads == 1) { +#endif + + (symm[(side << 1) | uplo ])(&args, NULL, NULL, sa, sb, 0); + +#ifdef SMPTEST + + } else { + +#ifndef NO_AFFINITY + nodes = get_num_nodes(); + + if (nodes > 1) { + + args.nthreads /= nodes; + + gemm_thread_mn(mode, &args, NULL, NULL, + symm[4 | (side << 1) | uplo ], sa, sb, nodes); + + } else { +#endif + +#ifndef USE_SIMPLE_THREADED_LEVEL3 + + (symm[4 | (side << 1) | uplo ])(&args, NULL, NULL, sa, sb, 0); + +#else + + GEMM_THREAD(mode, &args, NULL, NULL, symm[(side << 1) | uplo ], sa, sb, args.nthreads); + +#endif + +#ifndef NO_AFFINITY + } +#endif + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, + (!side)? args.m * (args.m / 2 + args.n) : args.n * (args.m + args.n / 2), + (!side)? 2 * args.m * args.m * args.n : 2 * args.m * args.n * args.n); + + IDEBUG_END; + + return; +} diff --git a/interface/symv.c b/interface/symv.c new file mode 100644 index 000000000..f5cff20bc --- /dev/null +++ b/interface/symv.c @@ -0,0 +1,205 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QSYMV " +#elif defined(DOUBLE) +#define ERROR_NAME "DSYMV " +#else +#define ERROR_NAME "SSYMV " +#endif + +#ifndef CBLAS + +void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, blasint *LDA, + FLOAT *x, blasint *INCX, FLOAT *BETA, FLOAT *y, blasint *INCY){ + + char uplo_arg = *UPLO; + blasint n = *N; + FLOAT alpha = *ALPHA; + blasint lda = *LDA; + blasint incx = *INCX; + FLOAT beta = *BETA; + blasint incy = *INCY; + + int (*symv[])(BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { + SYMV_U, SYMV_L, + }; + +#ifdef SMPTEST + int (*symv_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { + SYMV_THREAD_U, SYMV_THREAD_L, + }; +#endif + + blasint info; + int uplo; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + uplo = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incy == 0) info = 10; + if (incx == 0) info = 7; + if (lda < MAX(1, n)) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, + FLOAT *a, blasint lda, FLOAT *x, blasint incx, FLOAT beta, FLOAT *y, blasint incy) { + + FLOAT *buffer; + int uplo; + blasint info; +#ifdef SMPTEST + int nthreads; +#endif + + int (*symv[])(BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { + SYMV_U, SYMV_L, + }; + +#ifdef SMPTEST + int (*symv_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { + SYMV_THREAD_U, SYMV_THREAD_L, + }; +#endif + + PRINT_DEBUG_CNAME; + + uplo = -1; + info = 0; + + if (order == CblasColMajor) { + + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + info = -1; + + if (incy == 0) info = 10; + if (incx == 0) info = 7; + if (lda < MAX(1, n)) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + info = -1; + + if (incy == 0) info = 10; + if (incx == 0) info = 7; + if (lda < MAX(1, n)) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + if (beta != ONE) SCAL_K(n, 0, 0, beta, y, abs(incy), NULL, 0, NULL, 0); + + if (alpha == ZERO) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx; + if (incy < 0 ) y -= (n - 1) * incy; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (symv[uplo])(n, n, alpha, a, lda, x, incx, y, incy, buffer); + +#ifdef SMPTEST + } else { + + (symv_thread[uplo])(n, alpha, a, lda, x, incx, y, incy, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(1, n * n / 2 + 2 * n, 2 * n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/syr.c b/interface/syr.c new file mode 100644 index 000000000..db2a9d400 --- /dev/null +++ b/interface/syr.c @@ -0,0 +1,200 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QSYR " +#elif defined(DOUBLE) +#define ERROR_NAME "DSYR " +#else +#define ERROR_NAME "SSYR " +#endif + +static int (*syr[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { +#ifdef XDOUBLE + qsyr_U, qsyr_L, +#elif defined(DOUBLE) + dsyr_U, dsyr_L, +#else + ssyr_U, ssyr_L, +#endif +}; + +#ifdef SMPTEST +static int (*syr_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { +#ifdef XDOUBLE + qsyr_thread_U, qsyr_thread_L, +#elif defined(DOUBLE) + dsyr_thread_U, dsyr_thread_L, +#else + ssyr_thread_U, ssyr_thread_L, +#endif +}; +#endif + +#ifndef CBLAS + +void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, + FLOAT *x, blasint *INCX, FLOAT *a, blasint *LDA){ + + char uplo_arg = *UPLO; + blasint n = *N; + FLOAT alpha = *ALPHA; + blasint lda = *LDA; + blasint incx = *INCX; + + blasint info; + int uplo; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + uplo = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (lda < MAX(1, n)) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, FLOAT *x, blasint incx, FLOAT *a, blasint lda) { + + FLOAT *buffer; + int trans, uplo; + blasint info; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_CNAME; + + trans = -1; + uplo = -1; + info = 0; + + if (order == CblasColMajor) { + + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + info = -1; + + if (lda < MAX(1, n)) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + } + + if (order == CblasRowMajor) { + + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + info = -1; + + if (lda < MAX(1, n)) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + if (alpha == ZERO) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (syr[uplo])(n, alpha, x, incx, a, lda, buffer); + +#ifdef SMPTEST + } else { + + (syr_thread[uplo])(n, alpha, x, incx, a, lda, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(1, n * n / 2 + n, n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/syr2.c b/interface/syr2.c new file mode 100644 index 000000000..efe63fe6a --- /dev/null +++ b/interface/syr2.c @@ -0,0 +1,204 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QSYR2 " +#elif defined(DOUBLE) +#define ERROR_NAME "DSYR2 " +#else +#define ERROR_NAME "SSYR2 " +#endif + +static int (*syr2[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { +#ifdef XDOUBLE + qsyr2_U, qsyr2_L, +#elif defined(DOUBLE) + dsyr2_U, dsyr2_L, +#else + ssyr2_U, ssyr2_L, +#endif +}; + +#ifdef SMPTEST +static int (*syr2_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { +#ifdef XDOUBLE + qsyr2_thread_U, qsyr2_thread_L, +#elif defined(DOUBLE) + dsyr2_thread_U, dsyr2_thread_L, +#else + ssyr2_thread_U, ssyr2_thread_L, +#endif +}; +#endif + +#ifndef CBLAS + +void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, + FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *a, blasint *LDA){ + + char uplo_arg = *UPLO; + blasint n = *N; + FLOAT alpha = *ALPHA; + blasint lda = *LDA; + blasint incx = *INCX; + blasint incy = *INCY; + + blasint info; + int uplo; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + uplo = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (lda < MAX(1, n)) info = 9; + if (incy == 0) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, FLOAT *x, blasint incx, FLOAT *y, blasint incy, FLOAT *a, blasint lda) { + + FLOAT *buffer; + int trans, uplo; + blasint info; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_CNAME; + + trans = -1; + uplo = -1; + info = 0; + + if (order == CblasColMajor) { + + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + info = -1; + + if (lda < MAX(1, n)) info = 9; + if (incy == 0) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + info = -1; + + if (lda < MAX(1, n)) info = 9; + if (incy == 0) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + if (alpha == ZERO) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx; + if (incy < 0 ) y -= (n - 1) * incy; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (syr2[uplo])(n, alpha, x, incx, y, incy, a, lda, buffer); + +#ifdef SMPTEST + } else { + + (syr2_thread[uplo])(n, alpha, x, incx, y, incy, a, lda, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(1, n * n / 2 + 2 * n, 2 * n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/syr2k.c b/interface/syr2k.c new file mode 100644 index 000000000..470b83958 --- /dev/null +++ b/interface/syr2k.c @@ -0,0 +1,377 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifndef COMPLEX +#ifdef XDOUBLE +#define ERROR_NAME "QSYR2K" +#elif defined(DOUBLE) +#define ERROR_NAME "DSYR2K" +#else +#define ERROR_NAME "SSYR2K" +#endif +#else +#ifndef HEMM +#ifdef XDOUBLE +#define ERROR_NAME "XSYR2K" +#elif defined(DOUBLE) +#define ERROR_NAME "ZSYR2K" +#else +#define ERROR_NAME "CSYR2K" +#endif +#else +#ifdef XDOUBLE +#define ERROR_NAME "XHER2K" +#elif defined(DOUBLE) +#define ERROR_NAME "ZHER2K" +#else +#define ERROR_NAME "CHER2K" +#endif +#endif +#endif + +static int (*syr2k[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { +#ifndef HEMM + SYR2K_UN, SYR2K_UC, SYR2K_LN, SYR2K_LC, +#else + HER2K_UN, HER2K_UC, HER2K_LN, HER2K_LC, +#endif +}; + +#ifndef CBLAS + +void NAME(char *UPLO, char *TRANS, + blasint *N, blasint *K, + FLOAT *alpha, FLOAT *a, blasint *ldA, + FLOAT *b, blasint *ldB, + FLOAT *beta, FLOAT *c, blasint *ldC){ + + char uplo_arg = *UPLO; + char trans_arg = *TRANS; + + blas_arg_t args; + + FLOAT *buffer; + FLOAT *sa, *sb; + +#ifdef SMPTEST +#ifndef COMPLEX +#ifdef XDOUBLE + int mode = BLAS_XDOUBLE | BLAS_REAL; +#elif defined(DOUBLE) + int mode = BLAS_DOUBLE | BLAS_REAL; +#else + int mode = BLAS_SINGLE | BLAS_REAL; +#endif +#else +#ifdef XDOUBLE + int mode = BLAS_XDOUBLE | BLAS_COMPLEX; +#elif defined(DOUBLE) + int mode = BLAS_DOUBLE | BLAS_COMPLEX; +#else + int mode = BLAS_SINGLE | BLAS_COMPLEX; +#endif +#endif +#endif + + blasint info; + int uplo; + int trans; + int nrowa; + + PRINT_DEBUG_NAME; + + args.n = *N; + args.k = *K; + + args.a = (void *)a; + args.b = (void *)b; + args.c = (void *)c; + + args.lda = *ldA; + args.ldb = *ldB; + args.ldc = *ldC; + + args.alpha = (void *)alpha; + args.beta = (void *)beta; + + TOUPPER(uplo_arg); + TOUPPER(trans_arg); + + uplo = -1; + trans = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + +#ifndef COMPLEX + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'T') trans = 1; + if (trans_arg == 'C') trans = 1; +#else +#ifdef HEMM + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'C') trans = 1; +#else + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'T') trans = 1; +#endif + +#endif + + + nrowa = args.n; + if (trans & 1) nrowa = args.k; + + info = 0; + + if (args.ldc < MAX(1,args.n)) info = 12; + if (args.ldb < MAX(1,nrowa)) info = 9; + if (args.lda < MAX(1,nrowa)) info = 7; + if (args.k < 0) info = 4; + if (args.n < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, enum CBLAS_TRANSPOSE Trans, + blasint n, blasint k, +#ifndef COMPLEX + FLOAT alpha, +#else + FLOAT *alpha, +#endif + FLOAT *a, blasint lda, + FLOAT *b, blasint ldb, +#if !defined(COMPLEX) || defined(HEMM) + FLOAT beta, +#else + FLOAT *beta, +#endif + FLOAT *c, blasint ldc) { + + blas_arg_t args; + int uplo, trans; + blasint info, nrowa; + + FLOAT *buffer; + FLOAT *sa, *sb; + +#ifdef HEMM + FLOAT CAlpha[2]; +#endif + +#ifdef SMPTEST +#ifndef COMPLEX +#ifdef XDOUBLE + int mode = BLAS_XDOUBLE | BLAS_REAL; +#elif defined(DOUBLE) + int mode = BLAS_DOUBLE | BLAS_REAL; +#else + int mode = BLAS_SINGLE | BLAS_REAL; +#endif +#else +#ifdef XDOUBLE + int mode = BLAS_XDOUBLE | BLAS_COMPLEX; +#elif defined(DOUBLE) + int mode = BLAS_DOUBLE | BLAS_COMPLEX; +#else + int mode = BLAS_SINGLE | BLAS_COMPLEX; +#endif +#endif +#endif + + PRINT_DEBUG_CNAME; + + args.n = n; + args.k = k; + + args.a = (void *)a; + args.b = (void *)b; + args.c = (void *)c; + + args.lda = lda; + args.ldb = ldb; + args.ldc = ldc; + +#ifndef COMPLEX + args.alpha = (void *)α +#else + args.alpha = (void *)alpha; +#endif + +#if !defined(COMPLEX) || defined(HEMM) + args.beta = (void *)β +#else + args.beta = (void *)beta; +#endif + + trans = -1; + uplo = -1; + info = 0; + + if (order == CblasColMajor) { + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + if (Trans == CblasNoTrans) trans = 0; +#ifndef COMPLEX + if (Trans == CblasTrans) trans = 1; + if (Trans == CblasConjNoTrans) trans = 0; + if (Trans == CblasConjTrans) trans = 1; +#elif !defined(HEMM) + if (Trans == CblasTrans) trans = 1; +#else + if (Trans == CblasConjTrans) trans = 1; +#endif + + info = -1; + + nrowa = args.n; + if (trans & 1) nrowa = args.k; + + if (args.ldc < MAX(1,args.n)) info = 12; + if (args.ldb < MAX(1,nrowa)) info = 9; + if (args.lda < MAX(1,nrowa)) info = 7; + if (args.k < 0) info = 4; + if (args.n < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + +#ifdef HEMM + CAlpha[0] = alpha[0]; + CAlpha[1] = -alpha[1]; + + args.alpha = (void *)CAlpha; +#endif + + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + if (Trans == CblasNoTrans) trans = 1; +#ifndef COMPLEX + if (Trans == CblasTrans) trans = 0; + if (Trans == CblasConjNoTrans) trans = 1; + if (Trans == CblasConjTrans) trans = 0; +#elif !defined(HEMM) + if (Trans == CblasTrans) trans = 0; +#else + if (Trans == CblasConjTrans) trans = 0; +#endif + + info = -1; + + nrowa = args.n; + if (trans & 1) nrowa = args.k; + + if (args.ldc < MAX(1,args.n)) info = 12; + if (args.ldb < MAX(1,nrowa)) info = 9; + if (args.lda < MAX(1,nrowa)) info = 7; + if (args.k < 0) info = 4; + if (args.n < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (args.n == 0) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + buffer = (FLOAT *)blas_memory_alloc(0); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); + +#ifdef SMPTEST + if (!trans){ + mode |= (BLAS_TRANSA_N | BLAS_TRANSB_T); + } else { + mode |= (BLAS_TRANSA_T | BLAS_TRANSB_N); + } + + mode |= (uplo << BLAS_UPLO_SHIFT); + + args.common = NULL; + args.nthreads = num_cpu_avail(3); + + if (args.nthreads == 1) { +#endif + + (syr2k[(uplo << 1) | trans ])(&args, NULL, NULL, sa, sb, 0); + +#ifdef SMPTEST + + } else { + + syrk_thread(mode, &args, NULL, NULL, syr2k[(uplo << 1) | trans ], sa, sb, args.nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, 2 * args.n * args.k + args.n * args.n, 2 * args.n * args.n * args.k); + + IDEBUG_END; + + return; +} diff --git a/interface/syrk.c b/interface/syrk.c new file mode 100644 index 000000000..1c00b5aa5 --- /dev/null +++ b/interface/syrk.c @@ -0,0 +1,366 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifndef COMPLEX +#ifdef XDOUBLE +#define ERROR_NAME "QSYRK " +#elif defined(DOUBLE) +#define ERROR_NAME "DSYRK " +#else +#define ERROR_NAME "SSYRK " +#endif +#else +#ifndef HEMM +#ifdef XDOUBLE +#define ERROR_NAME "XSYRK " +#elif defined(DOUBLE) +#define ERROR_NAME "ZSYRK " +#else +#define ERROR_NAME "CSYRK " +#endif +#else +#ifdef XDOUBLE +#define ERROR_NAME "XHERK " +#elif defined(DOUBLE) +#define ERROR_NAME "ZHERK " +#else +#define ERROR_NAME "CHERK " +#endif +#endif +#endif + +static int (*syrk[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { +#ifndef HEMM + SYRK_UN, SYRK_UC, SYRK_LN, SYRK_LC, +#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3) + SYRK_THREAD_UN, SYRK_THREAD_UC, SYRK_THREAD_LN, SYRK_THREAD_LC, +#endif +#else + HERK_UN, HERK_UC, HERK_LN, HERK_LC, +#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3) + HERK_THREAD_UN, HERK_THREAD_UC, HERK_THREAD_LN, HERK_THREAD_LC, +#endif +#endif +}; + +#ifndef CBLAS + +void NAME(char *UPLO, char *TRANS, + blasint *N, blasint *K, + FLOAT *alpha, FLOAT *a, blasint *ldA, + FLOAT *beta, FLOAT *c, blasint *ldC){ + + char uplo_arg = *UPLO; + char trans_arg = *TRANS; + + blas_arg_t args; + + FLOAT *buffer; + FLOAT *sa, *sb; + +#ifdef SMPTEST +#ifndef COMPLEX +#ifdef XDOUBLE + int mode = BLAS_XDOUBLE | BLAS_REAL; +#elif defined(DOUBLE) + int mode = BLAS_DOUBLE | BLAS_REAL; +#else + int mode = BLAS_SINGLE | BLAS_REAL; +#endif +#else +#ifdef XDOUBLE + int mode = BLAS_XDOUBLE | BLAS_COMPLEX; +#elif defined(DOUBLE) + int mode = BLAS_DOUBLE | BLAS_COMPLEX; +#else + int mode = BLAS_SINGLE | BLAS_COMPLEX; +#endif +#endif +#endif + + blasint info; + int uplo; + int trans; + int nrowa; + + PRINT_DEBUG_NAME; + + args.n = *N; + args.k = *K; + + args.a = (void *)a; + args.c = (void *)c; + + args.lda = *ldA; + args.ldc = *ldC; + + args.alpha = (void *)alpha; + args.beta = (void *)beta; + + TOUPPER(uplo_arg); + TOUPPER(trans_arg); + + uplo = -1; + trans = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + +#ifndef COMPLEX + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'T') trans = 1; + if (trans_arg == 'C') trans = 1; +#else +#ifdef HEMM + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'C') trans = 1; +#else + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'T') trans = 1; +#endif + +#endif + + nrowa = args.n; + if (trans & 1) nrowa = args.k; + + info = 0; + + if (args.ldc < MAX(1,args.n)) info = 10; + if (args.lda < MAX(1,nrowa)) info = 7; + if (args.k < 0) info = 4; + if (args.n < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, enum CBLAS_TRANSPOSE Trans, + blasint n, blasint k, +#if !defined(COMPLEX) || defined(HEMM) + FLOAT alpha, +#else + FLOAT *alpha, +#endif + FLOAT *a, blasint lda, +#if !defined(COMPLEX) || defined(HEMM) + FLOAT beta, +#else + FLOAT *beta, +#endif + FLOAT *c, blasint ldc) { + + blas_arg_t args; + int uplo, trans; + blasint info, nrowa; + + FLOAT *buffer; + FLOAT *sa, *sb; + +#ifdef SMPTEST +#ifndef COMPLEX +#ifdef XDOUBLE + int mode = BLAS_XDOUBLE | BLAS_REAL; +#elif defined(DOUBLE) + int mode = BLAS_DOUBLE | BLAS_REAL; +#else + int mode = BLAS_SINGLE | BLAS_REAL; +#endif +#else +#ifdef XDOUBLE + int mode = BLAS_XDOUBLE | BLAS_COMPLEX; +#elif defined(DOUBLE) + int mode = BLAS_DOUBLE | BLAS_COMPLEX; +#else + int mode = BLAS_SINGLE | BLAS_COMPLEX; +#endif +#endif +#endif + + PRINT_DEBUG_CNAME; + + args.n = n; + args.k = k; + + args.a = (void *)a; + args.c = (void *)c; + + args.lda = lda; + args.ldc = ldc; + +#if !defined(COMPLEX) || defined(HEMM) + args.alpha = (void *)α + args.beta = (void *)β +#else + args.alpha = (void *)alpha; + args.beta = (void *)beta; +#endif + + trans = -1; + uplo = -1; + info = 0; + + if (order == CblasColMajor) { + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + if (Trans == CblasNoTrans) trans = 0; +#ifndef COMPLEX + if (Trans == CblasTrans) trans = 1; + if (Trans == CblasConjNoTrans) trans = 0; + if (Trans == CblasConjTrans) trans = 1; +#elif !defined(HEMM) + if (Trans == CblasTrans) trans = 1; +#else + if (Trans == CblasConjTrans) trans = 1; +#endif + + info = -1; + + nrowa = args.n; + if (trans & 1) nrowa = args.k; + + if (args.ldc < MAX(1,args.n)) info = 10; + if (args.lda < MAX(1,nrowa)) info = 7; + if (args.k < 0) info = 4; + if (args.n < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + if (Trans == CblasNoTrans) trans = 1; +#ifndef COMPLEX + if (Trans == CblasTrans) trans = 0; + if (Trans == CblasConjNoTrans) trans = 1; + if (Trans == CblasConjTrans) trans = 0; +#elif !defined(HEMM) + if (Trans == CblasTrans) trans = 0; +#else + if (Trans == CblasConjTrans) trans = 0; +#endif + + info = -1; + + nrowa = args.n; + if (trans & 1) nrowa = args.k; + + if (args.ldc < MAX(1,args.n)) info = 10; + if (args.lda < MAX(1,nrowa)) info = 7; + if (args.k < 0) info = 4; + if (args.n < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (args.n == 0) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + buffer = (FLOAT *)blas_memory_alloc(0); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); + +#ifdef SMPTEST + if (!trans){ + mode |= (BLAS_TRANSA_N | BLAS_TRANSB_T); + } else { + mode |= (BLAS_TRANSA_T | BLAS_TRANSB_N); + } + + mode |= (uplo << BLAS_UPLO_SHIFT); + + args.common = NULL; + args.nthreads = num_cpu_avail(3); + + if (args.nthreads == 1) { +#endif + + (syrk[(uplo << 1) | trans ])(&args, NULL, NULL, sa, sb, 0); + +#ifdef SMPTEST + + } else { + +#ifndef USE_SIMPLE_THREADED_LEVEL3 + + (syrk[4 | (uplo << 1) | trans ])(&args, NULL, NULL, sa, sb, 0); + +#else + + syrk_thread(mode, &args, NULL, NULL, syrk[(uplo << 1) | trans ], sa, sb, args.nthreads); + +#endif + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.n * args.k + args.n * args.n / 2, args.n * args.n * args.k); + + IDEBUG_END; + + return; +} diff --git a/interface/tbmv.c b/interface/tbmv.c new file mode 100644 index 000000000..8d08c0e1f --- /dev/null +++ b/interface/tbmv.c @@ -0,0 +1,248 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QTBMV " +#elif defined(DOUBLE) +#define ERROR_NAME "DTBMV " +#else +#define ERROR_NAME "STBMV " +#endif + +static int (*tbmv[])(BLASLONG, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { +#ifdef XDOUBLE + qtbmv_NUU, qtbmv_NUN, qtbmv_NLU, qtbmv_NLN, + qtbmv_TUU, qtbmv_TUN, qtbmv_TLU, qtbmv_TLN, +#elif defined(DOUBLE) + dtbmv_NUU, dtbmv_NUN, dtbmv_NLU, dtbmv_NLN, + dtbmv_TUU, dtbmv_TUN, dtbmv_TLU, dtbmv_TLN, +#else + stbmv_NUU, stbmv_NUN, stbmv_NLU, stbmv_NLN, + stbmv_TUU, stbmv_TUN, stbmv_TLU, stbmv_TLN, +#endif +}; + +#ifdef SMPTEST +static int (*tbmv_thread[])(BLASLONG, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { +#ifdef XDOUBLE + qtbmv_thread_NUU, qtbmv_thread_NUN, qtbmv_thread_NLU, qtbmv_thread_NLN, + qtbmv_thread_TUU, qtbmv_thread_TUN, qtbmv_thread_TLU, qtbmv_thread_TLN, +#elif defined(DOUBLE) + dtbmv_thread_NUU, dtbmv_thread_NUN, dtbmv_thread_NLU, dtbmv_thread_NLN, + dtbmv_thread_TUU, dtbmv_thread_TUN, dtbmv_thread_TLU, dtbmv_thread_TLN, +#else + stbmv_thread_NUU, stbmv_thread_NUN, stbmv_thread_NLU, stbmv_thread_NLN, + stbmv_thread_TUU, stbmv_thread_TUN, stbmv_thread_TLU, stbmv_thread_TLN, +#endif +}; +#endif + +#ifndef CBLAS + +void NAME(char *UPLO, char *TRANS, char *DIAG, + blasint *N, blasint *K, + FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){ + + char uplo_arg = *UPLO; + char trans_arg = *TRANS; + char diag_arg = *DIAG; + + blasint n = *N; + blasint k = *K; + blasint lda = *LDA; + blasint incx = *INCX; + + blasint info; + int uplo; + int unit; + int trans; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + TOUPPER(trans_arg); + TOUPPER(diag_arg); + + trans = -1; + unit = -1; + uplo = -1; + + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'T') trans = 1; + if (trans_arg == 'R') trans = 0; + if (trans_arg == 'C') trans = 1; + + if (diag_arg == 'U') unit = 0; + if (diag_arg == 'N') unit = 1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incx == 0) info = 9; + if (lda < k + 1) info = 7; + if (k < 0) info = 5; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, + enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, + blasint n, blasint k, FLOAT *a, blasint lda, FLOAT *x, blasint incx) { + + int trans, uplo, unit; + blasint info; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_CNAME; + + unit = -1; + uplo = -1; + trans = -1; + info = 0; + + if (order == CblasColMajor) { + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + if (TransA == CblasNoTrans) trans = 0; + if (TransA == CblasTrans) trans = 1; + if (TransA == CblasConjNoTrans) trans = 0; + if (TransA == CblasConjTrans) trans = 1; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 9; + if (lda < k + 1) info = 7; + if (k < 0) info = 5; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + if (TransA == CblasNoTrans) trans = 1; + if (TransA == CblasTrans) trans = 0; + if (TransA == CblasConjNoTrans) trans = 1; + if (TransA == CblasConjTrans) trans = 0; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 9; + if (lda < k + 1) info = 7; + if (k < 0) info = 5; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (tbmv[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer); + +#ifdef SMPTEST + } else { + + (tbmv_thread[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(1, n * k / 2 + n, n * k); + + IDEBUG_END; + + return; +} diff --git a/interface/tbsv.c b/interface/tbsv.c new file mode 100644 index 000000000..a07c4c584 --- /dev/null +++ b/interface/tbsv.c @@ -0,0 +1,213 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QTBSV " +#elif defined(DOUBLE) +#define ERROR_NAME "DTBSV " +#else +#define ERROR_NAME "STBSV " +#endif + +static int (*tbsv[])(BLASLONG, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { +#ifdef XDOUBLE + qtbsv_NUU, qtbsv_NUN, qtbsv_NLU, qtbsv_NLN, + qtbsv_TUU, qtbsv_TUN, qtbsv_TLU, qtbsv_TLN, +#elif defined(DOUBLE) + dtbsv_NUU, dtbsv_NUN, dtbsv_NLU, dtbsv_NLN, + dtbsv_TUU, dtbsv_TUN, dtbsv_TLU, dtbsv_TLN, +#else + stbsv_NUU, stbsv_NUN, stbsv_NLU, stbsv_NLN, + stbsv_TUU, stbsv_TUN, stbsv_TLU, stbsv_TLN, +#endif +}; + +#ifndef CBLAS + +void NAME(char *UPLO, char *TRANS, char *DIAG, + blasint *N, blasint *K, + FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){ + + char uplo_arg = *UPLO; + char trans_arg = *TRANS; + char diag_arg = *DIAG; + + blasint n = *N; + blasint k = *K; + blasint lda = *LDA; + blasint incx = *INCX; + + blasint info; + int uplo; + int unit; + int trans; + FLOAT *buffer; + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + TOUPPER(trans_arg); + TOUPPER(diag_arg); + + trans = -1; + unit = -1; + uplo = -1; + + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'T') trans = 1; + if (trans_arg == 'R') trans = 0; + if (trans_arg == 'C') trans = 1; + + if (diag_arg == 'U') unit = 0; + if (diag_arg == 'N') unit = 1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incx == 0) info = 9; + if (lda < k + 1) info = 7; + if (k < 0) info = 5; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, + enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, + blasint n, blasint k, FLOAT *a, blasint lda, FLOAT *x, blasint incx) { + + int trans, uplo, unit; + blasint info; + FLOAT *buffer; + + PRINT_DEBUG_CNAME; + + unit = -1; + uplo = -1; + trans = -1; + info = 0; + + if (order == CblasColMajor) { + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + if (TransA == CblasNoTrans) trans = 0; + if (TransA == CblasTrans) trans = 1; + if (TransA == CblasConjNoTrans) trans = 0; + if (TransA == CblasConjTrans) trans = 1; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 9; + if (lda < k + 1) info = 7; + if (k < 0) info = 5; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + if (TransA == CblasNoTrans) trans = 1; + if (TransA == CblasTrans) trans = 0; + if (TransA == CblasConjNoTrans) trans = 1; + if (TransA == CblasConjTrans) trans = 0; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 9; + if (lda < k + 1) info = 7; + if (k < 0) info = 5; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx; + + buffer = (FLOAT *)blas_memory_alloc(1); + + (tbsv[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer); + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(1, n * k / 2 + n, n * k); + + IDEBUG_END; + + return; +} diff --git a/interface/tpmv.c b/interface/tpmv.c new file mode 100644 index 000000000..fde5abb4d --- /dev/null +++ b/interface/tpmv.c @@ -0,0 +1,239 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QTPMV " +#elif defined(DOUBLE) +#define ERROR_NAME "DTPMV " +#else +#define ERROR_NAME "STPMV " +#endif + +static int (*tpmv[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, void *) = { +#ifdef XDOUBLE + qtpmv_NUU, qtpmv_NUN, qtpmv_NLU, qtpmv_NLN, + qtpmv_TUU, qtpmv_TUN, qtpmv_TLU, qtpmv_TLN, +#elif defined(DOUBLE) + dtpmv_NUU, dtpmv_NUN, dtpmv_NLU, dtpmv_NLN, + dtpmv_TUU, dtpmv_TUN, dtpmv_TLU, dtpmv_TLN, +#else + stpmv_NUU, stpmv_NUN, stpmv_NLU, stpmv_NLN, + stpmv_TUU, stpmv_TUN, stpmv_TLU, stpmv_TLN, +#endif +}; + +#ifdef SMPTEST +static int (*tpmv_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, int) = { +#ifdef XDOUBLE + qtpmv_thread_NUU, qtpmv_thread_NUN, qtpmv_thread_NLU, qtpmv_thread_NLN, + qtpmv_thread_TUU, qtpmv_thread_TUN, qtpmv_thread_TLU, qtpmv_thread_TLN, +#elif defined(DOUBLE) + dtpmv_thread_NUU, dtpmv_thread_NUN, dtpmv_thread_NLU, dtpmv_thread_NLN, + dtpmv_thread_TUU, dtpmv_thread_TUN, dtpmv_thread_TLU, dtpmv_thread_TLN, +#else + stpmv_thread_NUU, stpmv_thread_NUN, stpmv_thread_NLU, stpmv_thread_NLN, + stpmv_thread_TUU, stpmv_thread_TUN, stpmv_thread_TLU, stpmv_thread_TLN, +#endif +}; +#endif + +#ifndef CBLAS + +void NAME(char *UPLO, char *TRANS, char *DIAG, + blasint *N, FLOAT *a, FLOAT *x, blasint *INCX){ + + char uplo_arg = *UPLO; + char trans_arg = *TRANS; + char diag_arg = *DIAG; + + blasint n = *N; + blasint incx = *INCX; + + blasint info; + int uplo; + int unit; + int trans; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + TOUPPER(trans_arg); + TOUPPER(diag_arg); + + trans = -1; + unit = -1; + uplo = -1; + + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'T') trans = 1; + if (trans_arg == 'R') trans = 0; + if (trans_arg == 'C') trans = 1; + + if (diag_arg == 'U') unit = 0; + if (diag_arg == 'N') unit = 1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incx == 0) info = 7; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, + enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, + blasint n, FLOAT *a, FLOAT *x, blasint incx) { + + int trans, uplo, unit; + blasint info; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_CNAME; + + unit = -1; + uplo = -1; + trans = -1; + info = 0; + + if (order == CblasColMajor) { + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + if (TransA == CblasNoTrans) trans = 0; + if (TransA == CblasTrans) trans = 1; + if (TransA == CblasConjNoTrans) trans = 0; + if (TransA == CblasConjTrans) trans = 1; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 7; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + if (TransA == CblasNoTrans) trans = 1; + if (TransA == CblasTrans) trans = 0; + if (TransA == CblasConjNoTrans) trans = 1; + if (TransA == CblasConjTrans) trans = 0; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 7; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (tpmv[(trans<<2) | (uplo<<1) | unit])(n, a, x, incx, buffer); + +#ifdef SMPTEST + } else { + + (tpmv_thread[(trans<<2) | (uplo<<1) | unit])(n, a, x, incx, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(1, n * n / 2 + n, n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/tpsv.c b/interface/tpsv.c new file mode 100644 index 000000000..9dafd0b68 --- /dev/null +++ b/interface/tpsv.c @@ -0,0 +1,204 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QTPSV " +#elif defined(DOUBLE) +#define ERROR_NAME "DTPSV " +#else +#define ERROR_NAME "STPSV " +#endif + +static int (*tpsv[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, void *) = { +#ifdef XDOUBLE + qtpsv_NUU, qtpsv_NUN, qtpsv_NLU, qtpsv_NLN, + qtpsv_TUU, qtpsv_TUN, qtpsv_TLU, qtpsv_TLN, +#elif defined(DOUBLE) + dtpsv_NUU, dtpsv_NUN, dtpsv_NLU, dtpsv_NLN, + dtpsv_TUU, dtpsv_TUN, dtpsv_TLU, dtpsv_TLN, +#else + stpsv_NUU, stpsv_NUN, stpsv_NLU, stpsv_NLN, + stpsv_TUU, stpsv_TUN, stpsv_TLU, stpsv_TLN, +#endif +}; + +#ifndef CBLAS + +void NAME(char *UPLO, char *TRANS, char *DIAG, + blasint *N, FLOAT *a, FLOAT *x, blasint *INCX){ + + char uplo_arg = *UPLO; + char trans_arg = *TRANS; + char diag_arg = *DIAG; + + blasint n = *N; + blasint incx = *INCX; + + blasint info; + int uplo; + int unit; + int trans; + FLOAT *buffer; + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + TOUPPER(trans_arg); + TOUPPER(diag_arg); + + trans = -1; + unit = -1; + uplo = -1; + + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'T') trans = 1; + if (trans_arg == 'R') trans = 0; + if (trans_arg == 'C') trans = 1; + + if (diag_arg == 'U') unit = 0; + if (diag_arg == 'N') unit = 1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incx == 0) info = 7; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, + enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, + blasint n, FLOAT *a, FLOAT *x, blasint incx) { + + int trans, uplo, unit; + blasint info; + FLOAT *buffer; + + PRINT_DEBUG_CNAME; + + unit = -1; + uplo = -1; + trans = -1; + info = 0; + + if (order == CblasColMajor) { + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + if (TransA == CblasNoTrans) trans = 0; + if (TransA == CblasTrans) trans = 1; + if (TransA == CblasConjNoTrans) trans = 0; + if (TransA == CblasConjTrans) trans = 1; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 7; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + if (TransA == CblasNoTrans) trans = 1; + if (TransA == CblasTrans) trans = 0; + if (TransA == CblasConjNoTrans) trans = 1; + if (TransA == CblasConjTrans) trans = 0; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 7; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx; + + buffer = (FLOAT *)blas_memory_alloc(1); + + (tpsv[(trans<<2) | (uplo<<1) | unit])(n, a, x, incx, buffer); + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(1, n * n / 2 + n, n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/trmv.c b/interface/trmv.c new file mode 100644 index 000000000..765a114d1 --- /dev/null +++ b/interface/trmv.c @@ -0,0 +1,243 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QTRMV " +#elif defined(DOUBLE) +#define ERROR_NAME "DTRMV " +#else +#define ERROR_NAME "STRMV " +#endif + +static int (*trmv[])(BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { +#ifdef XDOUBLE + qtrmv_NUU, qtrmv_NUN, qtrmv_NLU, qtrmv_NLN, + qtrmv_TUU, qtrmv_TUN, qtrmv_TLU, qtrmv_TLN, +#elif defined(DOUBLE) + dtrmv_NUU, dtrmv_NUN, dtrmv_NLU, dtrmv_NLN, + dtrmv_TUU, dtrmv_TUN, dtrmv_TLU, dtrmv_TLN, +#else + strmv_NUU, strmv_NUN, strmv_NLU, strmv_NLN, + strmv_TUU, strmv_TUN, strmv_TLU, strmv_TLN, +#endif +}; + +#ifdef SMPTEST +static int (*trmv_thread[])(BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { +#ifdef XDOUBLE + qtrmv_thread_NUU, qtrmv_thread_NUN, qtrmv_thread_NLU, qtrmv_thread_NLN, + qtrmv_thread_TUU, qtrmv_thread_TUN, qtrmv_thread_TLU, qtrmv_thread_TLN, +#elif defined(DOUBLE) + dtrmv_thread_NUU, dtrmv_thread_NUN, dtrmv_thread_NLU, dtrmv_thread_NLN, + dtrmv_thread_TUU, dtrmv_thread_TUN, dtrmv_thread_TLU, dtrmv_thread_TLN, +#else + strmv_thread_NUU, strmv_thread_NUN, strmv_thread_NLU, strmv_thread_NLN, + strmv_thread_TUU, strmv_thread_TUN, strmv_thread_TLU, strmv_thread_TLN, +#endif +}; +#endif + +#ifndef CBLAS + +void NAME(char *UPLO, char *TRANS, char *DIAG, + blasint *N, FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){ + + char uplo_arg = *UPLO; + char trans_arg = *TRANS; + char diag_arg = *DIAG; + + blasint n = *N; + blasint lda = *LDA; + blasint incx = *INCX; + + blasint info; + int uplo; + int unit; + int trans; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + TOUPPER(trans_arg); + TOUPPER(diag_arg); + + trans = -1; + unit = -1; + uplo = -1; + + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'T') trans = 1; + if (trans_arg == 'R') trans = 0; + if (trans_arg == 'C') trans = 1; + + if (diag_arg == 'U') unit = 0; + if (diag_arg == 'N') unit = 1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incx == 0) info = 8; + if (lda < MAX(1, n)) info = 6; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, + enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, + blasint n, FLOAT *a, blasint lda, FLOAT *x, blasint incx) { + + int trans, uplo, unit; + blasint info; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_CNAME; + + unit = -1; + uplo = -1; + trans = -1; + info = 0; + + if (order == CblasColMajor) { + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + if (TransA == CblasNoTrans) trans = 0; + if (TransA == CblasTrans) trans = 1; + if (TransA == CblasConjNoTrans) trans = 0; + if (TransA == CblasConjTrans) trans = 1; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 8; + if (lda < MAX(1, n)) info = 6; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + if (TransA == CblasNoTrans) trans = 1; + if (TransA == CblasTrans) trans = 0; + if (TransA == CblasConjNoTrans) trans = 1; + if (TransA == CblasConjTrans) trans = 0; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 8; + if (lda < MAX(1, n)) info = 6; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (trmv[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer); + +#ifdef SMPTEST + } else { + + (trmv_thread[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(1, n * n / 2 + n, n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/trsm.c b/interface/trsm.c new file mode 100644 index 000000000..2b00c4722 --- /dev/null +++ b/interface/trsm.c @@ -0,0 +1,391 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifndef TRMM +#ifndef COMPLEX +#ifdef XDOUBLE +#define ERROR_NAME "QTRSM " +#elif defined(DOUBLE) +#define ERROR_NAME "DTRSM " +#else +#define ERROR_NAME "STRSM " +#endif +#else +#ifdef XDOUBLE +#define ERROR_NAME "XTRSM " +#elif defined(DOUBLE) +#define ERROR_NAME "ZTRSM " +#else +#define ERROR_NAME "CTRSM " +#endif +#endif +#else +#ifndef COMPLEX +#ifdef XDOUBLE +#define ERROR_NAME "QTRMM " +#elif defined(DOUBLE) +#define ERROR_NAME "DTRMM " +#else +#define ERROR_NAME "STRMM " +#endif +#else +#ifdef XDOUBLE +#define ERROR_NAME "XTRMM " +#elif defined(DOUBLE) +#define ERROR_NAME "ZTRMM " +#else +#define ERROR_NAME "CTRMM " +#endif +#endif +#endif + +static int (*trsm[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { +#ifndef TRMM + TRSM_LNUU, TRSM_LNUN, TRSM_LNLU, TRSM_LNLN, + TRSM_LTUU, TRSM_LTUN, TRSM_LTLU, TRSM_LTLN, + TRSM_LRUU, TRSM_LRUN, TRSM_LRLU, TRSM_LRLN, + TRSM_LCUU, TRSM_LCUN, TRSM_LCLU, TRSM_LCLN, + TRSM_RNUU, TRSM_RNUN, TRSM_RNLU, TRSM_RNLN, + TRSM_RTUU, TRSM_RTUN, TRSM_RTLU, TRSM_RTLN, + TRSM_RRUU, TRSM_RRUN, TRSM_RRLU, TRSM_RRLN, + TRSM_RCUU, TRSM_RCUN, TRSM_RCLU, TRSM_RCLN, +#else + TRMM_LNUU, TRMM_LNUN, TRMM_LNLU, TRMM_LNLN, + TRMM_LTUU, TRMM_LTUN, TRMM_LTLU, TRMM_LTLN, + TRMM_LRUU, TRMM_LRUN, TRMM_LRLU, TRMM_LRLN, + TRMM_LCUU, TRMM_LCUN, TRMM_LCLU, TRMM_LCLN, + TRMM_RNUU, TRMM_RNUN, TRMM_RNLU, TRMM_RNLN, + TRMM_RTUU, TRMM_RTUN, TRMM_RTLU, TRMM_RTLN, + TRMM_RRUU, TRMM_RRUN, TRMM_RRLU, TRMM_RRLN, + TRMM_RCUU, TRMM_RCUN, TRMM_RCLU, TRMM_RCLN, +#endif +}; + +#ifndef CBLAS + +void NAME(char *SIDE, char *UPLO, char *TRANS, char *DIAG, + blasint *M, blasint *N, FLOAT *alpha, + FLOAT *a, blasint *ldA, FLOAT *b, blasint *ldB){ + + char side_arg = *SIDE; + char uplo_arg = *UPLO; + char trans_arg = *TRANS; + char diag_arg = *DIAG; + + blas_arg_t args; + + FLOAT *buffer; + FLOAT *sa, *sb; + +#ifdef SMPTEST +#ifndef COMPLEX +#ifdef XDOUBLE + int mode = BLAS_XDOUBLE | BLAS_REAL; +#elif defined(DOUBLE) + int mode = BLAS_DOUBLE | BLAS_REAL; +#else + int mode = BLAS_SINGLE | BLAS_REAL; +#endif +#else +#ifdef XDOUBLE + int mode = BLAS_XDOUBLE | BLAS_COMPLEX; +#elif defined(DOUBLE) + int mode = BLAS_DOUBLE | BLAS_COMPLEX; +#else + int mode = BLAS_SINGLE | BLAS_COMPLEX; +#endif +#endif +#endif + + blasint info; + int side; + int uplo; + int unit; + int trans; + int nrowa; + + PRINT_DEBUG_NAME; + + args.m = *M; + args.n = *N; + + args.a = (void *)a; + args.b = (void *)b; + + args.lda = *ldA; + args.ldb = *ldB; + + args.beta = (void *)alpha; + + TOUPPER(side_arg); + TOUPPER(uplo_arg); + TOUPPER(trans_arg); + TOUPPER(diag_arg); + + side = -1; + trans = -1; + unit = -1; + uplo = -1; + + if (side_arg == 'L') side = 0; + if (side_arg == 'R') side = 1; + + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'T') trans = 1; + if (trans_arg == 'R') trans = 2; + if (trans_arg == 'C') trans = 3; + + if (diag_arg == 'U') unit = 0; + if (diag_arg == 'N') unit = 1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + nrowa = args.m; + if (side & 1) nrowa = args.n; + + info = 0; + + if (args.ldb < MAX(1,args.m)) info = 11; + if (args.lda < MAX(1,nrowa)) info = 9; + if (args.n < 0) info = 6; + if (args.m < 0) info = 5; + if (unit < 0) info = 4; + if (trans < 0) info = 3; + if (uplo < 0) info = 2; + if (side < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, + enum CBLAS_SIDE Side, enum CBLAS_UPLO Uplo, + enum CBLAS_TRANSPOSE Trans, enum CBLAS_DIAG Diag, + blasint m, blasint n, +#ifndef COMPLEX + FLOAT alpha, +#else + FLOAT *alpha, +#endif + FLOAT *a, blasint lda, + FLOAT *b, blasint ldb) { + + blas_arg_t args; + int side, uplo, trans, unit; + blasint info, nrowa; + + XFLOAT *buffer; + XFLOAT *sa, *sb; + +#ifdef SMPTEST +#ifndef COMPLEX +#ifdef XDOUBLE + int mode = BLAS_XDOUBLE | BLAS_REAL; +#elif defined(DOUBLE) + int mode = BLAS_DOUBLE | BLAS_REAL; +#else + int mode = BLAS_SINGLE | BLAS_REAL; +#endif +#else +#ifdef XDOUBLE + int mode = BLAS_XDOUBLE | BLAS_COMPLEX; +#elif defined(DOUBLE) + int mode = BLAS_DOUBLE | BLAS_COMPLEX; +#else + int mode = BLAS_SINGLE | BLAS_COMPLEX; +#endif +#endif +#endif + + PRINT_DEBUG_CNAME; + + args.a = (void *)a; + args.b = (void *)b; + + args.lda = lda; + args.ldb = ldb; + +#ifndef COMPLEX + args.beta = (void *)α +#else + args.beta = (void *)alpha; +#endif + + side = -1; + uplo = -1; + trans = -1; + unit = -1; + info = 0; + + if (order == CblasColMajor) { + args.m = m; + args.n = n; + + if (Side == CblasLeft) side = 0; + if (Side == CblasRight) side = 1; + + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + if (Trans == CblasNoTrans) trans = 0; + if (Trans == CblasTrans) trans = 1; +#ifndef COMPLEX + if (Trans == CblasConjNoTrans) trans = 0; + if (Trans == CblasConjTrans) trans = 1; +#else + if (Trans == CblasConjNoTrans) trans = 2; + if (Trans == CblasConjTrans) trans = 3; +#endif + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + nrowa = args.m; + if (side & 1) nrowa = args.n; + + if (args.ldb < MAX(1,args.m)) info = 11; + if (args.lda < MAX(1,nrowa)) info = 9; + if (args.n < 0) info = 6; + if (args.m < 0) info = 5; + if (unit < 0) info = 4; + if (trans < 0) info = 3; + if (uplo < 0) info = 2; + if (side < 0) info = 1; + } + + if (order == CblasRowMajor) { + args.m = n; + args.n = m; + + if (Side == CblasLeft) side = 1; + if (Side == CblasRight) side = 0; + + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + if (Trans == CblasNoTrans) trans = 0; + if (Trans == CblasTrans) trans = 1; +#ifndef COMPLEX + if (Trans == CblasConjNoTrans) trans = 0; + if (Trans == CblasConjTrans) trans = 1; +#else + if (Trans == CblasConjNoTrans) trans = 2; + if (Trans == CblasConjTrans) trans = 3; +#endif + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + nrowa = args.m; + if (side & 1) nrowa = args.n; + + if (args.ldb < MAX(1,args.m)) info = 11; + if (args.lda < MAX(1,nrowa)) info = 9; + if (args.n < 0) info = 6; + if (args.m < 0) info = 5; + if (unit < 0) info = 4; + if (trans < 0) info = 3; + if (uplo < 0) info = 2; + if (side < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if ((args.m == 0) || (args.n == 0)) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + buffer = (FLOAT *)blas_memory_alloc(0); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); + +#ifdef SMPTEST + mode |= (trans << BLAS_TRANSA_SHIFT); + mode |= (side << BLAS_RSIDE_SHIFT); + + args.nthreads = num_cpu_avail(3); + + if (args.nthreads == 1) { +#endif + + (trsm[(side<<4) | (trans<<2) | (uplo<<1) | unit])(&args, NULL, NULL, sa, sb, 0); + +#ifdef SMPTEST + } else { + if (!side) { + gemm_thread_n(mode, &args, NULL, NULL, trsm[(side<<4) | (trans<<2) | (uplo<<1) | unit], sa, sb, args.nthreads); + } else { + gemm_thread_m(mode, &args, NULL, NULL, trsm[(side<<4) | (trans<<2) | (uplo<<1) | unit], sa, sb, args.nthreads); + } + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, + (!side) ? args.m * (args.m + args.n) : args.n * (args.m + args.n), + (!side) ? args.m * args.m * args.n : args.m * args.n * args.n); + + IDEBUG_END; + + return; +} + diff --git a/interface/trsv.c b/interface/trsv.c new file mode 100644 index 000000000..8ef6998db --- /dev/null +++ b/interface/trsv.c @@ -0,0 +1,208 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QTRSV " +#elif defined(DOUBLE) +#define ERROR_NAME "DTRSV " +#else +#define ERROR_NAME "STRSV " +#endif + +static int (*trsv[])(BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { +#ifdef XDOUBLE + qtrsv_NUU, qtrsv_NUN, qtrsv_NLU, qtrsv_NLN, + qtrsv_TUU, qtrsv_TUN, qtrsv_TLU, qtrsv_TLN, +#elif defined(DOUBLE) + dtrsv_NUU, dtrsv_NUN, dtrsv_NLU, dtrsv_NLN, + dtrsv_TUU, dtrsv_TUN, dtrsv_TLU, dtrsv_TLN, +#else + strsv_NUU, strsv_NUN, strsv_NLU, strsv_NLN, + strsv_TUU, strsv_TUN, strsv_TLU, strsv_TLN, +#endif +}; + +#ifndef CBLAS + +void NAME(char *UPLO, char *TRANS, char *DIAG, + blasint *N, FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){ + + char uplo_arg = *UPLO; + char trans_arg = *TRANS; + char diag_arg = *DIAG; + + blasint n = *N; + blasint lda = *LDA; + blasint incx = *INCX; + + blasint info; + int uplo; + int unit; + int trans; + FLOAT *buffer; + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + TOUPPER(trans_arg); + TOUPPER(diag_arg); + + trans = -1; + unit = -1; + uplo = -1; + + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'T') trans = 1; + if (trans_arg == 'R') trans = 0; + if (trans_arg == 'C') trans = 1; + + if (diag_arg == 'U') unit = 0; + if (diag_arg == 'N') unit = 1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incx == 0) info = 8; + if (lda < MAX(1, n)) info = 6; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, + enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, + blasint n, FLOAT *a, blasint lda, FLOAT *x, blasint incx) { + + int trans, uplo, unit; + blasint info; + FLOAT *buffer; + + PRINT_DEBUG_CNAME; + + unit = -1; + uplo = -1; + trans = -1; + info = 0; + + if (order == CblasColMajor) { + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + if (TransA == CblasNoTrans) trans = 0; + if (TransA == CblasTrans) trans = 1; + if (TransA == CblasConjNoTrans) trans = 0; + if (TransA == CblasConjTrans) trans = 1; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 8; + if (lda < MAX(1, n)) info = 6; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + if (TransA == CblasNoTrans) trans = 1; + if (TransA == CblasTrans) trans = 0; + if (TransA == CblasConjNoTrans) trans = 1; + if (TransA == CblasConjTrans) trans = 0; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 8; + if (lda < MAX(1, n)) info = 6; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx; + + buffer = (FLOAT *)blas_memory_alloc(1); + + (trsv[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer); + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(1, n * n / 2 + n, n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/trti2.c b/interface/trti2.c new file mode 100644 index 000000000..e119b45af --- /dev/null +++ b/interface/trti2.c @@ -0,0 +1,134 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QTRTI2" +#elif defined(DOUBLE) +#define ERROR_NAME "DTRTI2" +#else +#define ERROR_NAME "STRTI2" +#endif + +static blasint (*trti2[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { +#ifdef XDOUBLE + qtrti2_UU, qtrti2_UN, qtrti2_LU, qtrti2_LN, +#elif defined(DOUBLE) + dtrti2_UU, dtrti2_UN, dtrti2_LU, dtrti2_LN, +#else + strti2_UU, strti2_UN, strti2_LU, strti2_LN, +#endif + }; + +int NAME(char *UPLO, char *DIAG, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ + + blas_arg_t args; + + blasint uplo_arg = *UPLO; + blasint diag_arg = *DIAG; + blasint uplo, diag; + blasint info; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.n = *N; + args.a = (void *)a; + args.lda = *ldA; + + TOUPPER(uplo_arg); + TOUPPER(diag_arg); + + uplo = -1; + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + diag = -1; + if (diag_arg == 'U') diag = 0; + if (diag_arg == 'N') diag = 1; + + info = 0; + if (args.lda < MAX(1,args.n)) info = 5; + if (args.n < 0) info = 3; + if (diag < 0) info = 2; + if (uplo < 0) info = 1; + if (info) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + *Info = - info; + return 0; + } + + *Info = 0; + + if (args.n <= 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + + info = (trti2[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0); + + *Info = info; + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, .5 * args.n * args.n, + args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) + + args.n * (1./3. + args.n * (-1./2. + args.n * 1./6.))); + + IDEBUG_END; + + return 0; +} diff --git a/interface/trtri.c b/interface/trtri.c new file mode 100644 index 000000000..07d4790f3 --- /dev/null +++ b/interface/trtri.c @@ -0,0 +1,156 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QTRTRI" +#elif defined(DOUBLE) +#define ERROR_NAME "DTRTRI" +#else +#define ERROR_NAME "STRTRI" +#endif + +static blasint (*trtri_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ + TRTRI_UU_SINGLE, TRTRI_UN_SINGLE, TRTRI_LU_SINGLE, TRTRI_LN_SINGLE, +}; + +#ifdef SMPTEST +static blasint (*trtri_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ + TRTRI_UU_PARALLEL, TRTRI_UN_PARALLEL, TRTRI_LU_PARALLEL, TRTRI_LN_PARALLEL, +}; +#endif + + +int NAME(char *UPLO, char *DIAG, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ + + blas_arg_t args; + + blasint uplo_arg = *UPLO; + blasint diag_arg = *DIAG; + blasint uplo, diag; + blasint info; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.n = *N; + args.a = (void *)a; + args.lda = *ldA; + + TOUPPER(uplo_arg); + TOUPPER(diag_arg); + + + uplo = -1; + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + diag = -1; + if (diag_arg == 'U') diag = 0; + if (diag_arg == 'N') diag = 1; + + + info = 0; + if (args.lda < MAX(1,args.n)) info = 5; + if (args.n < 0) info = 3; + if (diag < 0) info = 2; + if (uplo < 0) info = 1; + if (info) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + *Info = - info; + return 0; + } + + *Info = 0; + + if (args.n == 0) return 0; + + if (diag) { + if (AMIN_K(args.n, args.a, args.lda + 1) == ZERO) { + *Info = IAMIN_K(args.n, args.a, args.lda + 1); + return 0; + } + } + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + +#ifdef SMPTEST + args.nthreads = num_cpu_avail(4); + + if (args.nthreads == 1) { +#endif + + *Info = (trtri_single[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0); + +#ifdef SMPTEST + } else { + + *Info = (trtri_parallel[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0); + + } +#endif + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, .5 * args.n * args.n, + args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) + + args.n * (1./3. + args.n * (-1./2. + args.n * 1./6.))); + + IDEBUG_END; + + return 0; +} diff --git a/interface/zaxpy.c b/interface/zaxpy.c new file mode 100644 index 000000000..5ae39552b --- /dev/null +++ b/interface/zaxpy.c @@ -0,0 +1,127 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifndef CBLAS + +void NAME(blasint *N, FLOAT *ALPHA, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){ + + blasint n = *N; + blasint incx = *INCX; + blasint incy = *INCY; + +#else + +void CNAME(blasint n, FLOAT *ALPHA, FLOAT *x, blasint incx, FLOAT *y, blasint incy){ + +#endif + + FLOAT alpha_r = *(ALPHA + 0); + FLOAT alpha_i = *(ALPHA + 1); + +#ifdef SMPTEST + int mode, nthreads; +#endif + +#ifndef CBLAS + PRINT_DEBUG_CNAME; +#else + PRINT_DEBUG_CNAME; +#endif + + if (n <= 0) return; + + if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0) x -= (n - 1) * incx * 2; + if (incy < 0) y -= (n - 1) * incy * 2; + +#ifdef SMPTEST + nthreads = num_cpu_avail(1); + + //disable multi-thread when incx==0 or incy==0 + //In that case, the threads would be dependent. + if (incx == 0 || incy == 0) + nthreads = 1; + + if (nthreads == 1) { +#endif + +#ifndef CONJ + AXPYU_K (n, 0, 0, alpha_r, alpha_i, x, incx, y, incy, NULL, 0); +#else + AXPYC_K(n, 0, 0, alpha_r, alpha_i, x, incx, y, incy, NULL, 0); +#endif + +#ifdef SMPTEST + } else { + +#ifdef XDOUBLE + mode = BLAS_XDOUBLE | BLAS_COMPLEX; +#elif defined(DOUBLE) + mode = BLAS_DOUBLE | BLAS_COMPLEX; +#else + mode = BLAS_SINGLE | BLAS_COMPLEX; +#endif + + blas_level1_thread(mode, n, 0, 0, ALPHA, x, incx, y, incy, NULL, 0, +#ifndef CONJ + (void *)AXPYU_K, +#else + (void *)AXPYC_K, +#endif + nthreads); + } +#endif + + FUNCTION_PROFILE_END(4, 2 * n, 2 * n); + + IDEBUG_END; + + return; + +} diff --git a/interface/zdot.c b/interface/zdot.c new file mode 100644 index 000000000..1380ce292 --- /dev/null +++ b/interface/zdot.c @@ -0,0 +1,202 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef RETURN_BY_STRUCT +#ifdef XDOUBLE +#define MYTYPE myxcomplex_t +#elif defined DOUBLE +#define MYTYPE myzcomplex_t +#else +#define MYTYPE myccomplex_t +#endif +#endif + +#ifndef CBLAS + +#ifdef RETURN_BY_STRUCT +MYTYPE NAME( blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY) { +#elif defined RETURN_BY_STACK +void NAME(FLOAT _Complex *result, blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY) { +#else +FLOAT _Complex NAME( blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY) { +#endif + + BLASLONG n = *N; + BLASLONG incx = *INCX; + BLASLONG incy = *INCY; +#ifndef RETURN_BY_STACK + FLOAT _Complex ret; +#endif +#ifdef RETURN_BY_STRUCT + MYTYPE myret; +#endif + + PRINT_DEBUG_NAME; + + if (n <= 0) { +#ifdef RETURN_BY_STRUCT + myret.r = 0.; + myret.i = 0.; + return myret; +#elif defined RETURN_BY_STACK + *result = ZERO; + return; +#else + return ZERO; +#endif + } + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0) x -= (n - 1) * incx * 2; + if (incy < 0) y -= (n - 1) * incy * 2; + +#ifdef RETURN_BY_STRUCT + +#ifndef CONJ + ret = DOTU_K(n, x, incx, y, incy); +#else + ret = DOTC_K(n, x, incx, y, incy); +#endif + + myret.r = CREAL ret; + myret.i = CIMAG ret; + + FUNCTION_PROFILE_END(4, 2 * n, 2 * n); + + IDEBUG_END; + + return myret; + +#elif defined RETURN_BY_STACK + +#ifndef CONJ + *result = DOTU_K(n, x, incx, y, incy); +#else + *result = DOTC_K(n, x, incx, y, incy); +#endif + + FUNCTION_PROFILE_END(4, 2 * n, 2 * n); + + IDEBUG_END; + +#else + +#ifndef CONJ + ret = DOTU_K(n, x, incx, y, incy); +#else + ret = DOTC_K(n, x, incx, y, incy); +#endif + + FUNCTION_PROFILE_END(4, 2 * n, 2 * n); + + IDEBUG_END; + + return ret; + +#endif + +} + +#else + +#ifdef FORCE_USE_STACK +void CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy, FLOAT _Complex *result){ +#else +FLOAT _Complex CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy){ + + FLOAT _Complex ret; +#endif + + PRINT_DEBUG_CNAME; + + if (n <= 0) { +#ifdef FORCE_USE_STACK + *result = ZERO; + return; +#else + return ZERO; +#endif + } + + if (incx < 0) x -= (n - 1) * incx * 2; + if (incy < 0) y -= (n - 1) * incy * 2; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifdef FORCE_USE_STACK + +#ifndef CONJ + *result = DOTU_K(n, x, incx, y, incy); +#else + *result = DOTC_K(n, x, incx, y, incy); +#endif + + FUNCTION_PROFILE_END(4, 2 * n, 2 * n); + + IDEBUG_END; + +#else + +#ifndef CONJ + ret = DOTU_K(n, x, incx, y, incy); +#else + ret = DOTC_K(n, x, incx, y, incy); +#endif + + FUNCTION_PROFILE_END(4, 2 * n, 2 * n); + + IDEBUG_END; + + return ret; + +#endif + +} + +#endif diff --git a/interface/zgbmv.c b/interface/zgbmv.c new file mode 100644 index 000000000..b0ebb5f37 --- /dev/null +++ b/interface/zgbmv.c @@ -0,0 +1,271 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XGBMV " +#elif defined(DOUBLE) +#define ERROR_NAME "ZGBMV " +#else +#define ERROR_NAME "CGBMV " +#endif + +static void (*gbmv[])(BLASLONG, BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT, + FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { +#ifdef XDOUBLE + xgbmv_n, xgbmv_t, xgbmv_r, xgbmv_c, + xgbmv_o, xgbmv_u, xgbmv_s, xgbmv_d, +#elif defined(DOUBLE) + zgbmv_n, zgbmv_t, zgbmv_r, zgbmv_c, + zgbmv_o, zgbmv_u, zgbmv_s, zgbmv_d, +#else + cgbmv_n, cgbmv_t, cgbmv_r, cgbmv_c, + cgbmv_o, cgbmv_u, cgbmv_s, cgbmv_d, +#endif +}; + +#ifdef SMPTEST +static int (*gbmv_thread[])(BLASLONG, BLASLONG, BLASLONG, BLASLONG, FLOAT *, + FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { +#ifdef XDOUBLE + xgbmv_thread_n, xgbmv_thread_t, xgbmv_thread_r, xgbmv_thread_c, + xgbmv_thread_o, xgbmv_thread_u, xgbmv_thread_s, xgbmv_thread_d, +#elif defined(DOUBLE) + zgbmv_thread_n, zgbmv_thread_t, zgbmv_thread_r, zgbmv_thread_c, + zgbmv_thread_o, zgbmv_thread_u, zgbmv_thread_s, zgbmv_thread_d, +#else + cgbmv_thread_n, cgbmv_thread_t, cgbmv_thread_r, cgbmv_thread_c, + cgbmv_thread_o, cgbmv_thread_u, cgbmv_thread_s, cgbmv_thread_d, +#endif +}; +#endif + +#ifndef CBLAS + +void NAME(char *TRANS, blasint *M, blasint *N, + blasint *KU, blasint *KL, + FLOAT *ALPHA, FLOAT *a, blasint *LDA, + FLOAT *x, blasint *INCX, + FLOAT *BETA, FLOAT *y, blasint *INCY){ + + char trans = *TRANS; + blasint m = *M; + blasint n = *N; + blasint ku = *KU; + blasint kl = *KL; + blasint lda = *LDA; + blasint incx = *INCX; + blasint incy = *INCY; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + FLOAT alpha_r = ALPHA[0]; + FLOAT alpha_i = ALPHA[1]; + FLOAT beta_r = BETA[0]; + FLOAT beta_i = BETA[1]; + + blasint info; + blasint lenx, leny; + blasint i; + + PRINT_DEBUG_NAME; + + TOUPPER(trans); + + info = 0; + + i = -1; + + if (trans == 'N') i = 0; + if (trans == 'T') i = 1; + if (trans == 'R') i = 2; + if (trans == 'C') i = 3; + if (trans == 'O') i = 4; + if (trans == 'U') i = 5; + if (trans == 'S') i = 6; + if (trans == 'D') i = 7; + + if (incy == 0) info = 13; + if (incx == 0) info = 10; + if (lda < kl + ku + 1) info = 8; + if (kl < 0) info = 5; + if (ku < 0) info = 4; + if (n < 0) info = 3; + if (m < 0) info = 2; + if (i < 0) info = 1; + + trans = i; + + if (info != 0){ + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, + enum CBLAS_TRANSPOSE TransA, + blasint m, blasint n, + blasint ku, blasint kl, + FLOAT *ALPHA, + FLOAT *a, blasint lda, + FLOAT *x, blasint incx, + FLOAT *BETA, + FLOAT *y, blasint incy){ + + FLOAT alpha_r = ALPHA[0]; + FLOAT alpha_i = ALPHA[1]; + FLOAT beta_r = BETA[0]; + FLOAT beta_i = BETA[1]; + + FLOAT *buffer; + blasint lenx, leny; + int trans; + blasint info, t; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_CNAME; + + trans = -1; + info = 0; + + if (order == CblasColMajor) { + if (TransA == CblasNoTrans) trans = 0; + if (TransA == CblasTrans) trans = 1; + if (TransA == CblasConjNoTrans) trans = 2; + if (TransA == CblasConjTrans) trans = 3; + + info = -1; + + if (incy == 0) info = 13; + if (incx == 0) info = 10; + if (lda < kl + ku + 1) info = 8; + if (kl < 0) info = 5; + if (ku < 0) info = 4; + if (n < 0) info = 3; + if (m < 0) info = 2; + if (trans < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (TransA == CblasNoTrans) trans = 1; + if (TransA == CblasTrans) trans = 0; + if (TransA == CblasConjNoTrans) trans = 3; + if (TransA == CblasConjTrans) trans = 2; + + info = -1; + + t = n; + n = m; + m = t; + + t = ku; + ku = kl; + kl = t; + + if (incy == 0) info = 13; + if (incx == 0) info = 10; + if (lda < kl + ku + 1) info = 8; + if (kl < 0) info = 5; + if (ku < 0) info = 4; + if (n < 0) info = 3; + if (m < 0) info = 2; + if (trans < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if ((m==0) || (n==0)) return; + + lenx = n; + leny = m; + if (trans & 1) lenx = m; + if (trans & 1) leny = n; + + if (beta_r != ONE || beta_i != ZERO) SCAL_K(leny, 0, 0, beta_r, beta_i, y, abs(incy), NULL, 0, NULL, 0); + + if (alpha_r == ZERO && alpha_i == ZERO) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0) x -= (lenx - 1) * incx * 2; + if (incy < 0) y -= (leny - 1) * incy * 2; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (gbmv[(int)trans])(m, n, kl, ku, alpha_r, alpha_i, a, lda, x, incx, y, incy, buffer); + +#ifdef SMPTEST + + } else { + + (gbmv_thread[(int)trans])(m, n, kl, ku, ALPHA, a, lda, x, incx, y, incy, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, m * n / 2 + n, m * n); + + IDEBUG_END; + + return; +} diff --git a/interface/zgemv.c b/interface/zgemv.c new file mode 100644 index 000000000..c943b2057 --- /dev/null +++ b/interface/zgemv.c @@ -0,0 +1,259 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XGEMV " +#elif defined(DOUBLE) +#define ERROR_NAME "ZGEMV " +#else +#define ERROR_NAME "CGEMV " +#endif + +#ifdef SMPTEST +static int (*gemv_thread[])(BLASLONG, BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { +#ifdef XDOUBLE + xgemv_thread_n, xgemv_thread_t, xgemv_thread_r, xgemv_thread_c, xgemv_thread_o, xgemv_thread_u, xgemv_thread_s, xgemv_thread_d, +#elif defined DOUBLE + zgemv_thread_n, zgemv_thread_t, zgemv_thread_r, zgemv_thread_c, zgemv_thread_o, zgemv_thread_u, zgemv_thread_s, zgemv_thread_d, +#else + cgemv_thread_n, cgemv_thread_t, cgemv_thread_r, cgemv_thread_c, cgemv_thread_o, cgemv_thread_u, cgemv_thread_s, cgemv_thread_d, +#endif +}; +#endif + +#ifndef CBLAS + +void NAME(char *TRANS, blasint *M, blasint *N, + FLOAT *ALPHA, FLOAT *a, blasint *LDA, + FLOAT *x, blasint *INCX, + FLOAT *BETA, FLOAT *y, blasint *INCY){ + + char trans = *TRANS; + blasint m = *M; + blasint n = *N; + blasint lda = *LDA; + blasint incx = *INCX; + blasint incy = *INCY; + + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + int (*gemv[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, + FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { + GEMV_N, GEMV_T, GEMV_R, GEMV_C, + GEMV_O, GEMV_U, GEMV_S, GEMV_D, + }; + + blasint info; + blasint lenx, leny; + blasint i; + + PRINT_DEBUG_NAME; + + FLOAT alpha_r = *(ALPHA + 0); + FLOAT alpha_i = *(ALPHA + 1); + + FLOAT beta_r = *(BETA + 0); + FLOAT beta_i = *(BETA + 1); + + TOUPPER(trans); + + info = 0; + + i = -1; + + if (trans == 'N') i = 0; + if (trans == 'T') i = 1; + if (trans == 'R') i = 2; + if (trans == 'C') i = 3; + if (trans == 'O') i = 4; + if (trans == 'U') i = 5; + if (trans == 'S') i = 6; + if (trans == 'D') i = 7; + + if (incy == 0) info = 11; + if (incx == 0) info = 8; + if (lda < MAX(1,m)) info = 6; + if (n < 0) info = 3; + if (m < 0) info = 2; + if (i < 0) info = 1; + + trans = i; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, + enum CBLAS_TRANSPOSE TransA, + blasint m, blasint n, + FLOAT *ALPHA, + FLOAT *a, blasint lda, + FLOAT *x, blasint incx, + FLOAT *BETA, + FLOAT *y, blasint incy){ + + FLOAT *buffer; + blasint lenx, leny; + int trans; + blasint info, t; +#ifdef SMPTEST + int nthreads; +#endif + + int (*gemv[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, + FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { + GEMV_N, GEMV_T, GEMV_R, GEMV_C, + GEMV_O, GEMV_U, GEMV_S, GEMV_D, + }; + + PRINT_DEBUG_CNAME; + + FLOAT alpha_r = *(ALPHA + 0); + FLOAT alpha_i = *(ALPHA + 1); + + FLOAT beta_r = *(BETA + 0); + FLOAT beta_i = *(BETA + 1); + + trans = -1; + info = 0; + + if (order == CblasColMajor) { + if (TransA == CblasNoTrans) trans = 0; + if (TransA == CblasTrans) trans = 1; + if (TransA == CblasConjNoTrans) trans = 2; + if (TransA == CblasConjTrans) trans = 3; + + info = -1; + + if (incy == 0) info = 11; + if (incx == 0) info = 8; + if (lda < MAX(1, m)) info = 6; + if (n < 0) info = 3; + if (m < 0) info = 2; + if (trans < 0) info = 1; + + } + + if (order == CblasRowMajor) { + if (TransA == CblasNoTrans) trans = 1; + if (TransA == CblasTrans) trans = 0; + if (TransA == CblasConjNoTrans) trans = 3; + if (TransA == CblasConjTrans) trans = 2; + + info = -1; + + t = n; + n = m; + m = t; + + if (incy == 0) info = 11; + if (incx == 0) info = 8; + if (lda < MAX(1, m)) info = 6; + if (n < 0) info = 3; + if (m < 0) info = 2; + if (trans < 0) info = 1; + + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + /* Quick return if possible. */ + + if (m == 0 || n == 0) return; + + lenx = n; + leny = m; + + if (trans & 1) lenx = m; + if (trans & 1) leny = n; + + if (beta_r != ONE || beta_i != ZERO) SCAL_K(leny, 0, 0, beta_r, beta_i, y, abs(incy), NULL, 0, NULL, 0); + + if (alpha_r == ZERO && alpha_i == ZERO) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0) x -= (lenx - 1) * incx * 2; + if (incy < 0) y -= (leny - 1) * incy * 2; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (gemv[(int)trans])(m, n, 0, alpha_r, alpha_i, a, lda, x, incx, y, incy, buffer); + +#ifdef SMPTEST + + } else { + + (gemv_thread[(int)trans])(m, n, ALPHA, a, lda, x, incx, y, incy, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, m * n + m + n, 2 * m * n); + + IDEBUG_END; + + return; +} diff --git a/interface/zger.c b/interface/zger.c new file mode 100644 index 000000000..1b615a513 --- /dev/null +++ b/interface/zger.c @@ -0,0 +1,249 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#ifndef CONJ +#define ERROR_NAME "XGERU " +#else +#define ERROR_NAME "XGERC " +#endif +#elif defined DOUBLE +#ifndef CONJ +#define ERROR_NAME "ZGERU " +#else +#define ERROR_NAME "ZGERC " +#endif +#else +#ifndef CONJ +#define ERROR_NAME "CGERU " +#else +#define ERROR_NAME "CGERC " +#endif +#endif + +#if defined XDOUBLE +#ifndef CONJ +#define GER GERU_K +#define GER_THREAD xger_thread_U +#else +#define GER GERC_K +#define GER_THREAD xger_thread_C +#define GERV GERV_K +#define GERV_THREAD xger_thread_V +#endif +#elif defined DOUBLE +#ifndef CONJ +#define GER GERU_K +#define GER_THREAD zger_thread_U +#else +#define GER GERC_K +#define GER_THREAD zger_thread_C +#define GERV GERV_K +#define GERV_THREAD zger_thread_V +#endif +#else +#ifndef CONJ +#define GER GERU_K +#define GER_THREAD cger_thread_U +#else +#define GER GERC_K +#define GER_THREAD cger_thread_C +#define GERV GERV_K +#define GERV_THREAD cger_thread_V +#endif +#endif + +#ifndef CBLAS + +void NAME(blasint *M, blasint *N, FLOAT *Alpha, + FLOAT *x, blasint *INCX, + FLOAT *y, blasint *INCY, + FLOAT *a, blasint *LDA){ + + blasint m = *M; + blasint n = *N; + FLOAT alpha_r = Alpha[0]; + FLOAT alpha_i = Alpha[1]; + blasint incx = *INCX; + blasint incy = *INCY; + blasint lda = *LDA; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + blasint info; + + PRINT_DEBUG_NAME; + + info = 0; + + if (lda < MAX(1,m)) info = 9; + if (incy == 0) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (m < 0) info = 1; + + if (info){ + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, + blasint m, blasint n, + FLOAT *Alpha, + FLOAT *x, blasint incx, + FLOAT *y, blasint incy, + FLOAT *a, blasint lda) { + + FLOAT alpha_r = Alpha[0]; + FLOAT alpha_i = Alpha[1]; + + FLOAT *buffer; + blasint info, t; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_CNAME; + + info = 0; + + if (order == CblasColMajor) { + info = -1; + + if (lda < MAX(1,m)) info = 9; + if (incy == 0) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (m < 0) info = 1; + } + + if (order == CblasRowMajor) { + info = -1; + + t = n; + n = m; + m = t; + + t = incx; + incx = incy; + incy = t; + + buffer = x; + x = y; + y = buffer; + + if (lda < MAX(1,m)) info = 9; + if (incy == 0) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (m < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + /* Quick return if possible. */ + if (m == 0 || n == 0) return; + + if ((alpha_r == 0.) && (alpha_i == 0.)) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incy < 0) y -= (n - 1) * incy * 2; + if (incx < 0) x -= (m - 1) * incx * 2; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + +#if !defined(CBLAS) || !defined(CONJ) + GER(m, n, 0, alpha_r, alpha_i, x, incx, y, incy, a, lda, buffer); +#else + if (order == CblasColMajor) { + GER(m, n, 0, alpha_r, alpha_i, x, incx, y, incy, a, lda, buffer); + } else { + GERV(m, n, 0, alpha_r, alpha_i, x, incx, y, incy, a, lda, buffer); + } +#endif + +#ifdef SMPTEST + + } else { + +#if !defined(CBLAS) || !defined(CONJ) + GER_THREAD(m, n, Alpha, x, incx, y, incy, a, lda, buffer, nthreads); +#else + if (order == CblasColMajor) { + GER_THREAD(m, n, Alpha, x, incx, y, incy, a, lda, buffer, nthreads); + } else { + GERV_THREAD(m, n, Alpha, x, incx, y, incy, a, lda, buffer, nthreads); + } +#endif + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, m * n + m + n, 2 * m * n); + + IDEBUG_END; + + return; + +} diff --git a/interface/zhbmv.c b/interface/zhbmv.c new file mode 100644 index 000000000..717e8f5b0 --- /dev/null +++ b/interface/zhbmv.c @@ -0,0 +1,223 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XHBMV " +#elif defined(DOUBLE) +#define ERROR_NAME "ZHBMV " +#else +#define ERROR_NAME "CHBMV " +#endif + +static int (*hbmv[])(BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { +#ifdef XDOUBLE + xhbmv_U, xhbmv_L, xhbmv_V, xhbmv_M, +#elif defined(DOUBLE) + zhbmv_U, zhbmv_L, zhbmv_V, zhbmv_M, +#else + chbmv_U, chbmv_L, chbmv_V, chbmv_M, +#endif +}; + +#ifdef SMPTEST +static int (*hbmv_thread[])(BLASLONG, BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { +#ifdef XDOUBLE + xhbmv_thread_U, xhbmv_thread_L, xhbmv_thread_V, xhbmv_thread_M, +#elif defined(DOUBLE) + zhbmv_thread_U, zhbmv_thread_L, zhbmv_thread_V, zhbmv_thread_M, +#else + chbmv_thread_U, chbmv_thread_L, chbmv_thread_V, chbmv_thread_M, +#endif +}; +#endif + +#ifndef CBLAS + +void NAME(char *UPLO, blasint *N, blasint *K, FLOAT *ALPHA, FLOAT *a, blasint *LDA, + FLOAT *x, blasint *INCX, FLOAT *BETA, FLOAT *y, blasint *INCY){ + + char uplo_arg = *UPLO; + blasint n = *N; + blasint k = *K; + FLOAT alpha_r = ALPHA[0]; + FLOAT alpha_i = ALPHA[1]; + blasint lda = *LDA; + blasint incx = *INCX; + FLOAT beta_r = BETA[0]; + FLOAT beta_i = BETA[1]; + blasint incy = *INCY; + + blasint info; + int uplo; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + uplo = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + if (uplo_arg == 'V') uplo = 2; + if (uplo_arg == 'M') uplo = 3; + + info = 0; + + if (incy == 0) info = 11; + if (incx == 0) info = 8; + if (lda < k + 1) info = 6; + if (k < 0) info = 3; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, + enum CBLAS_UPLO Uplo, + blasint n, blasint k, + FLOAT *ALPHA, + FLOAT *a, blasint lda, + FLOAT *x, blasint incx, + FLOAT *BETA, + FLOAT *y, blasint incy){ + + FLOAT alpha_r = ALPHA[0]; + FLOAT alpha_i = ALPHA[1]; + FLOAT beta_r = BETA[0]; + FLOAT beta_i = BETA[1]; + FLOAT *buffer; + int uplo; + blasint info; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_CNAME; + + uplo = -1; + info = 0; + + if (order == CblasColMajor) { + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + info = -1; + + if (incy == 0) info = 11; + if (incx == 0) info = 8; + if (lda < k + 1) info = 6; + if (k < 0) info = 3; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (Uplo == CblasUpper) uplo = 3; + if (Uplo == CblasLower) uplo = 2; + + info = -1; + + if (incy == 0) info = 11; + if (incx == 0) info = 8; + if (lda < k + 1) info = 6; + if (k < 0) info = 3; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + if ((beta_r != ONE) || (beta_i != ZERO)) SCAL_K(n, 0, 0, beta_r, beta_i, y, abs(incy), NULL, 0, NULL, 0); + + if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx * COMPSIZE; + if (incy < 0 ) y -= (n - 1) * incy * COMPSIZE; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (hbmv[uplo])(n, k, alpha_r, alpha_i, a, lda, x, incx, y, incy, buffer); + +#ifdef SMPTEST + } else { + + (hbmv_thread[uplo])(n, k, ALPHA, a, lda, x, incx, y, incy, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, n * k / 2 + n, n * k); + + IDEBUG_END; + + return; +} diff --git a/interface/zhemv.c b/interface/zhemv.c new file mode 100644 index 000000000..1dcccb4d1 --- /dev/null +++ b/interface/zhemv.c @@ -0,0 +1,215 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XHEMV " +#elif defined(DOUBLE) +#define ERROR_NAME "ZHEMV " +#else +#define ERROR_NAME "CHEMV " +#endif + +#ifndef CBLAS + +void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, blasint *LDA, + FLOAT *x, blasint *INCX, FLOAT *BETA, FLOAT *y, blasint *INCY){ + + char uplo_arg = *UPLO; + blasint n = *N; + FLOAT alpha_r = ALPHA[0]; + FLOAT alpha_i = ALPHA[1]; + blasint lda = *LDA; + blasint incx = *INCX; + FLOAT beta_r = BETA[0]; + FLOAT beta_i = BETA[1]; + blasint incy = *INCY; +#ifdef SMPTEST + int nthreads; +#endif + + int (*hemv[])(BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { + HEMV_U, HEMV_L, HEMV_V, HEMV_M, + }; + +#ifdef SMPTEST + int (*hemv_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { + HEMV_THREAD_U, HEMV_THREAD_L, HEMV_THREAD_V, HEMV_THREAD_M, + }; +#endif + + blasint info; + int uplo; + FLOAT *buffer; + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + uplo = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + if (uplo_arg == 'V') uplo = 2; + if (uplo_arg == 'M') uplo = 3; + + info = 0; + + if (incy == 0) info = 10; + if (incx == 0) info = 7; + if (lda < MAX(1, n)) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT *ALPHA, + FLOAT *a, blasint lda, FLOAT *x, blasint incx, FLOAT *BETA, FLOAT *y, blasint incy) { + + FLOAT alpha_r = ALPHA[0]; + FLOAT alpha_i = ALPHA[1]; + FLOAT beta_r = BETA[0]; + FLOAT beta_i = BETA[1]; + + FLOAT *buffer; + int trans, uplo; + blasint info; +#ifdef SMPTEST + int nthreads; +#endif + + int (*hemv[])(BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { + HEMV_U, HEMV_L, HEMV_V, HEMV_M, + }; + +#ifdef SMPTEST + int (*hemv_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { + HEMV_THREAD_U, HEMV_THREAD_L, HEMV_THREAD_V, HEMV_THREAD_M, + }; +#endif + + PRINT_DEBUG_CNAME; + + trans = -1; + uplo = -1; + info = 0; + + if (order == CblasColMajor) { + + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + info = -1; + + if (incy == 0) info = 10; + if (incx == 0) info = 7; + if (lda < MAX(1, n)) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + + if (Uplo == CblasUpper) uplo = 3; + if (Uplo == CblasLower) uplo = 2; + + info = -1; + + if (incy == 0) info = 10; + if (incx == 0) info = 7; + if (lda < MAX(1, n)) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + if ((beta_r != ONE) || (beta_i != ZERO)) SCAL_K(n, 0, 0, beta_r, beta_i, y, abs(incy), NULL, 0, NULL, 0); + + if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx * 2; + if (incy < 0 ) y -= (n - 1) * incy * 2; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (hemv[uplo])(n, n, alpha_r, alpha_i, a, lda, x, incx, y, incy, buffer); + +#ifdef SMPTEST + } else { + + (hemv_thread[uplo])(n, ALPHA, a, lda, x, incx, y, incy, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, n * n / 2 + n, 2 * n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/zher.c b/interface/zher.c new file mode 100644 index 000000000..237f8d75e --- /dev/null +++ b/interface/zher.c @@ -0,0 +1,200 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XHER " +#elif defined(DOUBLE) +#define ERROR_NAME "ZHER " +#else +#define ERROR_NAME "CHER " +#endif + +static int (*her[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { +#ifdef XDOUBLE + xher_U, xher_L, xher_V, xher_M, +#elif defined(DOUBLE) + zher_U, zher_L, zher_V, zher_M, +#else + cher_U, cher_L, cher_V, cher_M, +#endif +}; + +#ifdef SMPTEST +static int (*her_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { +#ifdef XDOUBLE + xher_thread_U, xher_thread_L, xher_thread_V, xher_thread_M, +#elif defined(DOUBLE) + zher_thread_U, zher_thread_L, zher_thread_V, zher_thread_M, +#else + cher_thread_U, cher_thread_L, cher_thread_V, cher_thread_M, +#endif +}; +#endif + +#ifndef CBLAS + +void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, + FLOAT *x, blasint *INCX, FLOAT *a, blasint *LDA){ + + char uplo_arg = *UPLO; + blasint n = *N; + FLOAT alpha = *ALPHA; + blasint lda = *LDA; + blasint incx = *INCX; + + blasint info; + int uplo; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + uplo = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (lda < MAX(1, n)) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, FLOAT *x, blasint incx, FLOAT *a, blasint lda) { + + FLOAT *buffer; + int trans, uplo; + blasint info; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_CNAME; + + trans = -1; + uplo = -1; + info = 0; + + if (order == CblasColMajor) { + + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + info = -1; + + if (lda < MAX(1, n)) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + } + + if (order == CblasRowMajor) { + + if (Uplo == CblasUpper) uplo = 3; + if (Uplo == CblasLower) uplo = 2; + + info = -1; + + if (lda < MAX(1, n)) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + if (alpha == ZERO) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx * 2; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (her[uplo])(n, alpha, x, incx, a, lda, buffer); + +#ifdef SMPTEST + } else { + + (her_thread[uplo])(n, alpha, x, incx, a, lda, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/zher2.c b/interface/zher2.c new file mode 100644 index 000000000..c35307556 --- /dev/null +++ b/interface/zher2.c @@ -0,0 +1,207 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XHER2 " +#elif defined(DOUBLE) +#define ERROR_NAME "ZHER2 " +#else +#define ERROR_NAME "CHER2 " +#endif + +static int (*her2[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { +#ifdef XDOUBLE + xher2_U, xher2_L, xher2_V, xher2_M, +#elif defined(DOUBLE) + zher2_U, zher2_L, zher2_V, zher2_M, +#else + cher2_U, cher2_L, cher2_V, cher2_M, +#endif +}; + +#ifdef SMPTEST +static int (*her2_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { +#ifdef XDOUBLE + xher2_thread_U, xher2_thread_L, xher2_thread_V, xher2_thread_M, +#elif defined(DOUBLE) + zher2_thread_U, zher2_thread_L, zher2_thread_V, zher2_thread_M, +#else + cher2_thread_U, cher2_thread_L, cher2_thread_V, cher2_thread_M, +#endif +}; +#endif + +#ifndef CBLAS + +void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, + FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *a, blasint *LDA){ + + char uplo_arg = *UPLO; + blasint n = *N; + FLOAT alpha_r = ALPHA[0]; + FLOAT alpha_i = ALPHA[1]; + blasint lda = *LDA; + blasint incx = *INCX; + blasint incy = *INCY; + + blasint info; + int uplo; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + uplo = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (lda < MAX(1, n)) info = 9; + if (incy == 0) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT *ALPHA, FLOAT *x, blasint incx, FLOAT *y, blasint incy, FLOAT *a, blasint lda) { + + FLOAT alpha_r = ALPHA[0]; + FLOAT alpha_i = ALPHA[1]; + FLOAT *buffer; + int trans, uplo; + blasint info; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_CNAME; + + trans = -1; + uplo = -1; + info = 0; + + if (order == CblasColMajor) { + + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + info = -1; + + if (lda < MAX(1, n)) info = 9; + if (incy == 0) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + + if (Uplo == CblasUpper) uplo = 3; + if (Uplo == CblasLower) uplo = 2; + + info = -1; + + if (lda < MAX(1, n)) info = 9; + if (incx == 0) info = 7; + if (incy == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx * 2; + if (incy < 0 ) y -= (n - 1) * incy * 2; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (her2[uplo])(n, alpha_r, alpha_i, x, incx, y, incy, a, lda, buffer); + +#ifdef SMPTEST + } else { + + (her2_thread[uplo])(n, ALPHA, x, incx, y, incy, a, lda, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, n * n / 2 + 2 * n, 2 * n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/zhpmv.c b/interface/zhpmv.c new file mode 100644 index 000000000..36cc8d954 --- /dev/null +++ b/interface/zhpmv.c @@ -0,0 +1,213 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XHPMV " +#elif defined(DOUBLE) +#define ERROR_NAME "ZHPMV " +#else +#define ERROR_NAME "CHPMV " +#endif + +static int (*hpmv[])(BLASLONG, FLOAT, FLOAT, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { +#ifdef XDOUBLE + xhpmv_U, xhpmv_L, xhpmv_V, xhpmv_M, +#elif defined(DOUBLE) + zhpmv_U, zhpmv_L, zhpmv_V, zhpmv_M, +#else + chpmv_U, chpmv_L, chpmv_V, chpmv_M, +#endif +}; + +#ifdef SMPTEST +static int (*hpmv_thread[])(BLASLONG, FLOAT *, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { +#ifdef XDOUBLE + xhpmv_thread_U, xhpmv_thread_L, xhpmv_thread_V, xhpmv_thread_M, +#elif defined(DOUBLE) + zhpmv_thread_U, zhpmv_thread_L, zhpmv_thread_V, zhpmv_thread_M, +#else + chpmv_thread_U, chpmv_thread_L, chpmv_thread_V, chpmv_thread_M, +#endif +}; +#endif + +#ifndef CBLAS + +void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, + FLOAT *x, blasint *INCX, FLOAT *BETA, FLOAT *y, blasint *INCY){ + + char uplo_arg = *UPLO; + blasint n = *N; + FLOAT alpha_r = ALPHA[0]; + FLOAT alpha_i = ALPHA[1]; + blasint incx = *INCX; + FLOAT beta_r = BETA[0]; + FLOAT beta_i = BETA[1]; + blasint incy = *INCY; + + blasint info; + int uplo; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + uplo = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incy == 0) info = 9; + if (incx == 0) info = 6; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, + enum CBLAS_UPLO Uplo, + blasint n, + FLOAT *ALPHA, + FLOAT *a, + FLOAT *x, blasint incx, + FLOAT *BETA, + FLOAT *y, blasint incy){ + + FLOAT alpha_r = ALPHA[0]; + FLOAT alpha_i = ALPHA[1]; + FLOAT beta_r = BETA[0]; + FLOAT beta_i = BETA[1]; + FLOAT *buffer; + int uplo; + blasint info; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_CNAME; + + uplo = -1; + info = 0; + + if (order == CblasColMajor) { + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + info = -1; + + if (incy == 0) info = 9; + if (incx == 0) info = 6; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (Uplo == CblasUpper) uplo = 3; + if (Uplo == CblasLower) uplo = 2; + + info = -1; + + if (incy == 0) info = 9; + if (incx == 0) info = 6; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + if ((beta_r != ONE) || (beta_i != ZERO)) SCAL_K(n, 0, 0, beta_r, beta_i, y, abs(incy), NULL, 0, NULL, 0); + + if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx * 2; + if (incy < 0 ) y -= (n - 1) * incy * 2; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (hpmv[uplo])(n, alpha_r, alpha_i, a, x, incx, y, incy, buffer); + +#ifdef SMPTEST + } else { + + (hpmv_thread[uplo])(n, ALPHA, a, x, incx, y, incy, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/zhpr.c b/interface/zhpr.c new file mode 100644 index 000000000..736effd48 --- /dev/null +++ b/interface/zhpr.c @@ -0,0 +1,198 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XHPR " +#elif defined(DOUBLE) +#define ERROR_NAME "ZHPR " +#else +#define ERROR_NAME "CHPR " +#endif + +static int (*hpr[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, FLOAT *) = { +#ifdef XDOUBLE + xhpr_U, xhpr_L, xhpr_V, xhpr_M, +#elif defined(DOUBLE) + zhpr_U, zhpr_L, zhpr_V, zhpr_M, +#else + chpr_U, chpr_L, chpr_V, chpr_M, +#endif +}; + +#ifdef SMPTEST +static int (*hpr_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = { +#ifdef XDOUBLE + xhpr_thread_U, xhpr_thread_L, xhpr_thread_V, xhpr_thread_M, +#elif defined(DOUBLE) + zhpr_thread_U, zhpr_thread_L, zhpr_thread_V, zhpr_thread_M, +#else + chpr_thread_U, chpr_thread_L, chpr_thread_V, chpr_thread_M, +#endif +}; +#endif + +#ifndef CBLAS + +void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, + FLOAT *x, blasint *INCX, FLOAT *a){ + + char uplo_arg = *UPLO; + blasint n = *N; + FLOAT alpha = *ALPHA; + blasint incx = *INCX; + + blasint info; + int uplo; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + uplo = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, + enum CBLAS_UPLO Uplo, + blasint n, + FLOAT alpha, + FLOAT *x, blasint incx, + FLOAT *a) { + + FLOAT *buffer; + int uplo; + blasint info; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_CNAME; + + uplo = -1; + info = 0; + + if (order == CblasColMajor) { + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + info = -1; + + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (Uplo == CblasUpper) uplo = 3; + if (Uplo == CblasLower) uplo = 2; + + info = -1; + + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + if (alpha == ZERO) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx * 2; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (hpr[uplo])(n, alpha, x, incx, a, buffer); + +#ifdef SMPTEST + + } else { + + (hpr_thread[uplo])(n, alpha, x, incx, a, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/zhpr2.c b/interface/zhpr2.c new file mode 100644 index 000000000..870124f7e --- /dev/null +++ b/interface/zhpr2.c @@ -0,0 +1,207 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XHPR2 " +#elif defined(DOUBLE) +#define ERROR_NAME "ZHPR2 " +#else +#define ERROR_NAME "CHPR2 " +#endif + +static int (*hpr2[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, FLOAT *) = { +#ifdef XDOUBLE + xhpr2_U, xhpr2_L, xhpr2_V, xhpr2_M, +#elif defined(DOUBLE) + zhpr2_U, zhpr2_L, zhpr2_V, zhpr2_M, +#else + chpr2_U, chpr2_L, chpr2_V, chpr2_M, +#endif +}; + +#ifdef SMPTEST +static int (*hpr2_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = { +#ifdef XDOUBLE + xhpr2_thread_U, xhpr2_thread_L, xhpr2_thread_V, xhpr2_thread_M, +#elif defined(DOUBLE) + zhpr2_thread_U, zhpr2_thread_L, zhpr2_thread_V, zhpr2_thread_M, +#else + chpr2_thread_U, chpr2_thread_L, chpr2_thread_V, chpr2_thread_M, +#endif +}; +#endif + +#ifndef CBLAS + +void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, + FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *a){ + + char uplo_arg = *UPLO; + blasint n = *N; + FLOAT alpha_r = ALPHA[0]; + FLOAT alpha_i = ALPHA[1]; + blasint incx = *INCX; + blasint incy = *INCY; + + blasint info; + int uplo; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + uplo = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incy == 0) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, + enum CBLAS_UPLO Uplo, + blasint n, + FLOAT *ALPHA, + FLOAT *x, blasint incx, + FLOAT *y, blasint incy, + FLOAT *a) { + + FLOAT alpha_r = ALPHA[0]; + FLOAT alpha_i = ALPHA[1]; + FLOAT *buffer; + int uplo; + blasint info; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_CNAME; + + uplo = -1; + info = 0; + + if (order == CblasColMajor) { + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + info = -1; + + if (incy == 0) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (Uplo == CblasUpper) uplo = 3; + if (Uplo == CblasLower) uplo = 2; + + info = -1; + + if (incx == 0) info = 7; + if (incy == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; + + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx * 2; + if (incy < 0 ) y -= (n - 1) * incy * 2; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (hpr2[uplo])(n, alpha_r, alpha_i, x, incx, y, incy, a, buffer); + +#ifdef SMPTEST + } else { + + (hpr2_thread[uplo])(n, ALPHA, x, incx, y, incy, a, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, n * n / 2 + 2 * n, 2 * n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/zrot.c b/interface/zrot.c new file mode 100644 index 000000000..f18bbc6d1 --- /dev/null +++ b/interface/zrot.c @@ -0,0 +1,72 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +void NAME(blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *C, FLOAT *S){ + + BLASLONG n = *N; + BLASLONG incx = *INCX; + BLASLONG incy = *INCY; + FLOAT c = *C; + FLOAT s = *S; + + PRINT_DEBUG_NAME; + + if (n <= 0) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0) x -= (n - 1) * 2 * incx; + if (incy < 0) y -= (n - 1) * 2 * incy; + + ROT_K(n, x, incx, y, incy, c, s); + + FUNCTION_PROFILE_END(4, n, n); + + IDEBUG_END; + + return; + +} diff --git a/interface/zrotg.c b/interface/zrotg.c new file mode 100644 index 000000000..e9e8a11df --- /dev/null +++ b/interface/zrotg.c @@ -0,0 +1,115 @@ +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +void NAME(FLOAT *DA, FLOAT *DB, FLOAT *C, FLOAT *S){ + + PRINT_DEBUG_NAME; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__) + + long double da_r = *(DA + 0); + long double da_i = *(DA + 1); + long double db_r = *(DB + 0); + long double db_i = *(DB + 1); + long double r; + + long double ada = fabs(da_r) + fabs(da_i); + + if (ada == ZERO) { + *C = ZERO; + *(S + 0) = ONE; + *(S + 1) = ZERO; + *(DA + 0) = db_r; + *(DA + 1) = db_i; + } else { + long double alpha_r, alpha_i; + + ada = sqrt(da_r * da_r + da_i * da_i); + + r = sqrt(da_r * da_r + da_i * da_i + db_r * db_r + db_i * db_i); + + alpha_r = da_r / ada; + alpha_i = da_i / ada; + + *(C + 0) = ada / r; + *(S + 0) = (alpha_r * db_r + alpha_i *db_i) / r; + *(S + 1) = (alpha_i * db_r - alpha_r *db_i) / r; + *(DA + 0) = alpha_r * r; + *(DA + 1) = alpha_i * r; + } +#else + FLOAT da_r = *(DA + 0); + FLOAT da_i = *(DA + 1); + FLOAT db_r = *(DB + 0); + FLOAT db_i = *(DB + 1); + FLOAT r; + + FLOAT ada = fabs(da_r) + fabs(da_i); + FLOAT adb; + + if (ada == ZERO) { + *C = ZERO; + *(S + 0) = ONE; + *(S + 1) = ZERO; + *(DA + 0) = db_r; + *(DA + 1) = db_i; + } else { + FLOAT scale; + FLOAT aa_r, aa_i, bb_r, bb_i; + FLOAT alpha_r, alpha_i; + + aa_r = fabs(da_r); + aa_i = fabs(da_i); + + if (aa_i > aa_r) { + aa_r = fabs(da_i); + aa_i = fabs(da_r); + } + + scale = (aa_i / aa_r); + ada = aa_r * sqrt(ONE + scale * scale); + + bb_r = fabs(db_r); + bb_i = fabs(db_i); + + if (bb_i > bb_r) { + bb_r = fabs(bb_i); + bb_i = fabs(bb_r); + } + + scale = (bb_i / bb_r); + adb = bb_r * sqrt(ONE + scale * scale); + + scale = ada + adb; + + aa_r = da_r / scale; + aa_i = da_i / scale; + bb_r = db_r / scale; + bb_i = db_i / scale; + + r = scale * sqrt(aa_r * aa_r + aa_i * aa_i + bb_r * bb_r + bb_i * bb_i); + + alpha_r = da_r / ada; + alpha_i = da_i / ada; + + *(C + 0) = ada / r; + *(S + 0) = (alpha_r * db_r + alpha_i *db_i) / r; + *(S + 1) = (alpha_i * db_r - alpha_r *db_i) / r; + *(DA + 0) = alpha_r * r; + *(DA + 1) = alpha_i * r; + } +#endif + + FUNCTION_PROFILE_END(4, 4, 4); + + IDEBUG_END; + + return; +} diff --git a/interface/zsbmv.c b/interface/zsbmv.c new file mode 100644 index 000000000..110b8e4f1 --- /dev/null +++ b/interface/zsbmv.c @@ -0,0 +1,157 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XSBMV " +#elif defined(DOUBLE) +#define ERROR_NAME "ZSBMV " +#else +#define ERROR_NAME "CSBMV " +#endif + +static int (*sbmv[])(BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { +#ifdef XDOUBLE + xsbmv_U, xsbmv_L, +#elif defined(DOUBLE) + zsbmv_U, zsbmv_L, +#else + csbmv_U, csbmv_L, +#endif +}; + +#ifdef SMPTEST +static int (*sbmv_thread[])(BLASLONG, BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { +#ifdef XDOUBLE + xsbmv_thread_U, xsbmv_thread_L, +#elif defined(DOUBLE) + zsbmv_thread_U, zsbmv_thread_L, +#else + csbmv_thread_U, csbmv_thread_L, +#endif +}; +#endif + +void NAME(char *UPLO, blasint *N, blasint *K, FLOAT *ALPHA, FLOAT *a, blasint *LDA, + FLOAT *b, blasint *INCX, FLOAT *BETA, FLOAT *c, blasint *INCY){ + + char uplo_arg = *UPLO; + blasint n = *N; + blasint k = *K; + FLOAT alpha_r = ALPHA[0]; + FLOAT alpha_i = ALPHA[1]; + blasint lda = *LDA; + blasint incx = *INCX; + FLOAT beta_r = BETA[0]; + FLOAT beta_i = BETA[1]; + blasint incy = *INCY; + + blasint info; + int uplo; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + uplo = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incy == 0) info = 11; + if (incx == 0) info = 8; + if (lda < k + 1) info = 6; + if (k < 0) info = 3; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + + if (n == 0) return; + + if ((beta_r != ONE) || (beta_i != ZERO)) SCAL_K(n, 0, 0, beta_r, beta_i, c, abs(incy), NULL, 0, NULL, 0); + + if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) b -= (n - 1) * incx * COMPSIZE; + if (incy < 0 ) c -= (n - 1) * incy * COMPSIZE; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (sbmv[uplo])(n, k, alpha_r, alpha_i, a, lda, b, incx, c, incy, buffer); + +#ifdef SMPTEST + } else { + + (sbmv_thread[uplo])(n, k, ALPHA, a, lda, b, incx, c, incy, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, n * k / 2 + n, n * k); + + IDEBUG_END; + + return; +} diff --git a/interface/zscal.c b/interface/zscal.c new file mode 100644 index 000000000..5c894d778 --- /dev/null +++ b/interface/zscal.c @@ -0,0 +1,117 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifndef CBLAS + +void NAME(blasint *N, FLOAT *ALPHA, FLOAT *x, blasint *INCX){ + + blasint n = *N; + blasint incx = *INCX; + +#ifndef SSCAL + FLOAT *alpha=ALPHA; +#else + FLOAT alpha[2] = {ALPHA[0], ZERO}; +#endif + +#else + +#ifndef SSCAL +void CNAME(blasint n, FLOAT *ALPHA, FLOAT *x, blasint incx){ + + FLOAT *alpha=ALPHA; +#else +void CNAME(blasint n, FLOAT alpha_r, FLOAT *x, blasint incx){ + + FLOAT alpha[2] = {alpha_r, ZERO}; +#endif +#endif + +#ifdef SMPTEST + int mode; + int nthreads; +#endif + +#ifndef CBLAS + PRINT_DEBUG_NAME; +#else + PRINT_DEBUG_CNAME; +#endif + + if (incx <= 0 || n <= 0) return; + + if ((alpha[0] == ONE) && (alpha[1] == ZERO)) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifdef SMPTEST + nthreads = num_cpu_avail(1); + + if (nthreads == 1) { +#endif + + SCAL_K(n, 0, 0, alpha[0], alpha[1], x, incx, NULL, 0, NULL, 0); + +#ifdef SMPTEST + } else { +#ifdef DOUBLE + mode = BLAS_DOUBLE | BLAS_COMPLEX; +#else + mode = BLAS_SINGLE | BLAS_COMPLEX; +#endif + + blas_level1_thread(mode, n, 0, 0, alpha, x, incx, NULL, 0, NULL, 0, (void *)SCAL_K, nthreads); + + } +#endif + + FUNCTION_PROFILE_END(4, n, n); + + IDEBUG_END; + + return; + +} diff --git a/interface/zspmv.c b/interface/zspmv.c new file mode 100644 index 000000000..65550872d --- /dev/null +++ b/interface/zspmv.c @@ -0,0 +1,154 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "ZSPMV " +#elif defined(DOUBLE) +#define ERROR_NAME "ZSPMV " +#else +#define ERROR_NAME "CSPMV " +#endif + +static int (*spmv[])(BLASLONG, FLOAT, FLOAT, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { +#ifdef XDOUBLE + xspmv_U, xspmv_L, +#elif defined(DOUBLE) + zspmv_U, zspmv_L, +#else + cspmv_U, cspmv_L, +#endif +}; + +#ifdef SMPTEST +static int (*spmv_thread[])(BLASLONG, FLOAT *, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { +#ifdef XDOUBLE + xspmv_thread_U, xspmv_thread_L, +#elif defined(DOUBLE) + zspmv_thread_U, zspmv_thread_L, +#else + cspmv_thread_U, cspmv_thread_L, +#endif +}; +#endif + +void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, + FLOAT *b, blasint *INCX, FLOAT *BETA, FLOAT *c, blasint *INCY){ + + char uplo_arg = *UPLO; + blasint n = *N; + FLOAT alpha_r = ALPHA[0]; + FLOAT alpha_i = ALPHA[1]; + blasint incx = *INCX; + FLOAT beta_r = BETA[0]; + FLOAT beta_i = BETA[1]; + blasint incy = *INCY; + + blasint info; + int uplo; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + uplo = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incy == 0) info = 9; + if (incx == 0) info = 6; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + + if (n == 0) return; + + if ((beta_r != ONE) || (beta_i != ZERO)) SCAL_K(n, 0, 0, beta_r, beta_i, c, abs(incy), NULL, 0, NULL, 0); + + if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) b -= (n - 1) * incx * COMPSIZE; + if (incy < 0 ) c -= (n - 1) * incy * COMPSIZE; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (spmv[uplo])(n, alpha_r, alpha_i, a, b, incx, c, incy, buffer); + +#ifdef SMPTEST + + } else { + + (spmv_thread[uplo])(n, ALPHA, a, b, incx, c, incy, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/zspr.c b/interface/zspr.c new file mode 100644 index 000000000..b38ccb5d6 --- /dev/null +++ b/interface/zspr.c @@ -0,0 +1,146 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XSPR " +#elif defined(DOUBLE) +#define ERROR_NAME "ZSPR " +#else +#define ERROR_NAME "CSPR " +#endif + +static int (*spr[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, FLOAT *) = { +#ifdef XDOUBLE + xspr_U, xspr_L, +#elif defined(DOUBLE) + zspr_U, zspr_L, +#else + cspr_U, cspr_L, +#endif +}; + +#ifdef SMPTEST +static int (*spr_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = { +#ifdef XDOUBLE + xspr_thread_U, xspr_thread_L, +#elif defined(DOUBLE) + zspr_thread_U, zspr_thread_L, +#else + cspr_thread_U, cspr_thread_L, +#endif +}; +#endif + +void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, + FLOAT *x, blasint *INCX, FLOAT *a){ + + char uplo_arg = *UPLO; + blasint n = *N; + FLOAT alpha_r = ALPHA[0]; + FLOAT alpha_i = ALPHA[1]; + blasint incx = *INCX; + + blasint info; + int uplo; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + uplo = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + + if (n == 0) return; + + if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (spr[uplo])(n, alpha_r, alpha_i, x, incx, a, buffer); + +#ifdef SMPTEST + } else { + + (spr_thread[uplo])(n, ALPHA, x, incx, a, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/zspr2.c b/interface/zspr2.c new file mode 100644 index 000000000..085e8bb7f --- /dev/null +++ b/interface/zspr2.c @@ -0,0 +1,149 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XSPR2 " +#elif defined(DOUBLE) +#define ERROR_NAME "ZSPR2 " +#else +#define ERROR_NAME "CSPR2 " +#endif + +static int (*spr2[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, FLOAT *) = { +#ifdef XDOUBLE + xspr2_U, xspr2_L, +#elif defined(DOUBLE) + zspr2_U, zspr2_L, +#else + cspr2_U, cspr2_L, +#endif +}; + +#ifdef SMPTEST +static int (*spr2_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = { +#ifdef XDOUBLE + xspr2_thread_U, xspr2_thread_L, +#elif defined(DOUBLE) + zspr2_thread_U, zspr2_thread_L, +#else + cspr2_thread_U, cspr2_thread_L, +#endif +}; +#endif + +void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, + FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *a){ + + char uplo_arg = *UPLO; + blasint n = *N; + FLOAT alpha_r = ALPHA[0]; + FLOAT alpha_i = ALPHA[1]; + blasint incx = *INCX; + blasint incy = *INCY; + + blasint info; + int uplo; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + uplo = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incy == 0) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + + if (n == 0) return; + + if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx; + if (incy < 0 ) y -= (n - 1) * incy; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (spr2[uplo])(n, alpha_r, alpha_i, x, incx, y, incy, a, buffer); + +#ifdef SMPTEST + } else { + + (spr2_thread[uplo])(n, ALPHA, x, incx, y, incy, a, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, n * n / 2 + 2 * n, 2 * n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/zswap.c b/interface/zswap.c new file mode 100644 index 000000000..ef35f107f --- /dev/null +++ b/interface/zswap.c @@ -0,0 +1,116 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifndef CBLAS + +void NAME(blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){ + + blasint n = *N; + blasint incx = *INCX; + blasint incy = *INCY; + +#else + +void CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy){ + +#endif + +#ifdef SMPTEST + int mode; + FLOAT dummyalpha[2] = {ZERO, ZERO}; + int nthreads; +#endif + +#ifndef CBLAS + PRINT_DEBUG_NAME; +#else + PRINT_DEBUG_CNAME; +#endif + + if (n <= 0) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0) x -= (n - 1) * incx * 2; + if (incy < 0) y -= (n - 1) * incy * 2; + +#ifdef SMPTEST + nthreads = num_cpu_avail(1); + + //disable multi-thread when incx==0 or incy==0 + //In that case, the threads would be dependent. + if (incx == 0 || incy == 0) + nthreads = 1; + + if (nthreads == 1) { +#endif + + SWAP_K(n, 0, 0, ZERO, ZERO, x, incx, y, incy, NULL, 0); + +#ifdef SMPTEST + } else { + +#ifdef XDOUBLE + mode = BLAS_XDOUBLE | BLAS_COMPLEX; +#elif defined(DOUBLE) + mode = BLAS_DOUBLE | BLAS_COMPLEX; +#else + mode = BLAS_SINGLE | BLAS_COMPLEX; +#endif + + blas_level1_thread(mode, n, 0, 0, dummyalpha, + x, incx, y, incy, NULL, 0, (void *)SWAP_K, nthreads); + + } +#endif + + FUNCTION_PROFILE_END(2, 2 * n, 0); + + IDEBUG_END; + + return; + +} diff --git a/interface/zsymv.c b/interface/zsymv.c new file mode 100644 index 000000000..15bceeebe --- /dev/null +++ b/interface/zsymv.c @@ -0,0 +1,143 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XSYMV " +#elif defined(DOUBLE) +#define ERROR_NAME "ZSYMV " +#else +#define ERROR_NAME "CSYMV " +#endif + +void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, blasint *LDA, + FLOAT *b, blasint *INCX, FLOAT *BETA, FLOAT *c, blasint *INCY){ + + char uplo_arg = *UPLO; + blasint n = *N; + FLOAT alpha_r = ALPHA[0]; + FLOAT alpha_i = ALPHA[1]; + blasint lda = *LDA; + blasint incx = *INCX; + FLOAT beta_r = BETA[0]; + FLOAT beta_i = BETA[1]; + blasint incy = *INCY; + + int (*symv[])(BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { + SYMV_U, SYMV_L, + }; + +#ifdef SMPTEST + int (*symv_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { + SYMV_THREAD_U, SYMV_THREAD_L, + }; +#endif + + blasint info; + int uplo; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + uplo = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incy == 0) info = 10; + if (incx == 0) info = 7; + if (lda < MAX(1, n)) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + + if (n == 0) return; + + if ((beta_r != ONE) || (beta_i != ZERO)) SCAL_K(n, 0, 0, beta_r, beta_i, c, abs(incy), NULL, 0, NULL, 0); + + if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) b -= (n - 1) * incx * COMPSIZE; + if (incy < 0 ) c -= (n - 1) * incy * COMPSIZE; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (symv[uplo])(n, n, alpha_r, alpha_i, a, lda, b, incx, c, incy, buffer); + +#ifdef SMPTEST + } else { + + (symv_thread[uplo])(n, ALPHA, a, lda, b, incx, c, incy, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, n * n / 2 + 2 * n, 2 * n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/zsyr.c b/interface/zsyr.c new file mode 100644 index 000000000..d15801cdc --- /dev/null +++ b/interface/zsyr.c @@ -0,0 +1,203 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XSYR " +#elif defined(DOUBLE) +#define ERROR_NAME "ZSYR " +#else +#define ERROR_NAME "CSYR " +#endif + +static int (*syr[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { +#ifdef XDOUBLE + xsyr_U, xsyr_L, +#elif defined(DOUBLE) + zsyr_U, zsyr_L, +#else + csyr_U, csyr_L, +#endif +}; + +#ifdef SMPTEST +static int (*syr_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { +#ifdef XDOUBLE + xsyr_thread_U, xsyr_thread_L, +#elif defined(DOUBLE) + zsyr_thread_U, zsyr_thread_L, +#else + csyr_thread_U, csyr_thread_L, +#endif +}; +#endif + + +#ifndef CBLAS + +void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, + FLOAT *x, blasint *INCX, FLOAT *a, blasint *LDA){ + + char uplo_arg = *UPLO; + blasint n = *N; + FLOAT alpha_r = ALPHA[0]; + FLOAT alpha_i = ALPHA[1]; + blasint lda = *LDA; + blasint incx = *INCX; + + blasint info; + int uplo; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + uplo = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (lda < MAX(1, n)) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, int n, FLOAT alpha, FLOAT *x, int incx, FLOAT *a, int lda) { + + FLOAT *buffer; + int trans, uplo; + blasint info; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_CNAME; + + trans = -1; + uplo = -1; + info = 0; + + if (order == CblasColMajor) { + + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + info = -1; + + if (lda < MAX(1, n)) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + } + + if (order == CblasRowMajor) { + + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + info = -1; + + if (lda < MAX(1, n)) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (syr[uplo])(n, alpha_r, alpha_i, x, incx, a, lda, buffer); + +#ifdef SMPTEST + } else { + + (syr_thread[uplo])(n, ALPHA, x, incx, a, lda, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/zsyr2.c b/interface/zsyr2.c new file mode 100644 index 000000000..bb7e2e191 --- /dev/null +++ b/interface/zsyr2.c @@ -0,0 +1,151 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QSYR2 " +#elif defined(DOUBLE) +#define ERROR_NAME "ZSYR2 " +#else +#define ERROR_NAME "CSYR2 " +#endif + +static int (*syr2[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { +#ifdef XDOUBLE + xsyr2_U, xsyr2_L, +#elif defined(DOUBLE) + zsyr2_U, zsyr2_L, +#else + csyr2_U, csyr2_L, +#endif +}; + +#ifdef SMPTEST +static int (*syr2_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { +#ifdef XDOUBLE + xsyr2_thread_U, xsyr2_thread_L, +#elif defined(DOUBLE) + zsyr2_thread_U, zsyr2_thread_L, +#else + csyr2_thread_U, csyr2_thread_L, +#endif +}; +#endif + +void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, + FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *a, blasint *LDA){ + + char uplo_arg = *UPLO; + blasint n = *N; + FLOAT alpha_r = ALPHA[0]; + FLOAT alpha_i = ALPHA[1]; + blasint lda = *LDA; + blasint incx = *INCX; + blasint incy = *INCY; + + blasint info; + int uplo; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + uplo = -1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (lda < MAX(1, n)) info = 9; + if (incy == 0) info = 7; + if (incx == 0) info = 5; + if (n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + + if (n == 0) return; + + if ((alpha_r == ZERO) && (alpha_i == ZERO)) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx; + if (incy < 0 ) y -= (n - 1) * incy; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (syr2[uplo])(n, alpha_r, alpha_i, x, incx, y, incy, a, lda, buffer); + +#ifdef SMPTEST + } else { + + (syr2_thread[uplo])(n, ALPHA, x, incx, y, incy, a, lda, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, n * n / 2 + 2 * n, 2 * n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/ztbmv.c b/interface/ztbmv.c new file mode 100644 index 000000000..fb8873bc0 --- /dev/null +++ b/interface/ztbmv.c @@ -0,0 +1,260 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XTBMV " +#elif defined(DOUBLE) +#define ERROR_NAME "ZTBMV " +#else +#define ERROR_NAME "CTBMV " +#endif + +static int (*tbmv[])(BLASLONG, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { +#ifdef XDOUBLE + xtbmv_NUU, xtbmv_NUN, xtbmv_NLU, xtbmv_NLN, + xtbmv_TUU, xtbmv_TUN, xtbmv_TLU, xtbmv_TLN, + xtbmv_RUU, xtbmv_RUN, xtbmv_RLU, xtbmv_RLN, + xtbmv_CUU, xtbmv_CUN, xtbmv_CLU, xtbmv_CLN, +#elif defined(DOUBLE) + ztbmv_NUU, ztbmv_NUN, ztbmv_NLU, ztbmv_NLN, + ztbmv_TUU, ztbmv_TUN, ztbmv_TLU, ztbmv_TLN, + ztbmv_RUU, ztbmv_RUN, ztbmv_RLU, ztbmv_RLN, + ztbmv_CUU, ztbmv_CUN, ztbmv_CLU, ztbmv_CLN, +#else + ctbmv_NUU, ctbmv_NUN, ctbmv_NLU, ctbmv_NLN, + ctbmv_TUU, ctbmv_TUN, ctbmv_TLU, ctbmv_TLN, + ctbmv_RUU, ctbmv_RUN, ctbmv_RLU, ctbmv_RLN, + ctbmv_CUU, ctbmv_CUN, ctbmv_CLU, ctbmv_CLN, +#endif +}; + +#ifdef SMPTEST +static int (*tbmv_thread[])(BLASLONG, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { +#ifdef XDOUBLE + xtbmv_thread_NUU, xtbmv_thread_NUN, xtbmv_thread_NLU, xtbmv_thread_NLN, + xtbmv_thread_TUU, xtbmv_thread_TUN, xtbmv_thread_TLU, xtbmv_thread_TLN, + xtbmv_thread_RUU, xtbmv_thread_RUN, xtbmv_thread_RLU, xtbmv_thread_RLN, + xtbmv_thread_CUU, xtbmv_thread_CUN, xtbmv_thread_CLU, xtbmv_thread_CLN, +#elif defined(DOUBLE) + ztbmv_thread_NUU, ztbmv_thread_NUN, ztbmv_thread_NLU, ztbmv_thread_NLN, + ztbmv_thread_TUU, ztbmv_thread_TUN, ztbmv_thread_TLU, ztbmv_thread_TLN, + ztbmv_thread_RUU, ztbmv_thread_RUN, ztbmv_thread_RLU, ztbmv_thread_RLN, + ztbmv_thread_CUU, ztbmv_thread_CUN, ztbmv_thread_CLU, ztbmv_thread_CLN, +#else + ctbmv_thread_NUU, ctbmv_thread_NUN, ctbmv_thread_NLU, ctbmv_thread_NLN, + ctbmv_thread_TUU, ctbmv_thread_TUN, ctbmv_thread_TLU, ctbmv_thread_TLN, + ctbmv_thread_RUU, ctbmv_thread_RUN, ctbmv_thread_RLU, ctbmv_thread_RLN, + ctbmv_thread_CUU, ctbmv_thread_CUN, ctbmv_thread_CLU, ctbmv_thread_CLN, +#endif +}; +#endif + +#ifndef CBLAS + +void NAME(char *UPLO, char *TRANS, char *DIAG, + blasint *N, blasint *K, + FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){ + + char uplo_arg = *UPLO; + char trans_arg = *TRANS; + char diag_arg = *DIAG; + + blasint n = *N; + blasint k = *K; + blasint lda = *LDA; + blasint incx = *INCX; + + blasint info; + int uplo; + int unit; + int trans; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + TOUPPER(trans_arg); + TOUPPER(diag_arg); + + trans = -1; + unit = -1; + uplo = -1; + + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'T') trans = 1; + if (trans_arg == 'R') trans = 2; + if (trans_arg == 'C') trans = 3; + + if (diag_arg == 'U') unit = 0; + if (diag_arg == 'N') unit = 1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incx == 0) info = 9; + if (lda < k + 1) info = 7; + if (k < 0) info = 5; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, + enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, + blasint n, blasint k, FLOAT *a, blasint lda, FLOAT *x, blasint incx) { + + int trans, uplo, unit; + blasint info; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_CNAME; + + unit = -1; + uplo = -1; + trans = -1; + info = 0; + + if (order == CblasColMajor) { + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + if (TransA == CblasNoTrans) trans = 0; + if (TransA == CblasTrans) trans = 1; + if (TransA == CblasConjNoTrans) trans = 2; + if (TransA == CblasConjTrans) trans = 3; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 9; + if (lda < k + 1) info = 7; + if (k < 0) info = 5; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + if (TransA == CblasNoTrans) trans = 1; + if (TransA == CblasTrans) trans = 0; + if (TransA == CblasConjNoTrans) trans = 3; + if (TransA == CblasConjTrans) trans = 2; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 9; + if (lda < k + 1) info = 7; + if (k < 0) info = 5; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx * 2; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (tbmv[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer); + +#ifdef SMPTEST + } else { + + (tbmv_thread[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, n * k / 2 + n, n * k); + + IDEBUG_END; + + return; +} diff --git a/interface/ztbsv.c b/interface/ztbsv.c new file mode 100644 index 000000000..3846a4b3d --- /dev/null +++ b/interface/ztbsv.c @@ -0,0 +1,219 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XTBSV " +#elif defined(DOUBLE) +#define ERROR_NAME "ZTBSV " +#else +#define ERROR_NAME "CTBSV " +#endif + +static int (*tbsv[])(BLASLONG, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { +#ifdef XDOUBLE + xtbsv_NUU, xtbsv_NUN, xtbsv_NLU, xtbsv_NLN, + xtbsv_TUU, xtbsv_TUN, xtbsv_TLU, xtbsv_TLN, + xtbsv_RUU, xtbsv_RUN, xtbsv_RLU, xtbsv_RLN, + xtbsv_CUU, xtbsv_CUN, xtbsv_CLU, xtbsv_CLN, +#elif defined(DOUBLE) + ztbsv_NUU, ztbsv_NUN, ztbsv_NLU, ztbsv_NLN, + ztbsv_TUU, ztbsv_TUN, ztbsv_TLU, ztbsv_TLN, + ztbsv_RUU, ztbsv_RUN, ztbsv_RLU, ztbsv_RLN, + ztbsv_CUU, ztbsv_CUN, ztbsv_CLU, ztbsv_CLN, +#else + ctbsv_NUU, ctbsv_NUN, ctbsv_NLU, ctbsv_NLN, + ctbsv_TUU, ctbsv_TUN, ctbsv_TLU, ctbsv_TLN, + ctbsv_RUU, ctbsv_RUN, ctbsv_RLU, ctbsv_RLN, + ctbsv_CUU, ctbsv_CUN, ctbsv_CLU, ctbsv_CLN, +#endif +}; + +#ifndef CBLAS + +void NAME(char *UPLO, char *TRANS, char *DIAG, + blasint *N, blasint *K, + FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){ + + char uplo_arg = *UPLO; + char trans_arg = *TRANS; + char diag_arg = *DIAG; + + blasint n = *N; + blasint k = *K; + blasint lda = *LDA; + blasint incx = *INCX; + + blasint info; + int uplo; + int unit; + int trans; + FLOAT *buffer; + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + TOUPPER(trans_arg); + TOUPPER(diag_arg); + + trans = -1; + unit = -1; + uplo = -1; + + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'T') trans = 1; + if (trans_arg == 'R') trans = 2; + if (trans_arg == 'C') trans = 3; + + if (diag_arg == 'U') unit = 0; + if (diag_arg == 'N') unit = 1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incx == 0) info = 9; + if (lda < k + 1) info = 7; + if (k < 0) info = 5; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, + enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, + blasint n, blasint k, FLOAT *a, blasint lda, FLOAT *x, blasint incx) { + + int trans, uplo, unit; + blasint info; + FLOAT *buffer; + + PRINT_DEBUG_CNAME; + + unit = -1; + uplo = -1; + trans = -1; + info = 0; + + if (order == CblasColMajor) { + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + if (TransA == CblasNoTrans) trans = 0; + if (TransA == CblasTrans) trans = 1; + if (TransA == CblasConjNoTrans) trans = 2; + if (TransA == CblasConjTrans) trans = 3; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 9; + if (lda < k + 1) info = 7; + if (k < 0) info = 5; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + if (TransA == CblasNoTrans) trans = 1; + if (TransA == CblasTrans) trans = 0; + if (TransA == CblasConjNoTrans) trans = 3; + if (TransA == CblasConjTrans) trans = 2; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 9; + if (lda < k + 1) info = 7; + if (k < 0) info = 5; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx * 2; + + buffer = (FLOAT *)blas_memory_alloc(1); + + (tbsv[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer); + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, n * k / 2 + n, n * k); + + IDEBUG_END; + + return; +} diff --git a/interface/ztpmv.c b/interface/ztpmv.c new file mode 100644 index 000000000..2f7fe3b63 --- /dev/null +++ b/interface/ztpmv.c @@ -0,0 +1,252 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XTPMV " +#elif defined(DOUBLE) +#define ERROR_NAME "ZTPMV " +#else +#define ERROR_NAME "CTPMV " +#endif + +static int (*tpmv[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, void *) = { +#ifdef XDOUBLE + xtpmv_NUU, xtpmv_NUN, xtpmv_NLU, xtpmv_NLN, + xtpmv_TUU, xtpmv_TUN, xtpmv_TLU, xtpmv_TLN, + xtpmv_RUU, xtpmv_RUN, xtpmv_RLU, xtpmv_RLN, + xtpmv_CUU, xtpmv_CUN, xtpmv_CLU, xtpmv_CLN, +#elif defined(DOUBLE) + ztpmv_NUU, ztpmv_NUN, ztpmv_NLU, ztpmv_NLN, + ztpmv_TUU, ztpmv_TUN, ztpmv_TLU, ztpmv_TLN, + ztpmv_RUU, ztpmv_RUN, ztpmv_RLU, ztpmv_RLN, + ztpmv_CUU, ztpmv_CUN, ztpmv_CLU, ztpmv_CLN, +#else + ctpmv_NUU, ctpmv_NUN, ctpmv_NLU, ctpmv_NLN, + ctpmv_TUU, ctpmv_TUN, ctpmv_TLU, ctpmv_TLN, + ctpmv_RUU, ctpmv_RUN, ctpmv_RLU, ctpmv_RLN, + ctpmv_CUU, ctpmv_CUN, ctpmv_CLU, ctpmv_CLN, +#endif +}; + +#ifdef SMPTEST +static int (*tpmv_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, int) = { +#ifdef XDOUBLE + xtpmv_thread_NUU, xtpmv_thread_NUN, xtpmv_thread_NLU, xtpmv_thread_NLN, + xtpmv_thread_TUU, xtpmv_thread_TUN, xtpmv_thread_TLU, xtpmv_thread_TLN, + xtpmv_thread_RUU, xtpmv_thread_RUN, xtpmv_thread_RLU, xtpmv_thread_RLN, + xtpmv_thread_CUU, xtpmv_thread_CUN, xtpmv_thread_CLU, xtpmv_thread_CLN, +#elif defined(DOUBLE) + ztpmv_thread_NUU, ztpmv_thread_NUN, ztpmv_thread_NLU, ztpmv_thread_NLN, + ztpmv_thread_TUU, ztpmv_thread_TUN, ztpmv_thread_TLU, ztpmv_thread_TLN, + ztpmv_thread_RUU, ztpmv_thread_RUN, ztpmv_thread_RLU, ztpmv_thread_RLN, + ztpmv_thread_CUU, ztpmv_thread_CUN, ztpmv_thread_CLU, ztpmv_thread_CLN, +#else + ctpmv_thread_NUU, ctpmv_thread_NUN, ctpmv_thread_NLU, ctpmv_thread_NLN, + ctpmv_thread_TUU, ctpmv_thread_TUN, ctpmv_thread_TLU, ctpmv_thread_TLN, + ctpmv_thread_RUU, ctpmv_thread_RUN, ctpmv_thread_RLU, ctpmv_thread_RLN, + ctpmv_thread_CUU, ctpmv_thread_CUN, ctpmv_thread_CLU, ctpmv_thread_CLN, +#endif +}; +#endif + +#ifndef CBLAS + +void NAME(char *UPLO, char *TRANS, char *DIAG, + blasint *N, FLOAT *a, FLOAT *x, blasint *INCX){ + + char uplo_arg = *UPLO; + char trans_arg = *TRANS; + char diag_arg = *DIAG; + + blasint n = *N; + blasint incx = *INCX; + + blasint info; + int uplo; + int unit; + int trans; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + TOUPPER(trans_arg); + TOUPPER(diag_arg); + + trans = -1; + unit = -1; + uplo = -1; + + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'T') trans = 1; + if (trans_arg == 'R') trans = 2; + if (trans_arg == 'C') trans = 3; + + if (diag_arg == 'U') unit = 0; + if (diag_arg == 'N') unit = 1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incx == 0) info = 7; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, + enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, + blasint n, FLOAT *a, FLOAT *x, blasint incx) { + + int trans, uplo, unit; + blasint info; + FLOAT *buffer; + + PRINT_DEBUG_CNAME; + + unit = -1; + uplo = -1; + trans = -1; + info = 0; +#ifdef SMPTEST + int nthreads; +#endif + + if (order == CblasColMajor) { + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + if (TransA == CblasNoTrans) trans = 0; + if (TransA == CblasTrans) trans = 1; + if (TransA == CblasConjNoTrans) trans = 2; + if (TransA == CblasConjTrans) trans = 3; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 7; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + if (TransA == CblasNoTrans) trans = 1; + if (TransA == CblasTrans) trans = 0; + if (TransA == CblasConjNoTrans) trans = 3; + if (TransA == CblasConjTrans) trans = 2; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 7; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx * 2; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (tpmv[(trans<<2) | (uplo<<1) | unit])(n, a, x, incx, buffer); + +#ifdef SMPTEST + + } else { + + (tpmv_thread[(trans<<2) | (uplo<<1) | unit])(n, a, x, incx, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/ztpsv.c b/interface/ztpsv.c new file mode 100644 index 000000000..fde500e37 --- /dev/null +++ b/interface/ztpsv.c @@ -0,0 +1,210 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XTPSV " +#elif defined(DOUBLE) +#define ERROR_NAME "ZTPSV " +#else +#define ERROR_NAME "CTPSV " +#endif + +static int (*tpsv[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, void *) = { +#ifdef XDOUBLE + xtpsv_NUU, xtpsv_NUN, xtpsv_NLU, xtpsv_NLN, + xtpsv_TUU, xtpsv_TUN, xtpsv_TLU, xtpsv_TLN, + xtpsv_RUU, xtpsv_RUN, xtpsv_RLU, xtpsv_RLN, + xtpsv_CUU, xtpsv_CUN, xtpsv_CLU, xtpsv_CLN, +#elif defined(DOUBLE) + ztpsv_NUU, ztpsv_NUN, ztpsv_NLU, ztpsv_NLN, + ztpsv_TUU, ztpsv_TUN, ztpsv_TLU, ztpsv_TLN, + ztpsv_RUU, ztpsv_RUN, ztpsv_RLU, ztpsv_RLN, + ztpsv_CUU, ztpsv_CUN, ztpsv_CLU, ztpsv_CLN, +#else + ctpsv_NUU, ctpsv_NUN, ctpsv_NLU, ctpsv_NLN, + ctpsv_TUU, ctpsv_TUN, ctpsv_TLU, ctpsv_TLN, + ctpsv_RUU, ctpsv_RUN, ctpsv_RLU, ctpsv_RLN, + ctpsv_CUU, ctpsv_CUN, ctpsv_CLU, ctpsv_CLN, +#endif +}; + +#ifndef CBLAS + +void NAME(char *UPLO, char *TRANS, char *DIAG, + blasint *N, FLOAT *a, FLOAT *x, blasint *INCX){ + + char uplo_arg = *UPLO; + char trans_arg = *TRANS; + char diag_arg = *DIAG; + + blasint n = *N; + blasint incx = *INCX; + + blasint info; + int uplo; + int unit; + int trans; + FLOAT *buffer; + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + TOUPPER(trans_arg); + TOUPPER(diag_arg); + + trans = -1; + unit = -1; + uplo = -1; + + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'T') trans = 1; + if (trans_arg == 'R') trans = 2; + if (trans_arg == 'C') trans = 3; + + if (diag_arg == 'U') unit = 0; + if (diag_arg == 'N') unit = 1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incx == 0) info = 7; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, + enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, + blasint n, FLOAT *a, FLOAT *x, blasint incx) { + + int trans, uplo, unit; + blasint info; + FLOAT *buffer; + + PRINT_DEBUG_CNAME; + + unit = -1; + uplo = -1; + trans = -1; + info = 0; + + if (order == CblasColMajor) { + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + if (TransA == CblasNoTrans) trans = 0; + if (TransA == CblasTrans) trans = 1; + if (TransA == CblasConjNoTrans) trans = 2; + if (TransA == CblasConjTrans) trans = 3; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 7; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + if (TransA == CblasNoTrans) trans = 1; + if (TransA == CblasTrans) trans = 0; + if (TransA == CblasConjNoTrans) trans = 3; + if (TransA == CblasConjTrans) trans = 2; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 7; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx * 2; + + buffer = (FLOAT *)blas_memory_alloc(1); + + (tpsv[(trans<<2) | (uplo<<1) | unit])(n, a, x, incx, buffer); + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/ztrmv.c b/interface/ztrmv.c new file mode 100644 index 000000000..1ebee3ab8 --- /dev/null +++ b/interface/ztrmv.c @@ -0,0 +1,255 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XTRMV " +#elif defined(DOUBLE) +#define ERROR_NAME "ZTRMV " +#else +#define ERROR_NAME "CTRMV " +#endif + +static int (*trmv[])(BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { +#ifdef XDOUBLE + xtrmv_NUU, xtrmv_NUN, xtrmv_NLU, xtrmv_NLN, + xtrmv_TUU, xtrmv_TUN, xtrmv_TLU, xtrmv_TLN, + xtrmv_RUU, xtrmv_RUN, xtrmv_RLU, xtrmv_RLN, + xtrmv_CUU, xtrmv_CUN, xtrmv_CLU, xtrmv_CLN, +#elif defined(DOUBLE) + ztrmv_NUU, ztrmv_NUN, ztrmv_NLU, ztrmv_NLN, + ztrmv_TUU, ztrmv_TUN, ztrmv_TLU, ztrmv_TLN, + ztrmv_RUU, ztrmv_RUN, ztrmv_RLU, ztrmv_RLN, + ztrmv_CUU, ztrmv_CUN, ztrmv_CLU, ztrmv_CLN, +#else + ctrmv_NUU, ctrmv_NUN, ctrmv_NLU, ctrmv_NLN, + ctrmv_TUU, ctrmv_TUN, ctrmv_TLU, ctrmv_TLN, + ctrmv_RUU, ctrmv_RUN, ctrmv_RLU, ctrmv_RLN, + ctrmv_CUU, ctrmv_CUN, ctrmv_CLU, ctrmv_CLN, +#endif +}; + +#ifdef SMPTEST +static int (*trmv_thread[])(BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { +#ifdef XDOUBLE + xtrmv_thread_NUU, xtrmv_thread_NUN, xtrmv_thread_NLU, xtrmv_thread_NLN, + xtrmv_thread_TUU, xtrmv_thread_TUN, xtrmv_thread_TLU, xtrmv_thread_TLN, + xtrmv_thread_RUU, xtrmv_thread_RUN, xtrmv_thread_RLU, xtrmv_thread_RLN, + xtrmv_thread_CUU, xtrmv_thread_CUN, xtrmv_thread_CLU, xtrmv_thread_CLN, +#elif defined(DOUBLE) + ztrmv_thread_NUU, ztrmv_thread_NUN, ztrmv_thread_NLU, ztrmv_thread_NLN, + ztrmv_thread_TUU, ztrmv_thread_TUN, ztrmv_thread_TLU, ztrmv_thread_TLN, + ztrmv_thread_RUU, ztrmv_thread_RUN, ztrmv_thread_RLU, ztrmv_thread_RLN, + ztrmv_thread_CUU, ztrmv_thread_CUN, ztrmv_thread_CLU, ztrmv_thread_CLN, +#else + ctrmv_thread_NUU, ctrmv_thread_NUN, ctrmv_thread_NLU, ctrmv_thread_NLN, + ctrmv_thread_TUU, ctrmv_thread_TUN, ctrmv_thread_TLU, ctrmv_thread_TLN, + ctrmv_thread_RUU, ctrmv_thread_RUN, ctrmv_thread_RLU, ctrmv_thread_RLN, + ctrmv_thread_CUU, ctrmv_thread_CUN, ctrmv_thread_CLU, ctrmv_thread_CLN, +#endif +}; +#endif + +#ifndef CBLAS + +void NAME(char *UPLO, char *TRANS, char *DIAG, + blasint *N, FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){ + + char uplo_arg = *UPLO; + char trans_arg = *TRANS; + char diag_arg = *DIAG; + + blasint n = *N; + blasint lda = *LDA; + blasint incx = *INCX; + + blasint info; + int uplo; + int unit; + int trans; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + TOUPPER(trans_arg); + TOUPPER(diag_arg); + + trans = -1; + unit = -1; + uplo = -1; + + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'T') trans = 1; + if (trans_arg == 'R') trans = 2; + if (trans_arg == 'C') trans = 3; + + if (diag_arg == 'U') unit = 0; + if (diag_arg == 'N') unit = 1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + + if (incx == 0) info = 8; + if (lda < MAX(1, n)) info = 6; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, + enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, + blasint n, FLOAT *a, blasint lda, FLOAT *x, blasint incx) { + + int trans, uplo, unit; + blasint info; + FLOAT *buffer; +#ifdef SMPTEST + int nthreads; +#endif + + PRINT_DEBUG_CNAME; + + unit = -1; + uplo = -1; + trans = -1; + info = 0; + + if (order == CblasColMajor) { + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + if (TransA == CblasNoTrans) trans = 0; + if (TransA == CblasTrans) trans = 1; + if (TransA == CblasConjNoTrans) trans = 2; + if (TransA == CblasConjTrans) trans = 3; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 8; + if (lda < MAX(1, n)) info = 6; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + if (TransA == CblasNoTrans) trans = 1; + if (TransA == CblasTrans) trans = 0; + if (TransA == CblasConjNoTrans) trans = 3; + if (TransA == CblasConjTrans) trans = 2; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 8; + if (lda < MAX(1, n)) info = 6; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx * 2; + + buffer = (FLOAT *)blas_memory_alloc(1); + +#ifdef SMPTEST + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (trmv[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer); + +#ifdef SMPTEST + } else { + + (trmv_thread[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer, nthreads); + + } +#endif + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/ztrsv.c b/interface/ztrsv.c new file mode 100644 index 000000000..08f7dc68c --- /dev/null +++ b/interface/ztrsv.c @@ -0,0 +1,216 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XTRSV " +#elif defined(DOUBLE) +#define ERROR_NAME "ZTRSV " +#else +#define ERROR_NAME "CTRSV " +#endif + +static int (*trsv[])(BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = { +#ifdef XDOUBLE + xtrsv_NUU, xtrsv_NUN, xtrsv_NLU, xtrsv_NLN, + xtrsv_TUU, xtrsv_TUN, xtrsv_TLU, xtrsv_TLN, + xtrsv_RUU, xtrsv_RUN, xtrsv_RLU, xtrsv_RLN, + xtrsv_CUU, xtrsv_CUN, xtrsv_CLU, xtrsv_CLN, +#elif defined(DOUBLE) + ztrsv_NUU, ztrsv_NUN, ztrsv_NLU, ztrsv_NLN, + ztrsv_TUU, ztrsv_TUN, ztrsv_TLU, ztrsv_TLN, + ztrsv_RUU, ztrsv_RUN, ztrsv_RLU, ztrsv_RLN, + ztrsv_CUU, ztrsv_CUN, ztrsv_CLU, ztrsv_CLN, +#else + ctrsv_NUU, ctrsv_NUN, ctrsv_NLU, ctrsv_NLN, + ctrsv_TUU, ctrsv_TUN, ctrsv_TLU, ctrsv_TLN, + ctrsv_RUU, ctrsv_RUN, ctrsv_RLU, ctrsv_RLN, + ctrsv_CUU, ctrsv_CUN, ctrsv_CLU, ctrsv_CLN, +#endif +}; + +#ifndef CBLAS + +void NAME(char *UPLO, char *TRANS, char *DIAG, + blasint *N, FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){ + + char uplo_arg = *UPLO; + char trans_arg = *TRANS; + char diag_arg = *DIAG; + + blasint n = *N; + blasint lda = *LDA; + blasint incx = *INCX; + + blasint info; + int uplo; + int unit; + int trans; + FLOAT *buffer; + + PRINT_DEBUG_NAME; + + TOUPPER(uplo_arg); + TOUPPER(trans_arg); + TOUPPER(diag_arg); + + trans = -1; + unit = -1; + uplo = -1; + + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'T') trans = 1; + if (trans_arg == 'R') trans = 2; + if (trans_arg == 'C') trans = 3; + + if (diag_arg == 'U') unit = 0; + if (diag_arg == 'N') unit = 1; + + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + + info = 0; + + if (incx == 0) info = 8; + if (lda < MAX(1, n)) info = 6; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + + +#else + +void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, + enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, + blasint n, FLOAT *a, blasint lda, FLOAT *x, blasint incx) { + + int trans, uplo, unit; + blasint info; + FLOAT *buffer; + + PRINT_DEBUG_CNAME; + + unit = -1; + uplo = -1; + trans = -1; + info = 0; + + if (order == CblasColMajor) { + if (Uplo == CblasUpper) uplo = 0; + if (Uplo == CblasLower) uplo = 1; + + if (TransA == CblasNoTrans) trans = 0; + if (TransA == CblasTrans) trans = 1; + if (TransA == CblasConjNoTrans) trans = 2; + if (TransA == CblasConjTrans) trans = 3; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 8; + if (lda < MAX(1, n)) info = 6; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (order == CblasRowMajor) { + if (Uplo == CblasUpper) uplo = 1; + if (Uplo == CblasLower) uplo = 0; + + if (TransA == CblasNoTrans) trans = 1; + if (TransA == CblasTrans) trans = 0; + if (TransA == CblasConjNoTrans) trans = 3; + if (TransA == CblasConjTrans) trans = 2; + + if (Diag == CblasUnit) unit = 0; + if (Diag == CblasNonUnit) unit = 1; + + info = -1; + + if (incx == 0) info = 8; + if (lda < MAX(1, n)) info = 6; + if (n < 0) info = 4; + if (unit < 0) info = 3; + if (trans < 0) info = 2; + if (uplo < 0) info = 1; + } + + if (info >= 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return; + } + +#endif + + if (n == 0) return; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + if (incx < 0 ) x -= (n - 1) * incx * 2; + + buffer = (FLOAT *)blas_memory_alloc(1); + + (trsv[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer); + + blas_memory_free(buffer); + + FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n); + + IDEBUG_END; + + return; +} diff --git a/interface/ztrti2.c b/interface/ztrti2.c new file mode 100644 index 000000000..017374c37 --- /dev/null +++ b/interface/ztrti2.c @@ -0,0 +1,134 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XTRTI2" +#elif defined(DOUBLE) +#define ERROR_NAME "ZTRTI2" +#else +#define ERROR_NAME "CTRTI2" +#endif + +static blasint (*trti2[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { +#ifdef XDOUBLE + xtrti2_UU, xtrti2_UN, xtrti2_LU, xtrti2_LN, +#elif defined(DOUBLE) + ztrti2_UU, ztrti2_UN, ztrti2_LU, ztrti2_LN, +#else + ctrti2_UU, ctrti2_UN, ctrti2_LU, ctrti2_LN, +#endif + }; + +int NAME(char *UPLO, char *DIAG, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ + + blas_arg_t args; + + blasint uplo_arg = *UPLO; + blasint diag_arg = *DIAG; + blasint uplo, diag; + blasint info; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.n = *N; + args.a = (void *)a; + args.lda = *ldA; + + TOUPPER(uplo_arg); + TOUPPER(diag_arg); + + uplo = -1; + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + diag = -1; + if (diag_arg == 'U') diag = 0; + if (diag_arg == 'N') diag = 1; + + info = 0; + if (args.lda < MAX(1,args.n)) info = 5; + if (args.n < 0) info = 3; + if (diag < 0) info = 2; + if (uplo < 0) info = 1; + if (info) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + *Info = - info; + return 0; + } + + *Info = 0; + + if (args.n <= 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + + info = (trti2[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0); + + *Info = info; + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(1, .5 * args.n * args.n, + 2. * args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) + + 6. * args.n * (1./3. + args.n * (-1./2. + args.n * 1./6.))); + + IDEBUG_END; + + return 0; +} diff --git a/interface/ztrtri.c b/interface/ztrtri.c new file mode 100644 index 000000000..79e6c11aa --- /dev/null +++ b/interface/ztrtri.c @@ -0,0 +1,154 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XTRTRI" +#elif defined(DOUBLE) +#define ERROR_NAME "ZTRTRI" +#else +#define ERROR_NAME "CTRTRI" +#endif + +static blasint (*trtri_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ + TRTRI_UU_SINGLE, TRTRI_UN_SINGLE, TRTRI_LU_SINGLE, TRTRI_LN_SINGLE, +}; + +#ifdef SMPTEST +static blasint (*trtri_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ + TRTRI_UU_PARALLEL, TRTRI_UN_PARALLEL, TRTRI_LU_PARALLEL, TRTRI_LN_PARALLEL, +}; +#endif + +int NAME(char *UPLO, char *DIAG, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ + + blas_arg_t args; + + blasint uplo_arg = *UPLO; + blasint diag_arg = *DIAG; + blasint uplo, diag; + blasint info; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.n = *N; + args.a = (void *)a; + args.lda = *ldA; + + TOUPPER(uplo_arg); + TOUPPER(diag_arg); + + uplo = -1; + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + diag = -1; + if (diag_arg == 'U') diag = 0; + if (diag_arg == 'N') diag = 1; + + info = 0; + if (args.lda < MAX(1,args.n)) info = 5; + if (args.n < 0) info = 3; + if (diag < 0) info = 2; + if (uplo < 0) info = 1; + if (info) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + *Info = - info; + return 0; + } + + *Info = 0; + + if (args.n == 0) return 0; + + if (diag) { + if (AMIN_K(args.n, args.a, args.lda + 1) == ZERO) { + *Info = IAMIN_K(args.n, args.a, args.lda + 1); + return 0; + } + } + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + +#ifdef SMPTEST + args.common = NULL; + args.nthreads = num_cpu_avail(4); + + if (args.nthreads == 1) { +#endif + + *Info = (trtri_single[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0); + +#ifdef SMPTEST + } else { + + *Info = (trtri_parallel[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0); + + } +#endif + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(1, .5 * args.n * args.n, + 2. * args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) + + 6. * args.n * (1./3. + args.n * (-1./2. + args.n * 1./6.))); + + IDEBUG_END; + + return 0; +} From d63bd7fa5e78ecbef970ac20e13354ecd9915041 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sat, 10 May 2014 21:51:44 +0200 Subject: [PATCH 09/70] checked that gemm.c is OK --- interface/gemm.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/interface/gemm.c b/interface/gemm.c index ceb5ff355..587175ec7 100644 --- a/interface/gemm.c +++ b/interface/gemm.c @@ -81,7 +81,7 @@ static int (*gemm[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLA GEMM_NT, GEMM_TT, GEMM_RT, GEMM_CT, GEMM_NR, GEMM_TR, GEMM_RR, GEMM_CR, GEMM_NC, GEMM_TC, GEMM_RC, GEMM_CC, -#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3) +#if defined(SMP) && !defined(USE_SIMPLE_THREADED_LEVEL3) GEMM_THREAD_NN, GEMM_THREAD_TN, GEMM_THREAD_RN, GEMM_THREAD_CN, GEMM_THREAD_NT, GEMM_THREAD_TT, GEMM_THREAD_RT, GEMM_THREAD_CT, GEMM_THREAD_NR, GEMM_THREAD_TR, GEMM_THREAD_RR, GEMM_THREAD_CR, @@ -92,7 +92,7 @@ static int (*gemm[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLA GEMM3M_NT, GEMM3M_TT, GEMM3M_RT, GEMM3M_CT, GEMM3M_NR, GEMM3M_TR, GEMM3M_RR, GEMM3M_CR, GEMM3M_NC, GEMM3M_TC, GEMM3M_RC, GEMM3M_CC, -#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3) +#if defined(SMP) && !defined(USE_SIMPLE_THREADED_LEVEL3) GEMM3M_THREAD_NN, GEMM3M_THREAD_TN, GEMM3M_THREAD_RN, GEMM3M_THREAD_CN, GEMM3M_THREAD_NT, GEMM3M_THREAD_TT, GEMM3M_THREAD_RT, GEMM3M_THREAD_CT, GEMM3M_THREAD_NR, GEMM3M_THREAD_TR, GEMM3M_THREAD_RR, GEMM3M_THREAD_CR, @@ -120,7 +120,7 @@ void NAME(char *TRANSA, char *TRANSB, FLOAT *buffer; FLOAT *sa, *sb; -#ifdef SMPTEST +#ifdef SMP #ifndef COMPLEX #ifdef XDOUBLE int mode = BLAS_XDOUBLE | BLAS_REAL; @@ -140,7 +140,7 @@ void NAME(char *TRANSA, char *TRANSB, #endif #endif -#if defined(SMPTEST) && !defined(NO_AFFINITY) && !defined(USE_SIMPLE_THREADED_LEVEL3) +#if defined(SMP) && !defined(NO_AFFINITY) && !defined(USE_SIMPLE_THREADED_LEVEL3) int nodes; #endif @@ -236,7 +236,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_TRANSPOSE TransA, enum CBLAS_TRANS XFLOAT *buffer; XFLOAT *sa, *sb; -#ifdef SMPTEST +#ifdef SMP #ifndef COMPLEX #ifdef XDOUBLE int mode = BLAS_XDOUBLE | BLAS_REAL; @@ -256,7 +256,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_TRANSPOSE TransA, enum CBLAS_TRANS #endif #endif -#if defined(SMPTEST) && !defined(NO_AFFINITY) && !defined(USE_SIMPLE_THREADED_LEVEL3) +#if defined(SMP) && !defined(NO_AFFINITY) && !defined(USE_SIMPLE_THREADED_LEVEL3) int nodes; #endif @@ -396,7 +396,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_TRANSPOSE TransA, enum CBLAS_TRANS sa = (XFLOAT *)((BLASLONG)buffer +GEMM_OFFSET_A); sb = (XFLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#ifdef SMPTEST +#ifdef SMP mode |= (transa << BLAS_TRANSA_SHIFT); mode |= (transb << BLAS_TRANSB_SHIFT); @@ -413,7 +413,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_TRANSPOSE TransA, enum CBLAS_TRANS (gemm[(transb << 2) | transa])(&args, NULL, NULL, sa, sb, 0); -#ifdef SMPTEST +#ifdef SMP } else { @@ -447,7 +447,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_TRANSPOSE TransA, enum CBLAS_TRANS #endif -#ifdef SMPTEST +#ifdef SMP } #endif From 79a82ba7f1a6803946ae11fe892c4f4688018182 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sat, 10 May 2014 22:09:49 +0200 Subject: [PATCH 10/70] checked that axpy is OK --- interface/axpy.c | 6 +++--- interface/zaxpy.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/interface/axpy.c b/interface/axpy.c index b8a96c94e..82b0ee234 100644 --- a/interface/axpy.c +++ b/interface/axpy.c @@ -57,7 +57,7 @@ void CNAME(blasint n, FLOAT alpha, FLOAT *x, blasint incx, FLOAT *y, blasint inc #endif -#ifdef SMPTEST +#ifdef SMP int mode, nthreads; #endif @@ -78,7 +78,7 @@ void CNAME(blasint n, FLOAT alpha, FLOAT *x, blasint incx, FLOAT *y, blasint inc if (incx < 0) x -= (n - 1) * incx; if (incy < 0) y -= (n - 1) * incy; -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(1); //disable multi-thread when incx==0 or incy==0 @@ -95,7 +95,7 @@ void CNAME(blasint n, FLOAT alpha, FLOAT *x, blasint incx, FLOAT *y, blasint inc AXPYU_K(n, 0, 0, alpha, x, incx, y, incy, NULL, 0); -#ifdef SMPTEST +#ifdef SMP } else { #ifdef XDOUBLE diff --git a/interface/zaxpy.c b/interface/zaxpy.c index 5ae39552b..9ed72efb9 100644 --- a/interface/zaxpy.c +++ b/interface/zaxpy.c @@ -59,7 +59,7 @@ void CNAME(blasint n, FLOAT *ALPHA, FLOAT *x, blasint incx, FLOAT *y, blasint in FLOAT alpha_r = *(ALPHA + 0); FLOAT alpha_i = *(ALPHA + 1); -#ifdef SMPTEST +#ifdef SMP int mode, nthreads; #endif @@ -80,7 +80,7 @@ void CNAME(blasint n, FLOAT *ALPHA, FLOAT *x, blasint incx, FLOAT *y, blasint in if (incx < 0) x -= (n - 1) * incx * 2; if (incy < 0) y -= (n - 1) * incy * 2; -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(1); //disable multi-thread when incx==0 or incy==0 @@ -97,7 +97,7 @@ void CNAME(blasint n, FLOAT *ALPHA, FLOAT *x, blasint incx, FLOAT *y, blasint in AXPYC_K(n, 0, 0, alpha_r, alpha_i, x, incx, y, incy, NULL, 0); #endif -#ifdef SMPTEST +#ifdef SMP } else { #ifdef XDOUBLE From 781bfb6e6627a9c4678ee0d480e71f40f2115466 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sat, 10 May 2014 22:24:05 +0200 Subject: [PATCH 11/70] checked, that gemv is OK --- interface/gemv.c | 10 +++++----- interface/zgemv.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/interface/gemv.c b/interface/gemv.c index 0c55c6fe6..9ea8aa895 100644 --- a/interface/gemv.c +++ b/interface/gemv.c @@ -50,7 +50,7 @@ #define ERROR_NAME "SGEMV " #endif -#ifdef SMPTEST +#ifdef SMP static int (*gemv_thread[])(BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { #ifdef XDOUBLE qgemv_thread_n, qgemv_thread_t, @@ -78,7 +78,7 @@ void NAME(char *TRANS, blasint *M, blasint *N, FLOAT alpha = *ALPHA; FLOAT beta = *BETA; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -132,7 +132,7 @@ void CNAME(enum CBLAS_ORDER order, blasint lenx, leny; int trans; blasint info, t; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -210,7 +210,7 @@ void CNAME(enum CBLAS_ORDER order, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -218,7 +218,7 @@ void CNAME(enum CBLAS_ORDER order, (gemv[(int)trans])(m, n, 0, alpha, a, lda, x, incx, y, incy, buffer); -#ifdef SMPTEST +#ifdef SMP } else { (gemv_thread[(int)trans])(m, n, alpha, a, lda, x, incx, y, incy, buffer, nthreads); diff --git a/interface/zgemv.c b/interface/zgemv.c index c943b2057..fb4784202 100644 --- a/interface/zgemv.c +++ b/interface/zgemv.c @@ -50,7 +50,7 @@ #define ERROR_NAME "CGEMV " #endif -#ifdef SMPTEST +#ifdef SMP static int (*gemv_thread[])(BLASLONG, BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { #ifdef XDOUBLE xgemv_thread_n, xgemv_thread_t, xgemv_thread_r, xgemv_thread_c, xgemv_thread_o, xgemv_thread_u, xgemv_thread_s, xgemv_thread_d, @@ -77,7 +77,7 @@ void NAME(char *TRANS, blasint *M, blasint *N, blasint incy = *INCY; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -143,7 +143,7 @@ void CNAME(enum CBLAS_ORDER order, blasint lenx, leny; int trans; blasint info, t; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -232,7 +232,7 @@ void CNAME(enum CBLAS_ORDER order, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -240,7 +240,7 @@ void CNAME(enum CBLAS_ORDER order, (gemv[(int)trans])(m, n, 0, alpha_r, alpha_i, a, lda, x, incx, y, incy, buffer); -#ifdef SMPTEST +#ifdef SMP } else { From 4d61607c9e777c9a1d0d68d9b4799edc7f8809b0 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sat, 10 May 2014 22:38:09 +0200 Subject: [PATCH 12/70] cheched, that gbmv is OK --- interface/gbmv.c | 10 +++++----- interface/zgbmv.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/interface/gbmv.c b/interface/gbmv.c index d96d89f10..a76c48d04 100644 --- a/interface/gbmv.c +++ b/interface/gbmv.c @@ -61,7 +61,7 @@ static void (*gbmv[])(BLASLONG, BLASLONG, BLASLONG, BLASLONG, FLOAT, #endif }; -#ifdef SMPTEST +#ifdef SMP static int (*gbmv_thread[])(BLASLONG, BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { #ifdef XDOUBLE @@ -91,7 +91,7 @@ void NAME(char *TRANS, blasint *M, blasint *N, blasint incx = *INCX; blasint incy = *INCY; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -146,7 +146,7 @@ void CNAME(enum CBLAS_ORDER order, FLOAT *buffer; blasint lenx, leny, info, t; int trans; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -226,7 +226,7 @@ void CNAME(enum CBLAS_ORDER order, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -234,7 +234,7 @@ void CNAME(enum CBLAS_ORDER order, (gbmv[(int)trans])(m, n, kl, ku, alpha, a, lda, x, incx, y, incy, buffer); -#ifdef SMPTEST +#ifdef SMP } else { (gbmv_thread[(int)trans])(m, n, kl, ku, alpha, a, lda, x, incx, y, incy, buffer, nthreads); diff --git a/interface/zgbmv.c b/interface/zgbmv.c index b0ebb5f37..ae1fd24bf 100644 --- a/interface/zgbmv.c +++ b/interface/zgbmv.c @@ -64,7 +64,7 @@ static void (*gbmv[])(BLASLONG, BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT, #endif }; -#ifdef SMPTEST +#ifdef SMP static int (*gbmv_thread[])(BLASLONG, BLASLONG, BLASLONG, BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { #ifdef XDOUBLE @@ -97,7 +97,7 @@ void NAME(char *TRANS, blasint *M, blasint *N, blasint incx = *INCX; blasint incy = *INCY; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -164,7 +164,7 @@ void CNAME(enum CBLAS_ORDER order, blasint lenx, leny; int trans; blasint info, t; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -244,7 +244,7 @@ void CNAME(enum CBLAS_ORDER order, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -252,7 +252,7 @@ void CNAME(enum CBLAS_ORDER order, (gbmv[(int)trans])(m, n, kl, ku, alpha_r, alpha_i, a, lda, x, incx, y, incy, buffer); -#ifdef SMPTEST +#ifdef SMP } else { From 0947fc1c899933273c669e0fe19ddccc609e7395 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sat, 10 May 2014 22:49:53 +0200 Subject: [PATCH 13/70] checked, that ger is OK --- interface/ger.c | 8 ++++---- interface/zger.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/interface/ger.c b/interface/ger.c index eb3d224f0..0218d94dd 100644 --- a/interface/ger.c +++ b/interface/ger.c @@ -75,7 +75,7 @@ void NAME(blasint *M, blasint *N, FLOAT *Alpha, blasint incy = *INCY; blasint lda = *LDA; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -107,7 +107,7 @@ void CNAME(enum CBLAS_ORDER order, FLOAT *buffer; blasint info, t; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -167,7 +167,7 @@ void CNAME(enum CBLAS_ORDER order, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -175,7 +175,7 @@ void CNAME(enum CBLAS_ORDER order, GER(m, n, 0, alpha, x, incx, y, incy, a, lda, buffer); -#ifdef SMPTEST +#ifdef SMP } else { GER_THREAD(m, n, alpha, x, incx, y, incy, a, lda, buffer, nthreads); diff --git a/interface/zger.c b/interface/zger.c index 1b615a513..ad52f40bb 100644 --- a/interface/zger.c +++ b/interface/zger.c @@ -109,7 +109,7 @@ void NAME(blasint *M, blasint *N, FLOAT *Alpha, blasint incy = *INCY; blasint lda = *LDA; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -144,7 +144,7 @@ void CNAME(enum CBLAS_ORDER order, FLOAT *buffer; blasint info, t; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -205,7 +205,7 @@ void CNAME(enum CBLAS_ORDER order, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -221,7 +221,7 @@ void CNAME(enum CBLAS_ORDER order, } #endif -#ifdef SMPTEST +#ifdef SMP } else { From e187b5e9d0e70fc2b976e83070fa00aa1c18869e Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sat, 10 May 2014 22:55:44 +0200 Subject: [PATCH 14/70] removed gesv.c from interface --- interface/gesv.c | 154 ----------------------------------------------- 1 file changed, 154 deletions(-) delete mode 100644 interface/gesv.c diff --git a/interface/gesv.c b/interface/gesv.c deleted file mode 100644 index 920f6ab80..000000000 --- a/interface/gesv.c +++ /dev/null @@ -1,154 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifndef COMPLEX -#ifdef XDOUBLE -#define ERROR_NAME "QGESV " -#elif defined(DOUBLE) -#define ERROR_NAME "DGESV " -#else -#define ERROR_NAME "SGESV " -#endif -#else -#ifdef XDOUBLE -#define ERROR_NAME "XGESV " -#elif defined(DOUBLE) -#define ERROR_NAME "ZGESV " -#else -#define ERROR_NAME "CGESV " -#endif -#endif - -int NAME(blasint *N, blasint *NRHS, FLOAT *a, blasint *ldA, blasint *ipiv, - FLOAT *b, blasint *ldB, blasint *Info){ - - blas_arg_t args; - - blasint info; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.m = *N; - args.n = *NRHS; - args.a = (void *)a; - args.lda = *ldA; - args.b = (void *)b; - args.ldb = *ldB; - args.c = (void *)ipiv; - - info = 0; - if (args.ldb < MAX(1,args.m)) info = 7; - if (args.lda < MAX(1,args.m)) info = 4; - if (args.n < 0) info = 2; - if (args.m < 0) info = 1; - - if (info) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - *Info = - info; - return 0; - } - - args.alpha = NULL; - args.beta = NULL; - - *Info = 0; - - if (args.m == 0 || args.n == 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - -#ifdef SMPTEST - args.common = NULL; - args.nthreads = num_cpu_avail(4); - - if (args.nthreads == 1) { -#endif - - args.n = *N; - info = GETRF_SINGLE(&args, NULL, NULL, sa, sb, 0); - - if (info == 0){ - args.n = *NRHS; - GETRS_N_SINGLE(&args, NULL, NULL, sa, sb, 0); - } - -#ifdef SMPTEST - } else { - - args.n = *N; - info = GETRF_PARALLEL(&args, NULL, NULL, sa, sb, 0); - - if (info == 0){ - args.n = *NRHS; - GETRS_N_PARALLEL(&args, NULL, NULL, sa, sb, 0); - } - } -#endif - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - *Info = info; - - FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, *N * *N, 2. / 3. * *N * *N * *N + *N * *N); - - IDEBUG_END; - - return 0; -} From de00e2937a3eb13d7cfc52b8a7a0b77deda1e550 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sat, 10 May 2014 23:18:35 +0200 Subject: [PATCH 15/70] marked as smp bug --- interface/sbmv.c | 10 +++++----- interface/zsbmv.c | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/interface/sbmv.c b/interface/sbmv.c index f82ca537c..c481d5609 100644 --- a/interface/sbmv.c +++ b/interface/sbmv.c @@ -61,7 +61,7 @@ static int (*sbmv[])(BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLA #endif }; -#ifdef SMPTEST +#ifdef SMPBUG static int (*sbmv_thread[])(BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { #ifdef XDOUBLE qsbmv_thread_U, qsbmv_thread_L, @@ -90,7 +90,7 @@ void NAME(char *UPLO, blasint *N, blasint *K, FLOAT *ALPHA, FLOAT *a, blasint * blasint info; int uplo; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMPBUG int nthreads; #endif @@ -130,7 +130,7 @@ void CNAME(enum CBLAS_ORDER order, FLOAT *buffer; int uplo; blasint info; -#ifdef SMPTEST +#ifdef SMPBUG int nthreads; #endif @@ -189,7 +189,7 @@ void CNAME(enum CBLAS_ORDER order, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMPBUG nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -197,7 +197,7 @@ void CNAME(enum CBLAS_ORDER order, (sbmv[uplo])(n, k, alpha, a, lda, x, incx, y, incy, buffer); -#ifdef SMPTEST +#ifdef SMPBUG } else { (sbmv_thread[uplo])(n, k, alpha, a, lda, x, incx, y, incy, buffer, nthreads); diff --git a/interface/zsbmv.c b/interface/zsbmv.c index 110b8e4f1..6d445d7ee 100644 --- a/interface/zsbmv.c +++ b/interface/zsbmv.c @@ -61,7 +61,7 @@ static int (*sbmv[])(BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT #endif }; -#ifdef SMPTEST +#ifdef SMPBUG static int (*sbmv_thread[])(BLASLONG, BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { #ifdef XDOUBLE xsbmv_thread_U, xsbmv_thread_L, @@ -90,7 +90,7 @@ void NAME(char *UPLO, blasint *N, blasint *K, FLOAT *ALPHA, FLOAT *a, blasint * blasint info; int uplo; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMPBUG int nthreads; #endif @@ -131,7 +131,7 @@ void NAME(char *UPLO, blasint *N, blasint *K, FLOAT *ALPHA, FLOAT *a, blasint * buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMPBUG nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -139,7 +139,7 @@ void NAME(char *UPLO, blasint *N, blasint *K, FLOAT *ALPHA, FLOAT *a, blasint * (sbmv[uplo])(n, k, alpha_r, alpha_i, a, lda, b, incx, c, incy, buffer); -#ifdef SMPTEST +#ifdef SMPBUG } else { (sbmv_thread[uplo])(n, k, ALPHA, a, lda, b, incx, c, incy, buffer, nthreads); From 2ed03ea0a2a02f1f55ef3a543026d5e537151b60 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sat, 10 May 2014 23:55:43 +0200 Subject: [PATCH 16/70] checked, that spr2 is OK --- interface/spr2.c | 10 +++++----- interface/zspr2.c | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/interface/spr2.c b/interface/spr2.c index 6ff2110d3..e556d3fa8 100644 --- a/interface/spr2.c +++ b/interface/spr2.c @@ -61,7 +61,7 @@ static int (*spr2[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOA #endif }; -#ifdef SMPTEST +#ifdef SMP static int (*spr2_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = { #ifdef XDOUBLE qspr2_thread_U, qspr2_thread_L, @@ -87,7 +87,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, blasint info; int uplo; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -124,7 +124,7 @@ void CNAME(enum CBLAS_ORDER order, FLOAT *buffer; int uplo; blasint info; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -177,7 +177,7 @@ void CNAME(enum CBLAS_ORDER order, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -185,7 +185,7 @@ void CNAME(enum CBLAS_ORDER order, (spr2[uplo])(n, alpha, x, incx, y, incy, a, buffer); -#ifdef SMPTEST +#ifdef SMP } else { (spr2_thread[uplo])(n, alpha, x, incx, y, incy, a, buffer, nthreads); diff --git a/interface/zspr2.c b/interface/zspr2.c index 085e8bb7f..b54e1651a 100644 --- a/interface/zspr2.c +++ b/interface/zspr2.c @@ -61,7 +61,7 @@ static int (*spr2[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLON #endif }; -#ifdef SMPTEST +#ifdef SMP static int (*spr2_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = { #ifdef XDOUBLE xspr2_thread_U, xspr2_thread_L, @@ -86,7 +86,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, blasint info; int uplo; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -123,7 +123,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -131,7 +131,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, (spr2[uplo])(n, alpha_r, alpha_i, x, incx, y, incy, a, buffer); -#ifdef SMPTEST +#ifdef SMP } else { (spr2_thread[uplo])(n, ALPHA, x, incx, y, incy, a, buffer, nthreads); From c7eb9014960f06265adde12cccc5cf5b26462238 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 11 May 2014 00:07:07 +0200 Subject: [PATCH 17/70] checked, that spr is OK --- interface/spr.c | 10 +++++----- interface/zspr.c | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/interface/spr.c b/interface/spr.c index 874970904..aa2ff8f3f 100644 --- a/interface/spr.c +++ b/interface/spr.c @@ -61,7 +61,7 @@ static int (*spr[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, FLOAT *) = { #endif }; -#ifdef SMPTEST +#ifdef SMP static int (*spr_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = { #ifdef XDOUBLE qspr_thread_U, qspr_thread_L, @@ -86,7 +86,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, blasint info; int uplo; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -121,7 +121,7 @@ void CNAME(enum CBLAS_ORDER order, FLOAT *buffer; int uplo; blasint info; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -171,7 +171,7 @@ void CNAME(enum CBLAS_ORDER order, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -179,7 +179,7 @@ void CNAME(enum CBLAS_ORDER order, (spr[uplo])(n, alpha, x, incx, a, buffer); -#ifdef SMPTEST +#ifdef SMP } else { (spr_thread[uplo])(n, alpha, x, incx, a, buffer, nthreads); diff --git a/interface/zspr.c b/interface/zspr.c index b38ccb5d6..0021bcda4 100644 --- a/interface/zspr.c +++ b/interface/zspr.c @@ -61,7 +61,7 @@ static int (*spr[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, FLOAT *) #endif }; -#ifdef SMPTEST +#ifdef SMP static int (*spr_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = { #ifdef XDOUBLE xspr_thread_U, xspr_thread_L, @@ -85,7 +85,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, blasint info; int uplo; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -120,7 +120,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -128,7 +128,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, (spr[uplo])(n, alpha_r, alpha_i, x, incx, a, buffer); -#ifdef SMPTEST +#ifdef SMP } else { (spr_thread[uplo])(n, ALPHA, x, incx, a, buffer, nthreads); From 1e8e6faa7e625d25692ae2e2702a2c029b0e2b13 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 11 May 2014 00:22:40 +0200 Subject: [PATCH 18/70] checked, that symm is OK --- interface/symm.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/interface/symm.c b/interface/symm.c index e9765d557..b447f13e8 100644 --- a/interface/symm.c +++ b/interface/symm.c @@ -95,24 +95,24 @@ static int (*symm[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLA #ifndef GEMM3M #ifndef HEMM SYMM_LU, SYMM_LL, SYMM_RU, SYMM_RL, -#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3) +#if defined(SMP) && !defined(USE_SIMPLE_THREADED_LEVEL3) SYMM_THREAD_LU, SYMM_THREAD_LL, SYMM_THREAD_RU, SYMM_THREAD_RL, #endif #else HEMM_LU, HEMM_LL, HEMM_RU, HEMM_RL, -#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3) +#if defined(SMP) && !defined(USE_SIMPLE_THREADED_LEVEL3) HEMM_THREAD_LU, HEMM_THREAD_LL, HEMM_THREAD_RU, HEMM_THREAD_RL, #endif #endif #else #ifndef HEMM SYMM3M_LU, SYMM3M_LL, SYMM3M_RU, SYMM3M_RL, -#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3) +#if defined(SMP) && !defined(USE_SIMPLE_THREADED_LEVEL3) SYMM3M_THREAD_LU, SYMM3M_THREAD_LL, SYMM3M_THREAD_RU, SYMM3M_THREAD_RL, #endif #else HEMM3M_LU, HEMM3M_LL, HEMM3M_RU, HEMM3M_RL, -#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3) +#if defined(SMP) && !defined(USE_SIMPLE_THREADED_LEVEL3) HEMM3M_THREAD_LU, HEMM3M_THREAD_LL, HEMM3M_THREAD_RU, HEMM3M_THREAD_RL, #endif #endif @@ -135,7 +135,7 @@ void NAME(char *SIDE, char *UPLO, FLOAT *buffer; FLOAT *sa, *sb; -#ifdef SMPTEST +#ifdef SMP #ifndef COMPLEX #ifdef XDOUBLE int mode = BLAS_XDOUBLE | BLAS_REAL; @@ -155,7 +155,7 @@ void NAME(char *SIDE, char *UPLO, #endif #endif -#if defined(SMPTEST) && !defined(NO_AFFINITY) +#if defined(SMP) && !defined(NO_AFFINITY) int nodes; #endif @@ -246,7 +246,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_SIDE Side, enum CBLAS_UPLO Uplo, FLOAT *buffer; FLOAT *sa, *sb; -#ifdef SMPTEST +#ifdef SMP #ifndef COMPLEX #ifdef XDOUBLE int mode = BLAS_XDOUBLE | BLAS_REAL; @@ -266,7 +266,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_SIDE Side, enum CBLAS_UPLO Uplo, #endif #endif -#if defined(SMPTEST) && !defined(NO_AFFINITY) +#if defined(SMP) && !defined(NO_AFFINITY) int nodes; #endif @@ -387,7 +387,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_SIDE Side, enum CBLAS_UPLO Uplo, sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#ifdef SMPTEST +#ifdef SMP args.common = NULL; args.nthreads = num_cpu_avail(3); @@ -396,7 +396,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_SIDE Side, enum CBLAS_UPLO Uplo, (symm[(side << 1) | uplo ])(&args, NULL, NULL, sa, sb, 0); -#ifdef SMPTEST +#ifdef SMP } else { From e2c39a4a8e5902593912d9f674a3f366b01ea2ca Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 11 May 2014 00:36:56 +0200 Subject: [PATCH 19/70] checked, that symv is OK --- interface/symv.c | 12 ++++++------ interface/zsymv.c | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/interface/symv.c b/interface/symv.c index f5cff20bc..e8c24df66 100644 --- a/interface/symv.c +++ b/interface/symv.c @@ -68,7 +68,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, blasint *LDA, SYMV_U, SYMV_L, }; -#ifdef SMPTEST +#ifdef SMP int (*symv_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { SYMV_THREAD_U, SYMV_THREAD_L, }; @@ -77,7 +77,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, blasint *LDA, blasint info; int uplo; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -110,7 +110,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, FLOAT *buffer; int uplo; blasint info; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -118,7 +118,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, SYMV_U, SYMV_L, }; -#ifdef SMPTEST +#ifdef SMP int (*symv_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { SYMV_THREAD_U, SYMV_THREAD_L, }; @@ -179,7 +179,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -187,7 +187,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, (symv[uplo])(n, n, alpha, a, lda, x, incx, y, incy, buffer); -#ifdef SMPTEST +#ifdef SMP } else { (symv_thread[uplo])(n, alpha, a, lda, x, incx, y, incy, buffer, nthreads); diff --git a/interface/zsymv.c b/interface/zsymv.c index 15bceeebe..afb2c1734 100644 --- a/interface/zsymv.c +++ b/interface/zsymv.c @@ -68,7 +68,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, blasint *LDA, SYMV_U, SYMV_L, }; -#ifdef SMPTEST +#ifdef SMP int (*symv_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { SYMV_THREAD_U, SYMV_THREAD_L, }; @@ -77,7 +77,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, blasint *LDA, blasint info; int uplo; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -117,7 +117,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, blasint *LDA, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -125,7 +125,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, blasint *LDA, (symv[uplo])(n, n, alpha_r, alpha_i, a, lda, b, incx, c, incy, buffer); -#ifdef SMPTEST +#ifdef SMP } else { (symv_thread[uplo])(n, ALPHA, a, lda, b, incx, c, incy, buffer, nthreads); From eebce01cf24bba87b79f9f608b7b9078c832b250 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 11 May 2014 00:48:49 +0200 Subject: [PATCH 20/70] checked, that syr2 is OK --- interface/syr2.c | 10 +++++----- interface/zsyr2.c | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/interface/syr2.c b/interface/syr2.c index efe63fe6a..15dbae4bd 100644 --- a/interface/syr2.c +++ b/interface/syr2.c @@ -61,7 +61,7 @@ static int (*syr2[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOA #endif }; -#ifdef SMPTEST +#ifdef SMP static int (*syr2_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { #ifdef XDOUBLE qsyr2_thread_U, qsyr2_thread_L, @@ -88,7 +88,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, blasint info; int uplo; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -120,7 +120,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, FLOAT *buffer; int trans, uplo; blasint info; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -178,7 +178,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -186,7 +186,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, (syr2[uplo])(n, alpha, x, incx, y, incy, a, lda, buffer); -#ifdef SMPTEST +#ifdef SMP } else { (syr2_thread[uplo])(n, alpha, x, incx, y, incy, a, lda, buffer, nthreads); diff --git a/interface/zsyr2.c b/interface/zsyr2.c index bb7e2e191..0c705cb12 100644 --- a/interface/zsyr2.c +++ b/interface/zsyr2.c @@ -61,7 +61,7 @@ static int (*syr2[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLON #endif }; -#ifdef SMPTEST +#ifdef SMP static int (*syr2_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { #ifdef XDOUBLE xsyr2_thread_U, xsyr2_thread_L, @@ -87,7 +87,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, blasint info; int uplo; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -125,7 +125,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -133,7 +133,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, (syr2[uplo])(n, alpha_r, alpha_i, x, incx, y, incy, a, lda, buffer); -#ifdef SMPTEST +#ifdef SMP } else { (syr2_thread[uplo])(n, ALPHA, x, incx, y, incy, a, lda, buffer, nthreads); From d972f4a60a1c84e1ea1150a32b0b2ac099bc31dc Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 11 May 2014 01:04:46 +0200 Subject: [PATCH 21/70] check, that syr2k is OK --- interface/syr2k.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/interface/syr2k.c b/interface/syr2k.c index 470b83958..381e088a6 100644 --- a/interface/syr2k.c +++ b/interface/syr2k.c @@ -95,7 +95,7 @@ void NAME(char *UPLO, char *TRANS, FLOAT *buffer; FLOAT *sa, *sb; -#ifdef SMPTEST +#ifdef SMP #ifndef COMPLEX #ifdef XDOUBLE int mode = BLAS_XDOUBLE | BLAS_REAL; @@ -208,7 +208,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, enum CBLAS_TRANSPOSE Tr FLOAT CAlpha[2]; #endif -#ifdef SMPTEST +#ifdef SMP #ifndef COMPLEX #ifdef XDOUBLE int mode = BLAS_XDOUBLE | BLAS_REAL; @@ -341,7 +341,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, enum CBLAS_TRANSPOSE Tr sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#ifdef SMPTEST +#ifdef SMP if (!trans){ mode |= (BLAS_TRANSA_N | BLAS_TRANSB_T); } else { @@ -358,7 +358,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, enum CBLAS_TRANSPOSE Tr (syr2k[(uplo << 1) | trans ])(&args, NULL, NULL, sa, sb, 0); -#ifdef SMPTEST +#ifdef SMP } else { From bfef3c5dd1e07fc0e8632c479975a1b0ab2c8579 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 11 May 2014 07:46:22 +0200 Subject: [PATCH 22/70] checked, that syr is OK --- interface/syr.c | 10 +++++----- interface/zsyr.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/interface/syr.c b/interface/syr.c index db2a9d400..2b2d3d1e2 100644 --- a/interface/syr.c +++ b/interface/syr.c @@ -61,7 +61,7 @@ static int (*syr[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT #endif }; -#ifdef SMPTEST +#ifdef SMP static int (*syr_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { #ifdef XDOUBLE qsyr_thread_U, qsyr_thread_L, @@ -87,7 +87,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, blasint info; int uplo; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -118,7 +118,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, FLOAT *buffer; int trans, uplo; blasint info; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -174,7 +174,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -182,7 +182,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, (syr[uplo])(n, alpha, x, incx, a, lda, buffer); -#ifdef SMPTEST +#ifdef SMP } else { (syr_thread[uplo])(n, alpha, x, incx, a, lda, buffer, nthreads); diff --git a/interface/zsyr.c b/interface/zsyr.c index d15801cdc..b6b5202ec 100644 --- a/interface/zsyr.c +++ b/interface/zsyr.c @@ -61,7 +61,7 @@ static int (*syr[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG #endif }; -#ifdef SMPTEST +#ifdef SMP static int (*syr_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { #ifdef XDOUBLE xsyr_thread_U, xsyr_thread_L, @@ -89,7 +89,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, blasint info; int uplo; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -121,7 +121,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, int n, FLOAT alpha, FLO FLOAT *buffer; int trans, uplo; blasint info; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -177,7 +177,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, int n, FLOAT alpha, FLO buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -185,7 +185,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, int n, FLOAT alpha, FLO (syr[uplo])(n, alpha_r, alpha_i, x, incx, a, lda, buffer); -#ifdef SMPTEST +#ifdef SMP } else { (syr_thread[uplo])(n, ALPHA, x, incx, a, lda, buffer, nthreads); From 57bbc586ef8d49d3cda869a090aaa4eee845f996 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 11 May 2014 08:10:25 +0200 Subject: [PATCH 23/70] checked, that syrk is OK --- interface/syrk.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/interface/syrk.c b/interface/syrk.c index 1c00b5aa5..072cc86f5 100644 --- a/interface/syrk.c +++ b/interface/syrk.c @@ -74,12 +74,12 @@ static int (*syrk[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { #ifndef HEMM SYRK_UN, SYRK_UC, SYRK_LN, SYRK_LC, -#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3) +#if defined(SMP) && !defined(USE_SIMPLE_THREADED_LEVEL3) SYRK_THREAD_UN, SYRK_THREAD_UC, SYRK_THREAD_LN, SYRK_THREAD_LC, #endif #else HERK_UN, HERK_UC, HERK_LN, HERK_LC, -#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3) +#if defined(SMP) && !defined(USE_SIMPLE_THREADED_LEVEL3) HERK_THREAD_UN, HERK_THREAD_UC, HERK_THREAD_LN, HERK_THREAD_LC, #endif #endif @@ -100,7 +100,7 @@ void NAME(char *UPLO, char *TRANS, FLOAT *buffer; FLOAT *sa, *sb; -#ifdef SMPTEST +#ifdef SMP #ifndef COMPLEX #ifdef XDOUBLE int mode = BLAS_XDOUBLE | BLAS_REAL; @@ -205,7 +205,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, enum CBLAS_TRANSPOSE Tr FLOAT *buffer; FLOAT *sa, *sb; -#ifdef SMPTEST +#ifdef SMP #ifndef COMPLEX #ifdef XDOUBLE int mode = BLAS_XDOUBLE | BLAS_REAL; @@ -322,7 +322,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, enum CBLAS_TRANSPOSE Tr sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#ifdef SMPTEST +#ifdef SMP if (!trans){ mode |= (BLAS_TRANSA_N | BLAS_TRANSB_T); } else { @@ -339,7 +339,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, enum CBLAS_TRANSPOSE Tr (syrk[(uplo << 1) | trans ])(&args, NULL, NULL, sa, sb, 0); -#ifdef SMPTEST +#ifdef SMP } else { From 48d132578456aacc715ab2c40e62c0963b12309d Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 11 May 2014 08:22:00 +0200 Subject: [PATCH 24/70] checked, that tbmv is OK --- interface/tbmv.c | 10 +++++----- interface/ztbmv.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/interface/tbmv.c b/interface/tbmv.c index 8d08c0e1f..cec2be465 100644 --- a/interface/tbmv.c +++ b/interface/tbmv.c @@ -64,7 +64,7 @@ static int (*tbmv[])(BLASLONG, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, v #endif }; -#ifdef SMPTEST +#ifdef SMP static int (*tbmv_thread[])(BLASLONG, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { #ifdef XDOUBLE qtbmv_thread_NUU, qtbmv_thread_NUN, qtbmv_thread_NLU, qtbmv_thread_NLN, @@ -99,7 +99,7 @@ void NAME(char *UPLO, char *TRANS, char *DIAG, int unit; int trans; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -148,7 +148,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, int trans, uplo, unit; blasint info; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -222,7 +222,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -230,7 +230,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, (tbmv[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer); -#ifdef SMPTEST +#ifdef SMP } else { (tbmv_thread[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer, nthreads); diff --git a/interface/ztbmv.c b/interface/ztbmv.c index fb8873bc0..85f53c4be 100644 --- a/interface/ztbmv.c +++ b/interface/ztbmv.c @@ -70,7 +70,7 @@ static int (*tbmv[])(BLASLONG, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, v #endif }; -#ifdef SMPTEST +#ifdef SMP static int (*tbmv_thread[])(BLASLONG, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { #ifdef XDOUBLE xtbmv_thread_NUU, xtbmv_thread_NUN, xtbmv_thread_NLU, xtbmv_thread_NLN, @@ -111,7 +111,7 @@ void NAME(char *UPLO, char *TRANS, char *DIAG, int unit; int trans; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -160,7 +160,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, int trans, uplo, unit; blasint info; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -234,7 +234,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -242,7 +242,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, (tbmv[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer); -#ifdef SMPTEST +#ifdef SMP } else { (tbmv_thread[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer, nthreads); From 8204ab4aa80046c52552e420b409d49a5668ba02 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 11 May 2014 08:35:34 +0200 Subject: [PATCH 25/70] checked, that tpmv is OK --- interface/tpmv.c | 10 +++++----- interface/ztpmv.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/interface/tpmv.c b/interface/tpmv.c index fde5abb4d..f0fc4f71c 100644 --- a/interface/tpmv.c +++ b/interface/tpmv.c @@ -64,7 +64,7 @@ static int (*tpmv[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, void *) = { #endif }; -#ifdef SMPTEST +#ifdef SMP static int (*tpmv_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, int) = { #ifdef XDOUBLE qtpmv_thread_NUU, qtpmv_thread_NUN, qtpmv_thread_NLU, qtpmv_thread_NLN, @@ -96,7 +96,7 @@ void NAME(char *UPLO, char *TRANS, char *DIAG, int unit; int trans; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -143,7 +143,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, int trans, uplo, unit; blasint info; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -213,7 +213,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -221,7 +221,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, (tpmv[(trans<<2) | (uplo<<1) | unit])(n, a, x, incx, buffer); -#ifdef SMPTEST +#ifdef SMP } else { (tpmv_thread[(trans<<2) | (uplo<<1) | unit])(n, a, x, incx, buffer, nthreads); diff --git a/interface/ztpmv.c b/interface/ztpmv.c index 2f7fe3b63..2f9c48f5a 100644 --- a/interface/ztpmv.c +++ b/interface/ztpmv.c @@ -70,7 +70,7 @@ static int (*tpmv[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, void *) = { #endif }; -#ifdef SMPTEST +#ifdef SMP static int (*tpmv_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, int) = { #ifdef XDOUBLE xtpmv_thread_NUU, xtpmv_thread_NUN, xtpmv_thread_NLU, xtpmv_thread_NLN, @@ -108,7 +108,7 @@ void NAME(char *UPLO, char *TRANS, char *DIAG, int unit; int trans; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -162,7 +162,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, uplo = -1; trans = -1; info = 0; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -225,7 +225,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -233,7 +233,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, (tpmv[(trans<<2) | (uplo<<1) | unit])(n, a, x, incx, buffer); -#ifdef SMPTEST +#ifdef SMP } else { From 7fb78a5f01a110a581726789c0575e7cb2dfe41c Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 11 May 2014 08:47:44 +0200 Subject: [PATCH 26/70] checked, that trmv is OK --- interface/trmv.c | 10 +++++----- interface/ztrmv.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/interface/trmv.c b/interface/trmv.c index 765a114d1..ed23cedc6 100644 --- a/interface/trmv.c +++ b/interface/trmv.c @@ -64,7 +64,7 @@ static int (*trmv[])(BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = #endif }; -#ifdef SMPTEST +#ifdef SMP static int (*trmv_thread[])(BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { #ifdef XDOUBLE qtrmv_thread_NUU, qtrmv_thread_NUN, qtrmv_thread_NLU, qtrmv_thread_NLN, @@ -97,7 +97,7 @@ void NAME(char *UPLO, char *TRANS, char *DIAG, int unit; int trans; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -145,7 +145,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, int trans, uplo, unit; blasint info; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -217,7 +217,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -225,7 +225,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, (trmv[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer); -#ifdef SMPTEST +#ifdef SMP } else { (trmv_thread[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer, nthreads); diff --git a/interface/ztrmv.c b/interface/ztrmv.c index 1ebee3ab8..5a18a85b1 100644 --- a/interface/ztrmv.c +++ b/interface/ztrmv.c @@ -70,7 +70,7 @@ static int (*trmv[])(BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = #endif }; -#ifdef SMPTEST +#ifdef SMP static int (*trmv_thread[])(BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { #ifdef XDOUBLE xtrmv_thread_NUU, xtrmv_thread_NUN, xtrmv_thread_NLU, xtrmv_thread_NLN, @@ -109,7 +109,7 @@ void NAME(char *UPLO, char *TRANS, char *DIAG, int unit; int trans; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -157,7 +157,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, int trans, uplo, unit; blasint info; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -229,7 +229,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -237,7 +237,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, (trmv[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer); -#ifdef SMPTEST +#ifdef SMP } else { (trmv_thread[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer, nthreads); From 564ff395f6b1073e8e04e4a3049766b1f8367534 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 11 May 2014 08:59:33 +0200 Subject: [PATCH 27/70] checked, that trsm is OK --- interface/trsm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/interface/trsm.c b/interface/trsm.c index 2b00c4722..5836ce2f0 100644 --- a/interface/trsm.c +++ b/interface/trsm.c @@ -119,7 +119,7 @@ void NAME(char *SIDE, char *UPLO, char *TRANS, char *DIAG, FLOAT *buffer; FLOAT *sa, *sb; -#ifdef SMPTEST +#ifdef SMP #ifndef COMPLEX #ifdef XDOUBLE int mode = BLAS_XDOUBLE | BLAS_REAL; @@ -223,7 +223,7 @@ void CNAME(enum CBLAS_ORDER order, XFLOAT *buffer; XFLOAT *sa, *sb; -#ifdef SMPTEST +#ifdef SMP #ifndef COMPLEX #ifdef XDOUBLE int mode = BLAS_XDOUBLE | BLAS_REAL; @@ -357,7 +357,7 @@ void CNAME(enum CBLAS_ORDER order, sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#ifdef SMPTEST +#ifdef SMP mode |= (trans << BLAS_TRANSA_SHIFT); mode |= (side << BLAS_RSIDE_SHIFT); @@ -368,7 +368,7 @@ void CNAME(enum CBLAS_ORDER order, (trsm[(side<<4) | (trans<<2) | (uplo<<1) | unit])(&args, NULL, NULL, sa, sb, 0); -#ifdef SMPTEST +#ifdef SMP } else { if (!side) { gemm_thread_n(mode, &args, NULL, NULL, trsm[(side<<4) | (trans<<2) | (uplo<<1) | unit], sa, sb, args.nthreads); From 0758c1a3742654374cb4d2fc78745a3ec7be64ff Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 11 May 2014 09:11:20 +0200 Subject: [PATCH 28/70] checked, that trtri is OK --- interface/trtri.c | 6 +++--- interface/ztrtri.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/interface/trtri.c b/interface/trtri.c index 07d4790f3..5aa5e9b9b 100644 --- a/interface/trtri.c +++ b/interface/trtri.c @@ -54,7 +54,7 @@ static blasint (*trtri_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, TRTRI_UU_SINGLE, TRTRI_UN_SINGLE, TRTRI_LU_SINGLE, TRTRI_LN_SINGLE, }; -#ifdef SMPTEST +#ifdef SMP static blasint (*trtri_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ TRTRI_UU_PARALLEL, TRTRI_UN_PARALLEL, TRTRI_LU_PARALLEL, TRTRI_LN_PARALLEL, }; @@ -126,7 +126,7 @@ int NAME(char *UPLO, char *DIAG, blasint *N, FLOAT *a, blasint *ldA, blasint *In sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); #endif -#ifdef SMPTEST +#ifdef SMP args.nthreads = num_cpu_avail(4); if (args.nthreads == 1) { @@ -134,7 +134,7 @@ int NAME(char *UPLO, char *DIAG, blasint *N, FLOAT *a, blasint *ldA, blasint *In *Info = (trtri_single[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0); -#ifdef SMPTEST +#ifdef SMP } else { *Info = (trtri_parallel[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0); diff --git a/interface/ztrtri.c b/interface/ztrtri.c index 79e6c11aa..89caf80d3 100644 --- a/interface/ztrtri.c +++ b/interface/ztrtri.c @@ -54,7 +54,7 @@ static blasint (*trtri_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, TRTRI_UU_SINGLE, TRTRI_UN_SINGLE, TRTRI_LU_SINGLE, TRTRI_LN_SINGLE, }; -#ifdef SMPTEST +#ifdef SMP static blasint (*trtri_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ TRTRI_UU_PARALLEL, TRTRI_UN_PARALLEL, TRTRI_LU_PARALLEL, TRTRI_LN_PARALLEL, }; @@ -123,7 +123,7 @@ int NAME(char *UPLO, char *DIAG, blasint *N, FLOAT *a, blasint *ldA, blasint *In sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); #endif -#ifdef SMPTEST +#ifdef SMP args.common = NULL; args.nthreads = num_cpu_avail(4); @@ -132,7 +132,7 @@ int NAME(char *UPLO, char *DIAG, blasint *N, FLOAT *a, blasint *ldA, blasint *In *Info = (trtri_single[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0); -#ifdef SMPTEST +#ifdef SMP } else { *Info = (trtri_parallel[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0); From 9bae50f700dbea9ddf4cd932cdc905785dbeb890 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 11 May 2014 09:30:18 +0200 Subject: [PATCH 29/70] checked, that zscal and zswap are OK --- interface/zscal.c | 6 +++--- interface/zswap.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/interface/zscal.c b/interface/zscal.c index 5c894d778..ad99874dc 100644 --- a/interface/zscal.c +++ b/interface/zscal.c @@ -68,7 +68,7 @@ void CNAME(blasint n, FLOAT alpha_r, FLOAT *x, blasint incx){ #endif #endif -#ifdef SMPTEST +#ifdef SMP int mode; int nthreads; #endif @@ -87,7 +87,7 @@ void CNAME(blasint n, FLOAT alpha_r, FLOAT *x, blasint incx){ FUNCTION_PROFILE_START(); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(1); if (nthreads == 1) { @@ -95,7 +95,7 @@ void CNAME(blasint n, FLOAT alpha_r, FLOAT *x, blasint incx){ SCAL_K(n, 0, 0, alpha[0], alpha[1], x, incx, NULL, 0, NULL, 0); -#ifdef SMPTEST +#ifdef SMP } else { #ifdef DOUBLE mode = BLAS_DOUBLE | BLAS_COMPLEX; diff --git a/interface/zswap.c b/interface/zswap.c index ef35f107f..06a889204 100644 --- a/interface/zswap.c +++ b/interface/zswap.c @@ -56,7 +56,7 @@ void CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy){ #endif -#ifdef SMPTEST +#ifdef SMP int mode; FLOAT dummyalpha[2] = {ZERO, ZERO}; int nthreads; @@ -77,7 +77,7 @@ void CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy){ if (incx < 0) x -= (n - 1) * incx * 2; if (incy < 0) y -= (n - 1) * incy * 2; -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(1); //disable multi-thread when incx==0 or incy==0 @@ -90,7 +90,7 @@ void CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy){ SWAP_K(n, 0, 0, ZERO, ZERO, x, incx, y, incy, NULL, 0); -#ifdef SMPTEST +#ifdef SMP } else { #ifdef XDOUBLE From 10780ae650663f15703ab7e97c3c87341e7c081b Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 11 May 2014 09:58:16 +0200 Subject: [PATCH 30/70] marked zhbmv as smp bug --- interface/zhbmv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/interface/zhbmv.c b/interface/zhbmv.c index 717e8f5b0..00ba915db 100644 --- a/interface/zhbmv.c +++ b/interface/zhbmv.c @@ -61,7 +61,7 @@ static int (*hbmv[])(BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT #endif }; -#ifdef SMPTEST +#ifdef SMPBUG static int (*hbmv_thread[])(BLASLONG, BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { #ifdef XDOUBLE xhbmv_thread_U, xhbmv_thread_L, xhbmv_thread_V, xhbmv_thread_M, @@ -92,7 +92,7 @@ void NAME(char *UPLO, blasint *N, blasint *K, FLOAT *ALPHA, FLOAT *a, blasint * blasint info; int uplo; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMPBUG int nthreads; #endif @@ -138,7 +138,7 @@ void CNAME(enum CBLAS_ORDER order, FLOAT *buffer; int uplo; blasint info; -#ifdef SMPTEST +#ifdef SMPBUG int nthreads; #endif @@ -197,7 +197,7 @@ void CNAME(enum CBLAS_ORDER order, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMPBUG nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -205,7 +205,7 @@ void CNAME(enum CBLAS_ORDER order, (hbmv[uplo])(n, k, alpha_r, alpha_i, a, lda, x, incx, y, incy, buffer); -#ifdef SMPTEST +#ifdef SMPBUG } else { (hbmv_thread[uplo])(n, k, ALPHA, a, lda, x, incx, y, incy, buffer, nthreads); From f45f2c8465dcdadaf73c5a31766cf0803bed49c8 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 11 May 2014 10:15:06 +0200 Subject: [PATCH 31/70] checked, that zhemv is OK --- interface/zhemv.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/interface/zhemv.c b/interface/zhemv.c index 1dcccb4d1..3cba445c2 100644 --- a/interface/zhemv.c +++ b/interface/zhemv.c @@ -65,7 +65,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, blasint *LDA, FLOAT beta_r = BETA[0]; FLOAT beta_i = BETA[1]; blasint incy = *INCY; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -73,7 +73,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, blasint *LDA, HEMV_U, HEMV_L, HEMV_V, HEMV_M, }; -#ifdef SMPTEST +#ifdef SMP int (*hemv_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { HEMV_THREAD_U, HEMV_THREAD_L, HEMV_THREAD_V, HEMV_THREAD_M, }; @@ -119,7 +119,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT *ALPHA FLOAT *buffer; int trans, uplo; blasint info; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -127,7 +127,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT *ALPHA HEMV_U, HEMV_L, HEMV_V, HEMV_M, }; -#ifdef SMPTEST +#ifdef SMP int (*hemv_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { HEMV_THREAD_U, HEMV_THREAD_L, HEMV_THREAD_V, HEMV_THREAD_M, }; @@ -189,7 +189,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT *ALPHA buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -197,7 +197,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT *ALPHA (hemv[uplo])(n, n, alpha_r, alpha_i, a, lda, x, incx, y, incy, buffer); -#ifdef SMPTEST +#ifdef SMP } else { (hemv_thread[uplo])(n, ALPHA, a, lda, x, incx, y, incy, buffer, nthreads); From 47e8950e771348d49971d213700471a5c0622bb9 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 11 May 2014 10:26:05 +0200 Subject: [PATCH 32/70] checked, that zher2 is OK --- interface/zher2.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/interface/zher2.c b/interface/zher2.c index c35307556..88fececf7 100644 --- a/interface/zher2.c +++ b/interface/zher2.c @@ -61,7 +61,7 @@ static int (*her2[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLON #endif }; -#ifdef SMPTEST +#ifdef SMP static int (*her2_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { #ifdef XDOUBLE xher2_thread_U, xher2_thread_L, xher2_thread_V, xher2_thread_M, @@ -89,7 +89,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, blasint info; int uplo; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -123,7 +123,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT *ALPHA FLOAT *buffer; int trans, uplo; blasint info; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -181,7 +181,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT *ALPHA buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -189,7 +189,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT *ALPHA (her2[uplo])(n, alpha_r, alpha_i, x, incx, y, incy, a, lda, buffer); -#ifdef SMPTEST +#ifdef SMP } else { (her2_thread[uplo])(n, ALPHA, x, incx, y, incy, a, lda, buffer, nthreads); From 5e4b4f6712ed443a01b65f9858f65afaeb77722d Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 11 May 2014 10:36:34 +0200 Subject: [PATCH 33/70] checked, that zher is OK --- interface/zher.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/interface/zher.c b/interface/zher.c index 237f8d75e..ad982dd68 100644 --- a/interface/zher.c +++ b/interface/zher.c @@ -61,7 +61,7 @@ static int (*her[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT #endif }; -#ifdef SMPTEST +#ifdef SMP static int (*her_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { #ifdef XDOUBLE xher_thread_U, xher_thread_L, xher_thread_V, xher_thread_M, @@ -87,7 +87,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, blasint info; int uplo; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -118,7 +118,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, FLOAT *buffer; int trans, uplo; blasint info; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -174,7 +174,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -182,7 +182,7 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, (her[uplo])(n, alpha, x, incx, a, lda, buffer); -#ifdef SMPTEST +#ifdef SMP } else { (her_thread[uplo])(n, alpha, x, incx, a, lda, buffer, nthreads); From 2a94aaaf2e491e597507e53d6cd26237ef735143 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 11 May 2014 10:46:48 +0200 Subject: [PATCH 34/70] checked, that zhpmv is OK --- interface/zhpmv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/interface/zhpmv.c b/interface/zhpmv.c index 36cc8d954..d7013e668 100644 --- a/interface/zhpmv.c +++ b/interface/zhpmv.c @@ -61,7 +61,7 @@ static int (*hpmv[])(BLASLONG, FLOAT, FLOAT, FLOAT *, FLOAT *, BLASLONG, FLOAT #endif }; -#ifdef SMPTEST +#ifdef SMP static int (*hpmv_thread[])(BLASLONG, FLOAT *, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = { #ifdef XDOUBLE xhpmv_thread_U, xhpmv_thread_L, xhpmv_thread_V, xhpmv_thread_M, @@ -90,7 +90,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, blasint info; int uplo; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -132,7 +132,7 @@ void CNAME(enum CBLAS_ORDER order, FLOAT *buffer; int uplo; blasint info; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -187,7 +187,7 @@ void CNAME(enum CBLAS_ORDER order, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -195,7 +195,7 @@ void CNAME(enum CBLAS_ORDER order, (hpmv[uplo])(n, alpha_r, alpha_i, a, x, incx, y, incy, buffer); -#ifdef SMPTEST +#ifdef SMP } else { (hpmv_thread[uplo])(n, ALPHA, a, x, incx, y, incy, buffer, nthreads); From 7bb19cf90edbbf3d21415d15414dc79e9bc33c33 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 11 May 2014 11:11:05 +0200 Subject: [PATCH 35/70] checked, that zhpr2 is OK --- interface/zhpr2.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/interface/zhpr2.c b/interface/zhpr2.c index 870124f7e..cf1d5f9fc 100644 --- a/interface/zhpr2.c +++ b/interface/zhpr2.c @@ -61,7 +61,7 @@ static int (*hpr2[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLON #endif }; -#ifdef SMPTEST +#ifdef SMP static int (*hpr2_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = { #ifdef XDOUBLE xhpr2_thread_U, xhpr2_thread_L, xhpr2_thread_V, xhpr2_thread_M, @@ -88,7 +88,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, blasint info; int uplo; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -127,7 +127,7 @@ void CNAME(enum CBLAS_ORDER order, FLOAT *buffer; int uplo; blasint info; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -181,7 +181,7 @@ void CNAME(enum CBLAS_ORDER order, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -189,7 +189,7 @@ void CNAME(enum CBLAS_ORDER order, (hpr2[uplo])(n, alpha_r, alpha_i, x, incx, y, incy, a, buffer); -#ifdef SMPTEST +#ifdef SMP } else { (hpr2_thread[uplo])(n, ALPHA, x, incx, y, incy, a, buffer, nthreads); From 4c1caa7454e587ef8c60c3e4d6fb332a6eee046c Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 11 May 2014 11:21:23 +0200 Subject: [PATCH 36/70] checked, that zhpr is OK --- interface/zhpr.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/interface/zhpr.c b/interface/zhpr.c index 736effd48..c48e35238 100644 --- a/interface/zhpr.c +++ b/interface/zhpr.c @@ -61,7 +61,7 @@ static int (*hpr[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, FLOAT *) = { #endif }; -#ifdef SMPTEST +#ifdef SMP static int (*hpr_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = { #ifdef XDOUBLE xhpr_thread_U, xhpr_thread_L, xhpr_thread_V, xhpr_thread_M, @@ -86,7 +86,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, blasint info; int uplo; FLOAT *buffer; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -121,7 +121,7 @@ void CNAME(enum CBLAS_ORDER order, FLOAT *buffer; int uplo; blasint info; -#ifdef SMPTEST +#ifdef SMP int nthreads; #endif @@ -171,7 +171,7 @@ void CNAME(enum CBLAS_ORDER order, buffer = (FLOAT *)blas_memory_alloc(1); -#ifdef SMPTEST +#ifdef SMP nthreads = num_cpu_avail(2); if (nthreads == 1) { @@ -179,7 +179,7 @@ void CNAME(enum CBLAS_ORDER order, (hpr[uplo])(n, alpha, x, incx, a, buffer); -#ifdef SMPTEST +#ifdef SMP } else { From 189ca1bceec45bdf3ed17bcdac3145fde91b0f56 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 11 May 2014 12:09:34 +0200 Subject: [PATCH 37/70] removed lapack objects from interface/Makefile --- interface/Makefile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/interface/Makefile b/interface/Makefile index a700e6542..708761559 100644 --- a/interface/Makefile +++ b/interface/Makefile @@ -2,11 +2,11 @@ TOPDIR = .. include $(TOPDIR)/Makefile.system ifeq ($(ARCH), x86) -SUPPORT_GEMM3M = 1 +SUPPORT_GEMM3M = 0 endif ifeq ($(ARCH), x86_64) -SUPPORT_GEMM3M = 1 +SUPPORT_GEMM3M = 0 endif ifeq ($(ARCH), ia64) @@ -372,15 +372,15 @@ XLAPACKOBJS = \ xpotf2.$(SUFFIX) xpotrf.$(SUFFIX) xtrti2.$(SUFFIX) xtrtri.$(SUFFIX) \ xlaswp.$(SUFFIX) xgetrs.$(SUFFIX) xgesv.$(SUFFIX) xpotri.$(SUFFIX) \ -ifneq ($(NO_LAPACK), 1) -SBLASOBJS += $(SLAPACKOBJS) -DBLASOBJS += $(DLAPACKOBJS) -QBLASOBJS += $(QLAPACKOBJS) -CBLASOBJS += $(CLAPACKOBJS) -ZBLASOBJS += $(ZLAPACKOBJS) -XBLASOBJS += $(XLAPACKOBJS) +#ifneq ($(NO_LAPACK), 1) +#SBLASOBJS += $(SLAPACKOBJS) +#DBLASOBJS += $(DLAPACKOBJS) +#QBLASOBJS += $(QLAPACKOBJS) +#CBLASOBJS += $(CLAPACKOBJS) +#ZBLASOBJS += $(ZLAPACKOBJS) +#XBLASOBJS += $(XLAPACKOBJS) -endif +#endif FUNCOBJS = $(SBLASOBJS) $(DBLASOBJS) $(CBLASOBJS) $(ZBLASOBJS) From 5e5ef28ca04edae717e5da7b529a59d6c21caf0f Mon Sep 17 00:00:00 2001 From: wernsaar Date: Tue, 13 May 2014 15:36:03 +0200 Subject: [PATCH 38/70] added ZERO check because bug in lapack-test --- kernel/arm/scal.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/kernel/arm/scal.c b/kernel/arm/scal.c index d385c46bc..ff78e6764 100644 --- a/kernel/arm/scal.c +++ b/kernel/arm/scal.c @@ -38,20 +38,21 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da, FLOAT *x, BLASLONG inc_x, FLOAT *y, BLASLONG inc_y, FLOAT *dummy, BLASLONG dummy2) { - BLASLONG i=0; + BLASLONG i=0,j=0; - if ( n < 0 || inc_x < 1 ) return(0); - if ( da == 1.0 ) return(0); - - n *= inc_x; - while(i < n) + while(j < n) { - x[i] = da * x[i] ; + if ( da == 0.0 ) + x[i]=0.0; + else + x[i] = da * x[i] ; + i += inc_x ; + j++; } - return(0); + return; } From aa5c73e20f7d397e578f4b47ead214d015eb75f1 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Tue, 13 May 2014 16:25:21 +0200 Subject: [PATCH 39/70] added ZERO check to zscal.c because bug in lapack-test --- kernel/arm/zscal.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/kernel/arm/zscal.c b/kernel/arm/zscal.c index 833dc8c03..569e2503e 100644 --- a/kernel/arm/zscal.c +++ b/kernel/arm/zscal.c @@ -43,19 +43,39 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da_r,FLOAT da_i, F BLASLONG ip = 0; FLOAT temp; - if ( n < 0 || inc_x < 1 ) return(0); - inc_x2 = 2 * inc_x; for ( i=0; i Date: Tue, 13 May 2014 17:25:19 +0200 Subject: [PATCH 40/70] added ARMV5 as reference platform --- Makefile.arm | 6 ++ common.h | 2 +- getarch.c | 16 +++++ kernel/arm/KERNEL.ARMV5 | 134 ++++++++++++++++++++++++++++++++++++++++ param.h | 40 ++++++++++++ 5 files changed, 197 insertions(+), 1 deletion(-) create mode 100644 kernel/arm/KERNEL.ARMV5 diff --git a/Makefile.arm b/Makefile.arm index 8502d5286..5bdd4d151 100644 --- a/Makefile.arm +++ b/Makefile.arm @@ -10,3 +10,9 @@ FCOMMON_OPT += -marm -mfpu=vfp -mfloat-abi=hard -march=armv6 endif +ifeq ($(CORE), ARMV5) +CCOMMON_OPT += -marm -mfpu=vfp -mfloat-abi=hard -march=armv6 +FCOMMON_OPT += -marm -mfpu=vfp -mfloat-abi=hard -march=armv6 +endif + + diff --git a/common.h b/common.h index 57294eb02..41c014a90 100644 --- a/common.h +++ b/common.h @@ -310,7 +310,7 @@ typedef int blasint; #define YIELDING SwitchToThread() #endif -#if defined(ARMV7) || defined(ARMV6) || defined(ARMV8) +#if defined(ARMV7) || defined(ARMV6) || defined(ARMV8) || defined(ARMV5) #define YIELDING asm volatile ("nop;nop;nop;nop;nop;nop;nop;nop; \n"); #endif diff --git a/getarch.c b/getarch.c index 6e1938434..b100eb52f 100644 --- a/getarch.c +++ b/getarch.c @@ -724,6 +724,22 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #else #endif +#ifdef FORCE_ARMV5 +#define FORCE +#define ARCHITECTURE "ARM" +#define SUBARCHITECTURE "ARMV5" +#define SUBDIRNAME "arm" +#define ARCHCONFIG "-DARMV5 " \ + "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \ + "-DL2_SIZE=512488 -DL2_LINESIZE=32 " \ + "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 " \ + "-DHAVE_VFP" +#define LIBNAME "armv5" +#define CORENAME "ARMV5" +#else +#endif + + #ifdef FORCE_ARMV8 #define FORCE #define ARCHITECTURE "ARM64" diff --git a/kernel/arm/KERNEL.ARMV5 b/kernel/arm/KERNEL.ARMV5 new file mode 100644 index 000000000..ecf278cf9 --- /dev/null +++ b/kernel/arm/KERNEL.ARMV5 @@ -0,0 +1,134 @@ +SAMAXKERNEL = ../arm/amax.c +DAMAXKERNEL = ../arm/amax.c +CAMAXKERNEL = ../arm/zamax.c +ZAMAXKERNEL = ../arm/zamax.c + +SAMINKERNEL = ../arm/amin.c +DAMINKERNEL = ../arm/amin.c +CAMINKERNEL = ../arm/zamin.c +ZAMINKERNEL = ../arm/zamin.c + +SMAXKERNEL = ../arm/max.c +DMAXKERNEL = ../arm/max.c + +SMINKERNEL = ../arm/min.c +DMINKERNEL = ../arm/min.c + +ISAMAXKERNEL = ../arm/iamax.c +IDAMAXKERNEL = ../arm/iamax.c +ICAMAXKERNEL = ../arm/izamax.c +IZAMAXKERNEL = ../arm/izamax.c + +ISAMINKERNEL = ../arm/iamin.c +IDAMINKERNEL = ../arm/iamin.c +ICAMINKERNEL = ../arm/izamin.c +IZAMINKERNEL = ../arm/izamin.c + +ISMAXKERNEL = ../arm/imax.c +IDMAXKERNEL = ../arm/imax.c + +ISMINKERNEL = ../arm/imin.c +IDMINKERNEL = ../arm/imin.c + +SASUMKERNEL = ../arm/asum.c +DASUMKERNEL = ../arm/asum.c +CASUMKERNEL = ../arm/zasum.c +ZASUMKERNEL = ../arm/zasum.c + +SAXPYKERNEL = ../arm/axpy.c +DAXPYKERNEL = ../arm/axpy.c +CAXPYKERNEL = ../arm/zaxpy.c +ZAXPYKERNEL = ../arm/zaxpy.c + +SCOPYKERNEL = ../arm/copy.c +DCOPYKERNEL = ../arm/copy.c +CCOPYKERNEL = ../arm/zcopy.c +ZCOPYKERNEL = ../arm/zcopy.c + +SDOTKERNEL = ../arm/dot.c +DDOTKERNEL = ../arm/dot.c +CDOTKERNEL = ../arm/zdot.c +ZDOTKERNEL = ../arm/zdot.c + +SNRM2KERNEL = ../arm/nrm2.c +DNRM2KERNEL = ../arm/nrm2.c +CNRM2KERNEL = ../arm/znrm2.c +ZNRM2KERNEL = ../arm/znrm2.c + +SROTKERNEL = ../arm/rot.c +DROTKERNEL = ../arm/rot.c +CROTKERNEL = ../arm/zrot.c +ZROTKERNEL = ../arm/zrot.c + +SSCALKERNEL = ../arm/scal.c +DSCALKERNEL = ../arm/scal.c +CSCALKERNEL = ../arm/zscal.c +ZSCALKERNEL = ../arm/zscal.c + +SSWAPKERNEL = ../arm/swap.c +DSWAPKERNEL = ../arm/swap.c +CSWAPKERNEL = ../arm/zswap.c +ZSWAPKERNEL = ../arm/zswap.c + +SGEMVNKERNEL = ../arm/gemv_n.c +DGEMVNKERNEL = ../arm/gemv_n.c +CGEMVNKERNEL = ../arm/zgemv_n.c +ZGEMVNKERNEL = ../arm/zgemv_n.c + +SGEMVTKERNEL = ../arm/gemv_t.c +DGEMVTKERNEL = ../arm/gemv_t.c +CGEMVTKERNEL = ../arm/zgemv_t.c +ZGEMVTKERNEL = ../arm/zgemv_t.c + +STRMMKERNEL = ../generic/trmmkernel_2x2.c +DTRMMKERNEL = ../generic/trmmkernel_2x2.c +CTRMMKERNEL = ../generic/ztrmmkernel_2x2.c +ZTRMMKERNEL = ../generic/ztrmmkernel_2x2.c + +SGEMMKERNEL = ../generic/gemmkernel_2x2.c +SGEMMONCOPY = ../generic/gemm_ncopy_2.c +SGEMMOTCOPY = ../generic/gemm_tcopy_2.c +SGEMMONCOPYOBJ = sgemm_oncopy.o +SGEMMOTCOPYOBJ = sgemm_otcopy.o + +DGEMMKERNEL = ../generic/gemmkernel_2x2.c +DGEMMONCOPY = ../generic/gemm_ncopy_2.c +DGEMMOTCOPY = ../generic/gemm_tcopy_2.c +DGEMMONCOPYOBJ = dgemm_oncopy.o +DGEMMOTCOPYOBJ = dgemm_otcopy.o + +CGEMMKERNEL = ../generic/zgemmkernel_2x2.c +CGEMMONCOPY = ../generic/zgemm_ncopy_2.c +CGEMMOTCOPY = ../generic/zgemm_tcopy_2.c +CGEMMONCOPYOBJ = cgemm_oncopy.o +CGEMMOTCOPYOBJ = cgemm_otcopy.o + +ZGEMMKERNEL = ../generic/zgemmkernel_2x2.c +ZGEMMONCOPY = ../generic/zgemm_ncopy_2.c +ZGEMMOTCOPY = ../generic/zgemm_tcopy_2.c +ZGEMMONCOPYOBJ = zgemm_oncopy.o +ZGEMMOTCOPYOBJ = zgemm_otcopy.o + +STRSMKERNEL_LN = ../generic/trsm_kernel_LN.c +STRSMKERNEL_LT = ../generic/trsm_kernel_LT.c +STRSMKERNEL_RN = ../generic/trsm_kernel_RN.c +STRSMKERNEL_RT = ../generic/trsm_kernel_RT.c + +DTRSMKERNEL_LN = ../generic/trsm_kernel_LN.c +DTRSMKERNEL_LT = ../generic/trsm_kernel_LT.c +DTRSMKERNEL_RN = ../generic/trsm_kernel_RN.c +DTRSMKERNEL_RT = ../generic/trsm_kernel_RT.c + +CTRSMKERNEL_LN = ../generic/trsm_kernel_LN.c +CTRSMKERNEL_LT = ../generic/trsm_kernel_LT.c +CTRSMKERNEL_RN = ../generic/trsm_kernel_RN.c +CTRSMKERNEL_RT = ../generic/trsm_kernel_RT.c + +ZTRSMKERNEL_LN = ../generic/trsm_kernel_LN.c +ZTRSMKERNEL_LT = ../generic/trsm_kernel_LT.c +ZTRSMKERNEL_RN = ../generic/trsm_kernel_RN.c +ZTRSMKERNEL_RT = ../generic/trsm_kernel_RT.c + + + + diff --git a/param.h b/param.h index efec08b85..ae40ac1d7 100644 --- a/param.h +++ b/param.h @@ -2021,6 +2021,46 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endif +#if defined(ARMV5) +#define SNUMOPT 2 +#define DNUMOPT 2 + +#define GEMM_DEFAULT_OFFSET_A 0 +#define GEMM_DEFAULT_OFFSET_B 0 +#define GEMM_DEFAULT_ALIGN 0x03fffUL + +#define SGEMM_DEFAULT_UNROLL_M 2 +#define SGEMM_DEFAULT_UNROLL_N 2 + +#define DGEMM_DEFAULT_UNROLL_M 2 +#define DGEMM_DEFAULT_UNROLL_N 2 + +#define CGEMM_DEFAULT_UNROLL_M 2 +#define CGEMM_DEFAULT_UNROLL_N 2 + +#define ZGEMM_DEFAULT_UNROLL_M 2 +#define ZGEMM_DEFAULT_UNROLL_N 2 + +#define SGEMM_DEFAULT_P 128 +#define DGEMM_DEFAULT_P 128 +#define CGEMM_DEFAULT_P 96 +#define ZGEMM_DEFAULT_P 64 + +#define SGEMM_DEFAULT_Q 240 +#define DGEMM_DEFAULT_Q 120 +#define CGEMM_DEFAULT_Q 120 +#define ZGEMM_DEFAULT_Q 120 + +#define SGEMM_DEFAULT_R 12288 +#define DGEMM_DEFAULT_R 8192 +#define CGEMM_DEFAULT_R 4096 +#define ZGEMM_DEFAULT_R 4096 + + +#define SYMV_P 16 +#endif + + #ifdef GENERIC From a0b07c144035dba0d9e01e3c9791d858ec68cedd Mon Sep 17 00:00:00 2001 From: wernsaar Date: Wed, 14 May 2014 12:59:20 +0200 Subject: [PATCH 41/70] bugfixs for ARM regarding lapack tests --- kernel/arm/KERNEL.ARMV6 | 35 +++++++++++++++++++++++++---------- kernel/arm/KERNEL.ARMV7 | 17 +++++++++++------ 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/kernel/arm/KERNEL.ARMV6 b/kernel/arm/KERNEL.ARMV6 index 02627cbd0..2810c6500 100644 --- a/kernel/arm/KERNEL.ARMV6 +++ b/kernel/arm/KERNEL.ARMV6 @@ -1,3 +1,18 @@ +SGEMVNKERNEL = ../arm/gemv_n.c +SGEMVTKERNEL = ../arm/gemv_t.c + +CTRMMKERNEL = ../generic/ztrmmkernel_2x2.c +CGEMMKERNEL = ../generic/zgemmkernel_2x2.c +CGEMMONCOPY = ../generic/zgemm_ncopy_2.c +CGEMMOTCOPY = ../generic/zgemm_tcopy_2.c + +#STRMMKERNEL = ../generic/trmmkernel_2x2.c +#SGEMMKERNEL = ../generic/gemmkernel_2x2.c +#SGEMMONCOPY = ../generic/gemm_ncopy_2.c +#SGEMMOTCOPY = ../generic/gemm_tcopy_2.c + + +############################################################################### SAMAXKERNEL = iamax_vfp.S DAMAXKERNEL = iamax_vfp.S CAMAXKERNEL = iamax_vfp.S @@ -60,29 +75,29 @@ DROTKERNEL = rot_vfp.S CROTKERNEL = rot_vfp.S ZROTKERNEL = rot_vfp.S -SSCALKERNEL = scal_vfp.S -DSCALKERNEL = scal_vfp.S -CSCALKERNEL = scal_vfp.S -ZSCALKERNEL = scal_vfp.S +SSCALKERNEL = scal.c +DSCALKERNEL = scal.c +CSCALKERNEL = zscal.c +ZSCALKERNEL = zscal.c SSWAPKERNEL = swap_vfp.S DSWAPKERNEL = swap_vfp.S CSWAPKERNEL = swap_vfp.S ZSWAPKERNEL = swap_vfp.S -SGEMVNKERNEL = gemv_n_vfp.S +# BAD SGEMVNKERNEL = gemv_n_vfp.S DGEMVNKERNEL = gemv_n_vfp.S CGEMVNKERNEL = cgemv_n_vfp.S ZGEMVNKERNEL = zgemv_n_vfp.S -SGEMVTKERNEL = gemv_t_vfp.S +# BAD SGEMVTKERNEL = gemv_t_vfp.S DGEMVTKERNEL = gemv_t_vfp.S CGEMVTKERNEL = cgemv_t_vfp.S ZGEMVTKERNEL = zgemv_t_vfp.S STRMMKERNEL = strmm_kernel_4x2_vfp.S DTRMMKERNEL = dtrmm_kernel_4x2_vfp.S -CTRMMKERNEL = ctrmm_kernel_2x2_vfp.S +# CTRMMKERNEL = ctrmm_kernel_2x2_vfp.S ZTRMMKERNEL = ztrmm_kernel_2x2_vfp.S SGEMMKERNEL = sgemm_kernel_4x2_vfp.S @@ -105,9 +120,9 @@ DGEMMOTCOPY = ../generic/gemm_tcopy_2.c DGEMMONCOPYOBJ = dgemm_oncopy.o DGEMMOTCOPYOBJ = dgemm_otcopy.o -CGEMMKERNEL = cgemm_kernel_2x2_vfp.S -CGEMMONCOPY = cgemm_ncopy_2_vfp.S -CGEMMOTCOPY = cgemm_tcopy_2_vfp.S +#CGEMMKERNEL = cgemm_kernel_2x2_vfp.S +#CGEMMONCOPY = cgemm_ncopy_2_vfp.S +#CGEMMOTCOPY = cgemm_tcopy_2_vfp.S CGEMMONCOPYOBJ = cgemm_oncopy.o CGEMMOTCOPYOBJ = cgemm_otcopy.o diff --git a/kernel/arm/KERNEL.ARMV7 b/kernel/arm/KERNEL.ARMV7 index df66388db..790883e5e 100644 --- a/kernel/arm/KERNEL.ARMV7 +++ b/kernel/arm/KERNEL.ARMV7 @@ -1,3 +1,8 @@ +SGEMVNKERNEL = ../arm/gemv_n.c +SGEMVTKERNEL = ../arm/gemv_t.c + + +################################################################################# SAMAXKERNEL = iamax_vfp.S DAMAXKERNEL = iamax_vfp.S CAMAXKERNEL = iamax_vfp.S @@ -65,17 +70,17 @@ DROTKERNEL = rot_vfp.S CROTKERNEL = rot_vfp.S ZROTKERNEL = rot_vfp.S -SSCALKERNEL = scal_vfp.S +SSCALKERNEL = scal.c DSCALKERNEL = scal.c -CSCALKERNEL = scal_vfp.S -ZSCALKERNEL = scal_vfp.S +CSCALKERNEL = zscal.c +ZSCALKERNEL = zscal.c -SGEMVNKERNEL = gemv_n_vfp.S -DGEMVNKERNEL = gemv_n.c +# BAD SGEMVNKERNEL = gemv_n_vfp.S +DGEMVNKERNEL = gemv_n_vfp.S CGEMVNKERNEL = cgemv_n_vfp.S ZGEMVNKERNEL = zgemv_n_vfp.S -SGEMVTKERNEL = gemv_t_vfp.S +# BAD SGEMVTKERNEL = gemv_t_vfp.S DGEMVTKERNEL = gemv_t_vfp.S CGEMVTKERNEL = cgemv_t_vfp.S ZGEMVTKERNEL = zgemv_t_vfp.S From 8877c6db51891dab188fc3d644f82d0e2ecb2af3 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Wed, 14 May 2014 13:08:05 +0200 Subject: [PATCH 42/70] changed label lapack-test --- Makefile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index c2a019305..558850180 100644 --- a/Makefile +++ b/Makefile @@ -293,11 +293,8 @@ endif lapack-test : - $(MAKE) -C $(NETLIB_LAPACK_DIR) tmglib - $(MAKE) -C $(NETLIB_LAPACK_DIR)/TESTING xeigtstc xeigtstd xeigtsts xeigtstz xlintstc xlintstd xlintstds xlintsts xlintstz xlintstzc - @rm -f $(NETLIB_LAPACK_DIR)/TESTING/*.out - $(MAKE) -j 1 -C $(NETLIB_LAPACK_DIR)/TESTING - $(GREP) failed $(NETLIB_LAPACK_DIR)/TESTING/*.out + make -j 1 -C $(NETLIB_LAPACK_DIR) tmglib + make -j 1 -C $(NETLIB_LAPACK_DIR)/TESTING xeigtstc xeigtstd xeigtsts xeigtstz xlintstc xlintstd xlintstds xlintstrfd xlintstrfz xlintsts xlintstz xlintstzc xlintstrfs xlintstrfc dummy : From d18bc5468f3cc508605d58e0579f3d0d849762d6 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Wed, 14 May 2014 15:01:03 +0200 Subject: [PATCH 43/70] added FCOMMON_OPT for lapack --- Makefile.rule | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile.rule b/Makefile.rule index e4b0465f5..5714dc3c1 100644 --- a/Makefile.rule +++ b/Makefile.rule @@ -129,6 +129,9 @@ VERSION = 0.2.9.rc2 # The default -O2 is enough. # COMMON_OPT = -O2 +# gfortran option for LAPACK +FCOMMON_OPT=-frecursive + # Profiling flags COMMON_PROF = -pg From 4a5938b5cc658935ab55668795cf02983564bb1c Mon Sep 17 00:00:00 2001 From: wernsaar Date: Wed, 14 May 2014 15:16:21 +0200 Subject: [PATCH 44/70] Modified lapack-test, using lapack_testing.py to run tests --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 558850180..a48260624 100644 --- a/Makefile +++ b/Makefile @@ -295,6 +295,8 @@ endif lapack-test : make -j 1 -C $(NETLIB_LAPACK_DIR) tmglib make -j 1 -C $(NETLIB_LAPACK_DIR)/TESTING xeigtstc xeigtstd xeigtsts xeigtstz xlintstc xlintstd xlintstds xlintstrfd xlintstrfz xlintsts xlintstz xlintstzc xlintstrfs xlintstrfc + (cd $(NETLIB_LAPACK_DIR); ./lapack_testing.py -r ) + dummy : From d751224ea43860fe4d3f4b6bb9f6ead406579391 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Thu, 15 May 2014 11:37:38 +0200 Subject: [PATCH 45/70] changed YIELDING for BULLDOZER --- common.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common.h b/common.h index 41c014a90..49e2946e7 100644 --- a/common.h +++ b/common.h @@ -314,6 +314,13 @@ typedef int blasint; #define YIELDING asm volatile ("nop;nop;nop;nop;nop;nop;nop;nop; \n"); #endif +#ifdef BULLDOZER +#ifndef YIELDING +#define YIELDING __asm__ __volatile__ ("nop;nop;nop;nop;nop;nop;nop;nop;\n"); +#endif +#endif + + #ifdef PILEDRIVER #ifndef YIELDING #define YIELDING __asm__ __volatile__ ("nop;nop;nop;nop;nop;nop;nop;nop;\n"); From 5953972a5a44554277da5dce092adfb09eea342f Mon Sep 17 00:00:00 2001 From: wernsaar Date: Fri, 16 May 2014 14:32:10 +0200 Subject: [PATCH 46/70] changed threshold for 50.0 to 54.0 in svd.in --- lapack-netlib/TESTING/svd.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lapack-netlib/TESTING/svd.in b/lapack-netlib/TESTING/svd.in index bc0ae2d2e..1de42807d 100644 --- a/lapack-netlib/TESTING/svd.in +++ b/lapack-netlib/TESTING/svd.in @@ -7,7 +7,7 @@ SVD: Data file for testing Singular Value Decomposition routines 2 2 2 2 2 Values of NBMIN (minimum blocksize) 1 0 5 9 1 Values of NX (crossover point) 2 0 2 2 2 Values of NRHS -50.0 Threshold value +54.0 Threshold value T Put T to test the LAPACK routines T Put T to test the driver routines T Put T to test the error exits From 409b52255cee4131d9d072f56b7b87f4a4dda181 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Fri, 16 May 2014 14:36:24 +0200 Subject: [PATCH 47/70] changed default optimization flag from O3 to O2 for ARM --- Makefile.system | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/Makefile.system b/Makefile.system index bbd7e5621..ade4f9320 100644 --- a/Makefile.system +++ b/Makefile.system @@ -847,19 +847,6 @@ ifeq ($(DEBUG), 1) COMMON_OPT += -g endif -ifndef COMMON_OPT -ifeq ($(ARCH), arm) -COMMON_OPT = -O3 -endif -endif - -ifndef COMMON_OPT -ifeq ($(ARCH), arm64) -COMMON_OPT = -O3 -endif -endif - - ifndef COMMON_OPT COMMON_OPT = -O2 endif From 165d5436b513ffed3157baa46d8e056e35177828 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Fri, 16 May 2014 20:34:48 +0200 Subject: [PATCH 48/70] changed threshold to 50.0 --- lapack-netlib/TESTING/ctest_rfp.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lapack-netlib/TESTING/ctest_rfp.in b/lapack-netlib/TESTING/ctest_rfp.in index 8ffb27a32..612bd8efb 100644 --- a/lapack-netlib/TESTING/ctest_rfp.in +++ b/lapack-netlib/TESTING/ctest_rfp.in @@ -5,5 +5,5 @@ Data file for testing COMPLEX LAPACK linear equation routines RFP format 1 2 15 Values of NRHS (number of right hand sides) 9 Number of matrix types (list types on next line if 0 < NTYPES < 9) 1 2 3 4 5 6 7 8 9 Matrix Types -40.0 Threshold value of test ratio +50.0 Threshold value of test ratio T Put T to test the error exits From e826a5a6afefa98b8221c7344d6b06b5e91f863b Mon Sep 17 00:00:00 2001 From: wernsaar Date: Fri, 16 May 2014 20:37:41 +0200 Subject: [PATCH 49/70] some modifications regarding lapack test --- kernel/arm/KERNEL.ARMV6 | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/kernel/arm/KERNEL.ARMV6 b/kernel/arm/KERNEL.ARMV6 index 2810c6500..c64d09088 100644 --- a/kernel/arm/KERNEL.ARMV6 +++ b/kernel/arm/KERNEL.ARMV6 @@ -1,11 +1,20 @@ SGEMVNKERNEL = ../arm/gemv_n.c SGEMVTKERNEL = ../arm/gemv_t.c +DGEMVNKERNEL = ../arm/gemv_n.c +DGEMVTKERNEL = ../arm/gemv_t.c + CTRMMKERNEL = ../generic/ztrmmkernel_2x2.c CGEMMKERNEL = ../generic/zgemmkernel_2x2.c CGEMMONCOPY = ../generic/zgemm_ncopy_2.c CGEMMOTCOPY = ../generic/zgemm_tcopy_2.c +ZTRMMKERNEL = ../generic/ztrmmkernel_2x2.c +ZGEMMKERNEL = ../generic/zgemmkernel_2x2.c +ZGEMMONCOPY = ../generic/zgemm_ncopy_2.c +ZGEMMOTCOPY = ../generic/zgemm_tcopy_2.c + + #STRMMKERNEL = ../generic/trmmkernel_2x2.c #SGEMMKERNEL = ../generic/gemmkernel_2x2.c #SGEMMONCOPY = ../generic/gemm_ncopy_2.c @@ -86,19 +95,19 @@ CSWAPKERNEL = swap_vfp.S ZSWAPKERNEL = swap_vfp.S # BAD SGEMVNKERNEL = gemv_n_vfp.S -DGEMVNKERNEL = gemv_n_vfp.S +# BAD DGEMVNKERNEL = gemv_n_vfp.S CGEMVNKERNEL = cgemv_n_vfp.S ZGEMVNKERNEL = zgemv_n_vfp.S # BAD SGEMVTKERNEL = gemv_t_vfp.S -DGEMVTKERNEL = gemv_t_vfp.S +# BAD DGEMVTKERNEL = gemv_t_vfp.S CGEMVTKERNEL = cgemv_t_vfp.S ZGEMVTKERNEL = zgemv_t_vfp.S STRMMKERNEL = strmm_kernel_4x2_vfp.S DTRMMKERNEL = dtrmm_kernel_4x2_vfp.S # CTRMMKERNEL = ctrmm_kernel_2x2_vfp.S -ZTRMMKERNEL = ztrmm_kernel_2x2_vfp.S +# ZTRMMKERNEL = ztrmm_kernel_2x2_vfp.S SGEMMKERNEL = sgemm_kernel_4x2_vfp.S SGEMMINCOPY = sgemm_ncopy_4_vfp.S @@ -126,9 +135,9 @@ DGEMMOTCOPYOBJ = dgemm_otcopy.o CGEMMONCOPYOBJ = cgemm_oncopy.o CGEMMOTCOPYOBJ = cgemm_otcopy.o -ZGEMMKERNEL = zgemm_kernel_2x2_vfp.S -ZGEMMONCOPY = zgemm_ncopy_2_vfp.S -ZGEMMOTCOPY = zgemm_tcopy_2_vfp.S +#ZGEMMKERNEL = zgemm_kernel_2x2_vfp.S +#ZGEMMONCOPY = zgemm_ncopy_2_vfp.S +#ZGEMMOTCOPY = zgemm_tcopy_2_vfp.S ZGEMMONCOPYOBJ = zgemm_oncopy.o ZGEMMOTCOPYOBJ = zgemm_otcopy.o From e52532a9fea2c0133cee98b75931b217b28ae750 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sat, 17 May 2014 11:18:26 +0200 Subject: [PATCH 50/70] enable debug for lapack testing --- Makefile.rule | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile.rule b/Makefile.rule index 5714dc3c1..9c2847a5c 100644 --- a/Makefile.rule +++ b/Makefile.rule @@ -76,10 +76,10 @@ VERSION = 0.2.9.rc2 # Unfortunately most of kernel won't give us high quality buffer. # BLAS tries to find the best region before entering main function, # but it will consume time. If you don't like it, you can disable one. -# NO_WARMUP = 1 +NO_WARMUP = 1 # If you want to disable CPU/Memory affinity on Linux. -# NO_AFFINITY = 1 +NO_AFFINITY = 1 # Don't use AVX kernel on Sandy Bridge. It is compatible with old compilers # and OS. However, the performance is low. @@ -127,16 +127,16 @@ VERSION = 0.2.9.rc2 # Common Optimization Flag; # The default -O2 is enough. -# COMMON_OPT = -O2 +COMMON_OPT = -O0 # gfortran option for LAPACK -FCOMMON_OPT=-frecursive +FCOMMON_OPT = -frecursive # Profiling flags COMMON_PROF = -pg # Build Debug version -# DEBUG = 1 +DEBUG = 1 # # End of user configuration From aaddb054117ca914c2bc75b8fb9e4af5c837bf22 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sat, 17 May 2014 13:00:36 +0200 Subject: [PATCH 51/70] bugfix for ARMV6 --- kernel/arm/KERNEL.ARMV6 | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/kernel/arm/KERNEL.ARMV6 b/kernel/arm/KERNEL.ARMV6 index c64d09088..3b19efb33 100644 --- a/kernel/arm/KERNEL.ARMV6 +++ b/kernel/arm/KERNEL.ARMV6 @@ -9,10 +9,10 @@ CGEMMKERNEL = ../generic/zgemmkernel_2x2.c CGEMMONCOPY = ../generic/zgemm_ncopy_2.c CGEMMOTCOPY = ../generic/zgemm_tcopy_2.c -ZTRMMKERNEL = ../generic/ztrmmkernel_2x2.c -ZGEMMKERNEL = ../generic/zgemmkernel_2x2.c -ZGEMMONCOPY = ../generic/zgemm_ncopy_2.c -ZGEMMOTCOPY = ../generic/zgemm_tcopy_2.c +#ZTRMMKERNEL = ../generic/ztrmmkernel_2x2.c +#ZGEMMKERNEL = ../generic/zgemmkernel_2x2.c +#ZGEMMONCOPY = ../generic/zgemm_ncopy_2.c +#ZGEMMOTCOPY = ../generic/zgemm_tcopy_2.c #STRMMKERNEL = ../generic/trmmkernel_2x2.c @@ -21,6 +21,7 @@ ZGEMMOTCOPY = ../generic/zgemm_tcopy_2.c #SGEMMOTCOPY = ../generic/gemm_tcopy_2.c + ############################################################################### SAMAXKERNEL = iamax_vfp.S DAMAXKERNEL = iamax_vfp.S @@ -106,8 +107,8 @@ ZGEMVTKERNEL = zgemv_t_vfp.S STRMMKERNEL = strmm_kernel_4x2_vfp.S DTRMMKERNEL = dtrmm_kernel_4x2_vfp.S -# CTRMMKERNEL = ctrmm_kernel_2x2_vfp.S -# ZTRMMKERNEL = ztrmm_kernel_2x2_vfp.S +#CTRMMKERNEL = ctrmm_kernel_2x2_vfp.S +ZTRMMKERNEL = ztrmm_kernel_2x2_vfp.S SGEMMKERNEL = sgemm_kernel_4x2_vfp.S SGEMMINCOPY = sgemm_ncopy_4_vfp.S @@ -135,9 +136,9 @@ DGEMMOTCOPYOBJ = dgemm_otcopy.o CGEMMONCOPYOBJ = cgemm_oncopy.o CGEMMOTCOPYOBJ = cgemm_otcopy.o -#ZGEMMKERNEL = zgemm_kernel_2x2_vfp.S -#ZGEMMONCOPY = zgemm_ncopy_2_vfp.S -#ZGEMMOTCOPY = zgemm_tcopy_2_vfp.S +ZGEMMKERNEL = zgemm_kernel_2x2_vfp.S +ZGEMMONCOPY = zgemm_ncopy_2_vfp.S +ZGEMMOTCOPY = zgemm_tcopy_2_vfp.S ZGEMMONCOPYOBJ = zgemm_oncopy.o ZGEMMOTCOPYOBJ = zgemm_otcopy.o From c0cf875a821698467bbc055280f4b7efef5e3f1b Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 18 May 2014 14:09:22 +0200 Subject: [PATCH 52/70] added optimized lapack files from OpenBLAS --- interface/lapack/gesv.c | 154 ++++++++++++++++++++++++++++++++++++ interface/lapack/getf2.c | 109 ++++++++++++++++++++++++++ interface/lapack/getrf.c | 121 ++++++++++++++++++++++++++++ interface/lapack/getrs.c | 152 ++++++++++++++++++++++++++++++++++++ interface/lapack/larf.c | 109 ++++++++++++++++++++++++++ interface/lapack/laswp.c | 110 ++++++++++++++++++++++++++ interface/lapack/lauu2.c | 128 ++++++++++++++++++++++++++++++ interface/lapack/lauum.c | 139 +++++++++++++++++++++++++++++++++ interface/lapack/potf2.c | 128 ++++++++++++++++++++++++++++++ interface/lapack/potrf.c | 139 +++++++++++++++++++++++++++++++++ interface/lapack/potri.c | 160 ++++++++++++++++++++++++++++++++++++++ interface/lapack/zgetf2.c | 109 ++++++++++++++++++++++++++ interface/lapack/zgetrf.c | 122 +++++++++++++++++++++++++++++ interface/lapack/zgetrs.c | 153 ++++++++++++++++++++++++++++++++++++ interface/lapack/zlaswp.c | 108 +++++++++++++++++++++++++ interface/lapack/zlauu2.c | 129 ++++++++++++++++++++++++++++++ interface/lapack/zlauum.c | 141 +++++++++++++++++++++++++++++++++ interface/lapack/zpotf2.c | 129 ++++++++++++++++++++++++++++++ interface/lapack/zpotrf.c | 141 +++++++++++++++++++++++++++++++++ interface/lapack/zpotri.c | 157 +++++++++++++++++++++++++++++++++++++ 20 files changed, 2638 insertions(+) create mode 100644 interface/lapack/gesv.c create mode 100644 interface/lapack/getf2.c create mode 100644 interface/lapack/getrf.c create mode 100644 interface/lapack/getrs.c create mode 100644 interface/lapack/larf.c create mode 100644 interface/lapack/laswp.c create mode 100644 interface/lapack/lauu2.c create mode 100644 interface/lapack/lauum.c create mode 100644 interface/lapack/potf2.c create mode 100644 interface/lapack/potrf.c create mode 100644 interface/lapack/potri.c create mode 100644 interface/lapack/zgetf2.c create mode 100644 interface/lapack/zgetrf.c create mode 100644 interface/lapack/zgetrs.c create mode 100644 interface/lapack/zlaswp.c create mode 100644 interface/lapack/zlauu2.c create mode 100644 interface/lapack/zlauum.c create mode 100644 interface/lapack/zpotf2.c create mode 100644 interface/lapack/zpotrf.c create mode 100644 interface/lapack/zpotri.c diff --git a/interface/lapack/gesv.c b/interface/lapack/gesv.c new file mode 100644 index 000000000..ce6bcbd0b --- /dev/null +++ b/interface/lapack/gesv.c @@ -0,0 +1,154 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifndef COMPLEX +#ifdef XDOUBLE +#define ERROR_NAME "QGESV " +#elif defined(DOUBLE) +#define ERROR_NAME "DGESV " +#else +#define ERROR_NAME "SGESV " +#endif +#else +#ifdef XDOUBLE +#define ERROR_NAME "XGESV " +#elif defined(DOUBLE) +#define ERROR_NAME "ZGESV " +#else +#define ERROR_NAME "CGESV " +#endif +#endif + +int NAME(blasint *N, blasint *NRHS, FLOAT *a, blasint *ldA, blasint *ipiv, + FLOAT *b, blasint *ldB, blasint *Info){ + + blas_arg_t args; + + blasint info; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.m = *N; + args.n = *NRHS; + args.a = (void *)a; + args.lda = *ldA; + args.b = (void *)b; + args.ldb = *ldB; + args.c = (void *)ipiv; + + info = 0; + if (args.ldb < MAX(1,args.m)) info = 7; + if (args.lda < MAX(1,args.m)) info = 4; + if (args.n < 0) info = 2; + if (args.m < 0) info = 1; + + if (info) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + *Info = - info; + return 0; + } + + args.alpha = NULL; + args.beta = NULL; + + *Info = 0; + + if (args.m == 0 || args.n == 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + +#ifdef SMP + args.common = NULL; + args.nthreads = num_cpu_avail(4); + + if (args.nthreads == 1) { +#endif + + args.n = *N; + info = GETRF_SINGLE(&args, NULL, NULL, sa, sb, 0); + + if (info == 0){ + args.n = *NRHS; + GETRS_N_SINGLE(&args, NULL, NULL, sa, sb, 0); + } + +#ifdef SMP + } else { + + args.n = *N; + info = GETRF_PARALLEL(&args, NULL, NULL, sa, sb, 0); + + if (info == 0){ + args.n = *NRHS; + GETRS_N_PARALLEL(&args, NULL, NULL, sa, sb, 0); + } + } +#endif + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + *Info = info; + + FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, *N * *N, 2. / 3. * *N * *N * *N + *N * *N); + + IDEBUG_END; + + return 0; +} diff --git a/interface/lapack/getf2.c b/interface/lapack/getf2.c new file mode 100644 index 000000000..cae15953b --- /dev/null +++ b/interface/lapack/getf2.c @@ -0,0 +1,109 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QGETF2" +#elif defined(DOUBLE) +#define ERROR_NAME "DGETF2" +#else +#define ERROR_NAME "SGETF2" +#endif + +int NAME(blasint *M, blasint *N, FLOAT *a, blasint *ldA, blasint *ipiv, blasint *Info){ + + blas_arg_t args; + + blasint info; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.m = *M; + args.n = *N; + args.a = (void *)a; + args.lda = *ldA; + args.c = (void *)ipiv; + + info = 0; + if (args.lda < MAX(1,args.m)) info = 4; + if (args.n < 0) info = 2; + if (args.m < 0) info = 1; + if (info) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + *Info = - info; + return 0; + } + + *Info = 0; + if (args.m == 0 || args.n == 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + + info = GETF2(&args, NULL, NULL, sa, sb, 0); + + *Info = info; + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.m * args.n, 2. / 3. * args.m * args.n * args.n); + + IDEBUG_END; + + return 0; +} diff --git a/interface/lapack/getrf.c b/interface/lapack/getrf.c new file mode 100644 index 000000000..aa799e8d3 --- /dev/null +++ b/interface/lapack/getrf.c @@ -0,0 +1,121 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QGETRF" +#elif defined(DOUBLE) +#define ERROR_NAME "DGETRF" +#else +#define ERROR_NAME "SGETRF" +#endif + +int NAME(blasint *M, blasint *N, FLOAT *a, blasint *ldA, blasint *ipiv, blasint *Info){ + + blas_arg_t args; + + blasint info; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.m = *M; + args.n = *N; + args.a = (void *)a; + args.lda = *ldA; + args.c = (void *)ipiv; + + info = 0; + if (args.lda < MAX(1,args.m)) info = 4; + if (args.n < 0) info = 2; + if (args.m < 0) info = 1; + if (info) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + *Info = - info; + return 0; + } + + *Info = 0; + if (args.m == 0 || args.n == 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + +#ifdef SMP + args.common = NULL; + args.nthreads = num_cpu_avail(4); + + if (args.nthreads == 1) { +#endif + + *Info = GETRF_SINGLE(&args, NULL, NULL, sa, sb, 0); + +#ifdef SMP + } else { + + *Info = GETRF_PARALLEL(&args, NULL, NULL, sa, sb, 0); + } +#endif + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.m * args.n, 2. / 3. * args.m * args.n * args.n); + + IDEBUG_END; + + return 0; +} diff --git a/interface/lapack/getrs.c b/interface/lapack/getrs.c new file mode 100644 index 000000000..761a00160 --- /dev/null +++ b/interface/lapack/getrs.c @@ -0,0 +1,152 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QGETRS" +#elif defined(DOUBLE) +#define ERROR_NAME "DGETRS" +#else +#define ERROR_NAME "SGETRS" +#endif + +static blasint (*getrs_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { + GETRS_N_SINGLE, GETRS_T_SINGLE, +}; + +#ifdef SMP +static blasint (*getrs_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { + GETRS_N_PARALLEL, GETRS_T_PARALLEL, +}; +#endif + +int NAME(char *TRANS, blasint *N, blasint *NRHS, FLOAT *a, blasint *ldA, + blasint *ipiv, FLOAT *b, blasint *ldB, blasint *Info){ + + char trans_arg = *TRANS; + + blas_arg_t args; + + blasint info; + int trans; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.m = *N; + args.n = *NRHS; + args.a = (void *)a; + args.lda = *ldA; + args.b = (void *)b; + args.ldb = *ldB; + args.c = (void *)ipiv; + + info = 0; + + TOUPPER(trans_arg); + trans = -1; + + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'T') trans = 1; + if (trans_arg == 'R') trans = 0; + if (trans_arg == 'C') trans = 1; + + if (args.ldb < MAX(1, args.m)) info = 8; + if (args.lda < MAX(1, args.m)) info = 5; + if (args.n < 0) info = 3; + if (args.m < 0) info = 2; + if (trans < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return 0; + } + + args.alpha = NULL; + args.beta = NULL; + + *Info = info; + + if (args.m == 0 || args.n == 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + +#ifdef SMP + args.common = NULL; + args.nthreads = num_cpu_avail(4); + + if (args.nthreads == 1) { +#endif + + (getrs_single[trans])(&args, NULL, NULL, sa, sb, 0); + +#ifdef SMP + } else { + (getrs_parallel[trans])(&args, NULL, NULL, sa, sb, 0); + } +#endif + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.m * args.n, 2 * args.m * args.m * args.n); + + IDEBUG_END; + + return 0; + +} diff --git a/interface/lapack/larf.c b/interface/lapack/larf.c new file mode 100644 index 000000000..3b538c4a2 --- /dev/null +++ b/interface/lapack/larf.c @@ -0,0 +1,109 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +static int (*larf[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { + LARF_L, LARF_R, +}; + +int NAME(char *SIDE, blasint *M, blasint *N, FLOAT *v, blasint *incV, FLOAT *tau, FLOAT *c, blasint *ldC, FLOAT *work){ + + blas_arg_t args; + + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + char side_arg = *SIDE; + int side; + + PRINT_DEBUG_NAME; + + TOUPPER(side_arg); + + args.m = *M; + args.n = *N; + args.a = (void *)v; + args.lda = *incV; + args.c = (void *)c; + args.ldc = *ldC; + + args.alpha = (void *)tau; + + side = -1; + if (side_arg == 'L') side = 0; + if (side_arg == 'R') side = 1; + + if (args.m == 0 || args.n == 0) return 0; + +#ifndef COMPLEX + if (*tau == ZERO) return 0; +#else + if ((*(tau + 0) == ZERO) && (*(tau + 1) == ZERO)) return 0; +#endif + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + + larf[side](&args, NULL, NULL, sa, sb, 0); + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.m * args.n, 2. / 3. * args.m * args.n * args.n); + + IDEBUG_END; + + return 0; +} diff --git a/interface/lapack/laswp.c b/interface/lapack/laswp.c new file mode 100644 index 000000000..026b5156f --- /dev/null +++ b/interface/lapack/laswp.c @@ -0,0 +1,110 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +static int (*laswp[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, blasint *, BLASLONG) = { +#ifdef XDOUBLE + qlaswp_plus, qlaswp_minus, +#elif defined(DOUBLE) + dlaswp_plus, dlaswp_minus, +#else + slaswp_plus, slaswp_minus, +#endif +}; + +int NAME(blasint *N, FLOAT *a, blasint *LDA, blasint *K1, blasint *K2, blasint *ipiv, blasint *INCX){ + + blasint n = *N; + blasint lda = *LDA; + blasint k1 = *K1; + blasint k2 = *K2; + blasint incx = *INCX; + int flag; + +#ifdef SMP + int mode, nthreads; + FLOAT dummyalpha[2] = {ZERO, ZERO}; +#endif + + PRINT_DEBUG_NAME; + + if (incx == 0 || n <= 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + flag = (incx < 0); + +#ifdef SMP + nthreads = num_cpu_avail(1); + + if (nthreads == 1) { +#endif + + (laswp[flag])(n, k1, k2, ZERO, a, lda, NULL, 0, ipiv, incx); + +#ifdef SMP + } else { + +#ifdef XDOUBLE + mode = BLAS_XDOUBLE | BLAS_REAL; +#elif defined(DOUBLE) + mode = BLAS_DOUBLE | BLAS_REAL; +#else + mode = BLAS_SINGLE | BLAS_REAL; +#endif + + blas_level1_thread(mode, n, k1, k2, dummyalpha, + a, lda, NULL, 0, ipiv, incx, + laswp[flag], nthreads); + } +#endif + + FUNCTION_PROFILE_END(COMPSIZE, n * (k2 - k1), 0); + + IDEBUG_END; + + return 0; + +} diff --git a/interface/lapack/lauu2.c b/interface/lapack/lauu2.c new file mode 100644 index 000000000..14417e986 --- /dev/null +++ b/interface/lapack/lauu2.c @@ -0,0 +1,128 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QLAUU2" +#elif defined(DOUBLE) +#define ERROR_NAME "DLAUU2" +#else +#define ERROR_NAME "SLAUU2" +#endif + +static blasint (*lauu2[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { +#ifdef XDOUBLE + qlauu2_U, qlauu2_L, +#elif defined(DOUBLE) + dlauu2_U, dlauu2_L, +#else + slauu2_U, slauu2_L, +#endif + }; + +int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ + + blas_arg_t args; + + blasint uplo_arg = *UPLO; + blasint uplo; + blasint info; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.n = *N; + args.a = (void *)a; + args.lda = *ldA; + + TOUPPER(uplo_arg); + + uplo = -1; + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + if (args.lda < MAX(1,args.n)) info = 4; + if (args.n < 0) info = 2; + if (uplo < 0) info = 1; + if (info) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + *Info = - info; + return 0; + } + + *Info = 0; + + if (args.n <= 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + + info = (lauu2[uplo])(&args, NULL, NULL, sa, sb, 0); + + *Info = info; + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(1, .5 * args.n * args.n, + args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) + + 1./6. * args.n * (args.n * args.n - 1)); + + IDEBUG_END; + + return 0; +} diff --git a/interface/lapack/lauum.c b/interface/lapack/lauum.c new file mode 100644 index 000000000..e5b593f30 --- /dev/null +++ b/interface/lapack/lauum.c @@ -0,0 +1,139 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QLAUUM" +#elif defined(DOUBLE) +#define ERROR_NAME "DLAUUM" +#else +#define ERROR_NAME "SLAUUM" +#endif + +static blasint (*lauum_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { + LAUUM_U_SINGLE, LAUUM_L_SINGLE, +}; + +#ifdef SMP +static blasint (*lauum_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { + LAUUM_U_PARALLEL, LAUUM_L_PARALLEL, +}; +#endif + +int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ + + blas_arg_t args; + + blasint uplo_arg = *UPLO; + blasint uplo; + blasint info; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.n = *N; + args.a = (void *)a; + args.lda = *ldA; + + TOUPPER(uplo_arg); + + uplo = -1; + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + if (args.lda < MAX(1,args.n)) info = 4; + if (args.n < 0) info = 2; + if (uplo < 0) info = 1; + if (info) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + *Info = - info; + return 0; + } + + *Info = 0; + + if (args.n == 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + +#ifdef SMP + args.common = NULL; + args.nthreads = num_cpu_avail(4); + + if (args.nthreads == 1) { +#endif + + *Info = (lauum_single[uplo])(&args, NULL, NULL, sa, sb, 0); + +#ifdef SMP + } else { + *Info = (lauum_parallel[uplo])(&args, NULL, NULL, sa, sb, 0); + } +#endif + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(1, .5 * args.n * args.n, + args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) + + 1./6. * args.n * (args.n * args.n - 1)); + + IDEBUG_END; + + return 0; +} diff --git a/interface/lapack/potf2.c b/interface/lapack/potf2.c new file mode 100644 index 000000000..76822a49c --- /dev/null +++ b/interface/lapack/potf2.c @@ -0,0 +1,128 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QPOTF2" +#elif defined(DOUBLE) +#define ERROR_NAME "DPOTF2" +#else +#define ERROR_NAME "SPOTF2" +#endif + +static blasint (*potf2[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { +#ifdef XDOUBLE + qpotf2_U, qpotf2_L, +#elif defined(DOUBLE) + dpotf2_U, dpotf2_L, +#else + spotf2_U, spotf2_L, +#endif + }; + +int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ + + blas_arg_t args; + + blasint uplo_arg = *UPLO; + blasint uplo; + blasint info; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.n = *N; + args.a = (void *)a; + args.lda = *ldA; + + TOUPPER(uplo_arg); + + uplo = -1; + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + if (args.lda < MAX(1,args.n)) info = 4; + if (args.n < 0) info = 2; + if (uplo < 0) info = 1; + if (info) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + *Info = - info; + return 0; + } + + *Info = 0; + + if (args.n <= 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + + info = (potf2[uplo])(&args, NULL, NULL, sa, sb, 0); + + *Info = info; + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(1, .5 * args.n * args.n, + args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) + + 1./6. * args.n * (args.n * args.n - 1)); + + IDEBUG_END; + + return 0; +} diff --git a/interface/lapack/potrf.c b/interface/lapack/potrf.c new file mode 100644 index 000000000..9a15012d3 --- /dev/null +++ b/interface/lapack/potrf.c @@ -0,0 +1,139 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QPOTRF" +#elif defined(DOUBLE) +#define ERROR_NAME "DPOTRF" +#else +#define ERROR_NAME "SPOTRF" +#endif + +static blasint (*potrf_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { + POTRF_U_SINGLE, POTRF_L_SINGLE, +}; + +#ifdef SMP +static blasint (*potrf_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { + POTRF_U_PARALLEL, POTRF_L_PARALLEL, +}; +#endif + +int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ + + blas_arg_t args; + + blasint uplo_arg = *UPLO; + blasint uplo; + blasint info; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.n = *N; + args.a = (void *)a; + args.lda = *ldA; + + TOUPPER(uplo_arg); + + uplo = -1; + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + if (args.lda < MAX(1,args.n)) info = 4; + if (args.n < 0) info = 2; + if (uplo < 0) info = 1; + if (info) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + *Info = - info; + return 0; + } + + *Info = 0; + + if (args.n == 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + +#ifdef SMP + args.common = NULL; + args.nthreads = num_cpu_avail(4); + + if (args.nthreads == 1) { +#endif + + *Info = (potrf_single[uplo])(&args, NULL, NULL, sa, sb, 0); + +#ifdef SMP + } else { + *Info = (potrf_parallel[uplo])(&args, NULL, NULL, sa, sb, 0); + } +#endif + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(1, .5 * args.n * args.n, + args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) + + 1./6. * args.n * (args.n * args.n - 1)); + + IDEBUG_END; + + return 0; +} diff --git a/interface/lapack/potri.c b/interface/lapack/potri.c new file mode 100644 index 000000000..a4f33221a --- /dev/null +++ b/interface/lapack/potri.c @@ -0,0 +1,160 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QPOTRI" +#elif defined(DOUBLE) +#define ERROR_NAME "DPOTRI" +#else +#define ERROR_NAME "SPOTRI" +#endif + +static blasint (*trtri_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ + TRTRI_UN_SINGLE, TRTRI_LN_SINGLE, +}; + +static blasint (*lauum_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ + LAUUM_U_SINGLE, LAUUM_L_SINGLE, +}; + +#ifdef SMP +static blasint (*trtri_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ + TRTRI_UN_PARALLEL, TRTRI_LN_PARALLEL, +}; + +static blasint (*lauum_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ + LAUUM_U_PARALLEL, LAUUM_L_PARALLEL, +}; +#endif + +int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ + + blas_arg_t args; + + blasint uplo_arg = *UPLO; + blasint uplo; + blasint info; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.n = *N; + args.a = (void *)a; + args.lda = *ldA; + + TOUPPER(uplo_arg); + + uplo = -1; + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + if (args.lda < MAX(1,args.n)) info = 4; + if (args.n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + *Info = - info; + return 0; + } + + *Info = 0; + + if (args.n == 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + +#ifdef SMP + args.common = NULL; + args.nthreads = num_cpu_avail(4); + + if (args.nthreads == 1) { +#endif + + info = (trtri_single[uplo])(&args, NULL, NULL, sa, sb, 0); + + if (!info) { + info = (lauum_single[uplo])(&args, NULL, NULL, sa, sb, 0); + } + + *Info = info; + +#ifdef SMP + } else { + info = (trtri_parallel[uplo])(&args, NULL, NULL, sa, sb, 0); + + if (!info) { + info = (lauum_parallel[uplo])(&args, NULL, NULL, sa, sb, 0); + } + + *Info = info; + } +#endif + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, .5 * args.n * args.n, + args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) + + args.n * (1./3. + args.n * (-1./2. + args.n * 1./6.))); + + IDEBUG_END; + + return 0; +} diff --git a/interface/lapack/zgetf2.c b/interface/lapack/zgetf2.c new file mode 100644 index 000000000..950ef46e9 --- /dev/null +++ b/interface/lapack/zgetf2.c @@ -0,0 +1,109 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XGETF2" +#elif defined(DOUBLE) +#define ERROR_NAME "ZGETF2" +#else +#define ERROR_NAME "CGETF2" +#endif + +int NAME(blasint *M, blasint *N, FLOAT *a, blasint *ldA, blasint *ipiv, blasint *Info){ + + blas_arg_t args; + + blasint info; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.m = *M; + args.n = *N; + args.a = (void *)a; + args.lda = *ldA; + args.c = (void *)ipiv; + + info = 0; + if (args.lda < MAX(1,args.m)) info = 4; + if (args.n < 0) info = 2; + if (args.m < 0) info = 1; + if (info) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + *Info = - info; + return 0; + } + + *Info = 0; + if (args.m == 0 || args.n == 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + + info = GETF2(&args, NULL, NULL, sa, sb, 0); + + *Info = info; + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.m * args.n, 2. / 3. * args.m * args.n * args.n); + + IDEBUG_END; + + return 0; +} diff --git a/interface/lapack/zgetrf.c b/interface/lapack/zgetrf.c new file mode 100644 index 000000000..9f041d9bd --- /dev/null +++ b/interface/lapack/zgetrf.c @@ -0,0 +1,122 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XGETRF" +#elif defined(DOUBLE) +#define ERROR_NAME "ZGETRF" +#else +#define ERROR_NAME "CGETRF" +#endif + +int NAME(blasint *M, blasint *N, FLOAT *a, blasint *ldA, blasint *ipiv, blasint *Info){ + + blas_arg_t args; + + blasint info; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.m = *M; + args.n = *N; + args.a = (void *)a; + args.lda = *ldA; + args.c = (void *)ipiv; + + info = 0; + if (args.lda < MAX(1,args.m)) info = 4; + if (args.n < 0) info = 2; + if (args.m < 0) info = 1; + if (info) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + *Info = - info; + return 0; + } + + *Info = 0; + if (args.m == 0 || args.n == 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + +#ifdef SMP + args.common = NULL; + args.nthreads = num_cpu_avail(4); + + if (args.nthreads == 1) { +#endif + + *Info = GETRF_SINGLE(&args, NULL, NULL, sa, sb, 0); + +#ifdef SMP + } else { + + *Info = GETRF_PARALLEL(&args, NULL, NULL, sa, sb, 0); + + } +#endif + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.m * args.n, 2. / 3. * args.m * args.n * args.n); + + IDEBUG_END; + + return 0; +} diff --git a/interface/lapack/zgetrs.c b/interface/lapack/zgetrs.c new file mode 100644 index 000000000..81d50e34f --- /dev/null +++ b/interface/lapack/zgetrs.c @@ -0,0 +1,153 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XGETRS" +#elif defined(DOUBLE) +#define ERROR_NAME "ZGETRS" +#else +#define ERROR_NAME "CGETRS" +#endif + +static blasint (*getrs_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ + GETRS_N_SINGLE, GETRS_T_SINGLE, GETRS_R_SINGLE, GETRS_C_SINGLE, +}; + +#ifdef SMP +static blasint (*getrs_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ + GETRS_N_PARALLEL, GETRS_T_PARALLEL, GETRS_R_PARALLEL, GETRS_C_PARALLEL, +}; +#endif + +int NAME(char *TRANS, blasint *N, blasint *NRHS, FLOAT *a, blasint *ldA, + blasint *ipiv, FLOAT *b, blasint *ldB, blasint *Info){ + + char trans_arg = *TRANS; + + blas_arg_t args; + + blasint info; + int trans; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.m = *N; + args.n = *NRHS; + args.a = (void *)a; + args.lda = *ldA; + args.b = (void *)b; + args.ldb = *ldB; + args.c = (void *)ipiv; + + info = 0; + + TOUPPER(trans_arg); + trans = -1; + + if (trans_arg == 'N') trans = 0; + if (trans_arg == 'T') trans = 1; + if (trans_arg == 'R') trans = 2; + if (trans_arg == 'C') trans = 3; + + if (args.ldb < MAX(1, args.m)) info = 8; + if (args.lda < MAX(1, args.m)) info = 5; + if (args.n < 0) info = 3; + if (args.m < 0) info = 2; + if (trans < 0) info = 1; + + if (info != 0) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + return 0; + } + + args.alpha = NULL; + args.beta = NULL; + + *Info = info; + + if (args.m == 0 || args.n == 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + +#ifdef SMP + args.nthreads = num_cpu_avail(4); + + if (args.nthreads == 1) { +#endif + + (getrs_single[trans])(&args, NULL, NULL, sa, sb, 0); + +#ifdef SMP + } else { + + (getrs_parallel[trans])(&args, NULL, NULL, sa, sb, 0); + + } +#endif + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.m * args.n, 2 * args.m * args.m * args.n); + + IDEBUG_END; + + return 0; + +} diff --git a/interface/lapack/zlaswp.c b/interface/lapack/zlaswp.c new file mode 100644 index 000000000..85ead2c86 --- /dev/null +++ b/interface/lapack/zlaswp.c @@ -0,0 +1,108 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +static int (*laswp[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, blasint *, BLASLONG) = { +#ifdef XDOUBLE + xlaswp_plus, xlaswp_minus, +#elif defined(DOUBLE) + zlaswp_plus, zlaswp_minus, +#else + claswp_plus, claswp_minus, +#endif +}; + +int NAME(blasint *N, FLOAT *a, blasint *LDA, blasint *K1, blasint *K2, blasint *ipiv, blasint *INCX){ + + blasint n = *N; + blasint lda = *LDA; + blasint k1 = *K1; + blasint k2 = *K2; + blasint incx = *INCX; + int flag; + +#ifdef SMP + int mode; + FLOAT dummyalpha[2] = {ZERO, ZERO}; + int nthreads; +#endif + + PRINT_DEBUG_NAME; + + if (incx == 0 || n <= 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + + flag = (incx < 0); + +#ifdef SMP + nthreads = num_cpu_avail(2); + + if (nthreads == 1) { +#endif + + (laswp[flag])(n, k1, k2, ZERO, ZERO, a, lda, NULL, 0, ipiv, incx); + +#ifdef SMP + } else { + +#ifdef XDOUBLE + mode = BLAS_XDOUBLE | BLAS_COMPLEX; +#elif defined(DOUBLE) + mode = BLAS_DOUBLE | BLAS_COMPLEX; +#else + mode = BLAS_SINGLE | BLAS_COMPLEX; +#endif + + blas_level1_thread(mode, n, k1, k2, dummyalpha, a, lda, NULL, 0, ipiv, incx, laswp[flag], nthreads); + } +#endif + + FUNCTION_PROFILE_END(COMPSIZE, n * (k2 - k1), 0); + + IDEBUG_END; + + return 0; +} diff --git a/interface/lapack/zlauu2.c b/interface/lapack/zlauu2.c new file mode 100644 index 000000000..05603fe1b --- /dev/null +++ b/interface/lapack/zlauu2.c @@ -0,0 +1,129 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QLAUU2" +#elif defined(DOUBLE) +#define ERROR_NAME "ZLAUU2" +#else +#define ERROR_NAME "CLAUU2" +#endif + +static blasint (*lauu2[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { + +#ifdef XDOUBLE + xlauu2_U, xlauu2_L, +#elif defined(DOUBLE) + zlauu2_U, zlauu2_L, +#else + clauu2_U, clauu2_L, +#endif + }; + +int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ + + blas_arg_t args; + + blasint uplo_arg = *UPLO; + blasint uplo; + blasint info; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.n = *N; + args.a = (void *)a; + args.lda = *ldA; + + TOUPPER(uplo_arg); + + uplo = -1; + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + if (args.lda < MAX(1,args.n)) info = 4; + if (args.n < 0) info = 2; + if (uplo < 0) info = 1; + if (info) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + *Info = - info; + return 0; + } + + *Info = 0; + + if (args.n <= 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + + info = (lauu2[uplo])(&args, NULL, NULL, sa, sb, 0); + + *Info = info; + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(1, .5 * args.n * args.n, + 2. * args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) + + 6. * 1./6. * args.n * (args.n * args.n - 1)); + + IDEBUG_END; + + return 0; +} diff --git a/interface/lapack/zlauum.c b/interface/lapack/zlauum.c new file mode 100644 index 000000000..23990e8e4 --- /dev/null +++ b/interface/lapack/zlauum.c @@ -0,0 +1,141 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XLAUUM" +#elif defined(DOUBLE) +#define ERROR_NAME "ZLAUUM" +#else +#define ERROR_NAME "CLAUUM" +#endif + +static blasint (*lauum_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { + LAUUM_U_SINGLE, LAUUM_L_SINGLE, +}; + +#ifdef SMP +static blasint (*lauum_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { + LAUUM_U_PARALLEL, LAUUM_L_PARALLEL, +}; +#endif + +int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ + + blas_arg_t args; + + blasint uplo_arg = *UPLO; + blasint uplo; + blasint info; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.n = *N; + args.a = (void *)a; + args.lda = *ldA; + + TOUPPER(uplo_arg); + + uplo = -1; + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + if (args.lda < MAX(1,args.n)) info = 4; + if (args.n < 0) info = 2; + if (uplo < 0) info = 1; + if (info) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + *Info = - info; + return 0; + } + + *Info = 0; + + if (args.n == 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + +#ifdef SMP + args.common = NULL; + args.nthreads = num_cpu_avail(4); + + if (args.nthreads == 1) { +#endif + + *Info = (lauum_single[uplo])(&args, NULL, NULL, sa, sb, 0); + +#ifdef SMP + } else { + + *Info = (lauum_parallel[uplo])(&args, NULL, NULL, sa, sb, 0); + + } +#endif + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(1, .5 * args.n * args.n, + 2. * args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) + + args.n * (args.n * args.n - 1)); + + IDEBUG_END; + + return 0; +} diff --git a/interface/lapack/zpotf2.c b/interface/lapack/zpotf2.c new file mode 100644 index 000000000..f8f81e2c5 --- /dev/null +++ b/interface/lapack/zpotf2.c @@ -0,0 +1,129 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XPOTF2" +#elif defined(DOUBLE) +#define ERROR_NAME "ZPOTF2" +#else +#define ERROR_NAME "CPOTF2" +#endif + +static blasint (*potf2[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { + +#ifdef XDOUBLE + xpotf2_U, xpotf2_L, +#elif defined(DOUBLE) + zpotf2_U, zpotf2_L, +#else + cpotf2_U, cpotf2_L, +#endif + }; + +int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ + + blas_arg_t args; + + blasint uplo_arg = *UPLO; + blasint uplo; + blasint info; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.n = *N; + args.a = (void *)a; + args.lda = *ldA; + + TOUPPER(uplo_arg); + + uplo = -1; + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + if (args.lda < MAX(1,args.n)) info = 4; + if (args.n < 0) info = 2; + if (uplo < 0) info = 1; + if (info) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + *Info = - info; + return 0; + } + + *Info = 0; + + if (args.n <= 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + + info = (potf2[uplo])(&args, NULL, NULL, sa, sb, 0); + + *Info = info; + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(1, .5 * args.n * args.n, + 2. * args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) + + 6. * 1./6. * args.n * (args.n * args.n - 1)); + + IDEBUG_END; + + return 0; +} diff --git a/interface/lapack/zpotrf.c b/interface/lapack/zpotrf.c new file mode 100644 index 000000000..e2004d744 --- /dev/null +++ b/interface/lapack/zpotrf.c @@ -0,0 +1,141 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XPOTRF" +#elif defined(DOUBLE) +#define ERROR_NAME "ZPOTRF" +#else +#define ERROR_NAME "CPOTRF" +#endif + +static blasint (*potrf_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ + POTRF_U_SINGLE, POTRF_L_SINGLE, +}; + +#ifdef SMP +static blasint (*potrf_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ + POTRF_U_PARALLEL, POTRF_L_PARALLEL, +}; +#endif + +int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ + + blas_arg_t args; + + blasint uplo_arg = *UPLO; + blasint uplo; + blasint info; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.n = *N; + args.a = (void *)a; + args.lda = *ldA; + + TOUPPER(uplo_arg); + + uplo = -1; + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + if (args.lda < MAX(1,args.n)) info = 4; + if (args.n < 0) info = 2; + if (uplo < 0) info = 1; + if (info) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + *Info = - info; + return 0; + } + + *Info = 0; + + if (args.n == 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + +#ifdef SMP + args.common = NULL; + args.nthreads = num_cpu_avail(4); + + if (args.nthreads == 1) { +#endif + + *Info = (potrf_single[uplo])(&args, NULL, NULL, sa, sb, 0); + +#ifdef SMP + } else { + + *Info = (potrf_parallel[uplo])(&args, NULL, NULL, sa, sb, 0); + + } +#endif + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(1, .5 * args.n * args.n, + 2. * args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) + + 6. * 1./6. * args.n * (args.n * args.n - 1)); + + IDEBUG_END; + + return 0; +} diff --git a/interface/lapack/zpotri.c b/interface/lapack/zpotri.c new file mode 100644 index 000000000..df325424e --- /dev/null +++ b/interface/lapack/zpotri.c @@ -0,0 +1,157 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XPOTRI" +#elif defined(DOUBLE) +#define ERROR_NAME "ZPOTRI" +#else +#define ERROR_NAME "CPOTRI" +#endif + +static blasint (*trtri_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ + TRTRI_UN_SINGLE, TRTRI_LN_SINGLE, +}; + +static blasint (*lauum_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ + LAUUM_U_SINGLE, LAUUM_L_SINGLE, +}; + +#ifdef SMP +static blasint (*trtri_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ + TRTRI_UN_PARALLEL, TRTRI_LN_PARALLEL, +}; + +static blasint (*lauum_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={ + LAUUM_U_PARALLEL, LAUUM_L_PARALLEL, +}; +#endif + +int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ + + blas_arg_t args; + + blasint uplo_arg = *UPLO; + blasint uplo; + blasint info; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.n = *N; + args.a = (void *)a; + args.lda = *ldA; + + TOUPPER(uplo_arg); + + uplo = -1; + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + if (args.lda < MAX(1,args.n)) info = 4; + if (args.n < 0) info = 2; + if (uplo < 0) info = 1; + + if (info) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + *Info = - info; + return 0; + } + + *Info = 0; + + if (args.n == 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + +#ifdef SMP + args.nthreads = num_cpu_avail(4); + + if (args.nthreads == 1) { +#endif + + info = (trtri_single[uplo])(&args, NULL, NULL, sa, sb, 0); + + if (!info) { + info = (lauum_single[uplo])(&args, NULL, NULL, sa, sb, 0); + } + + *Info = info; + +#ifdef SMP + } else { + info = (trtri_parallel[uplo])(&args, NULL, NULL, sa, sb, 0); + + if (!info) { + info = (lauum_parallel[uplo])(&args, NULL, NULL, sa, sb, 0); + } + + *Info = info; + } +#endif + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.m * args.n, 2. / 3. * args.m * args.n * args.n); + + IDEBUG_END; + + return 0; +} From ac029f81b3f21ad9c1a68656a937065934bfb33c Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 18 May 2014 19:07:51 +0200 Subject: [PATCH 53/70] enabled and tested optimized dgetrf function --- interface/Makefile | 17 ++++++++++------- lapack-netlib/SRC/Makefile | 2 +- lapack/Makefile | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/interface/Makefile b/interface/Makefile index 708761559..92fc79bc2 100644 --- a/interface/Makefile +++ b/interface/Makefile @@ -347,10 +347,13 @@ SLAPACKOBJS = \ spotf2.$(SUFFIX) spotrf.$(SUFFIX) strti2.$(SUFFIX) strtri.$(SUFFIX) \ slaswp.$(SUFFIX) sgetrs.$(SUFFIX) sgesv.$(SUFFIX) spotri.$(SUFFIX) \ +#DLAPACKOBJS = \ +# dgetf2.$(SUFFIX) dgetrf.$(SUFFIX) dlauu2.$(SUFFIX) dlauum.$(SUFFIX) \ +# dpotf2.$(SUFFIX) dpotrf.$(SUFFIX) dtrti2.$(SUFFIX) dtrtri.$(SUFFIX) \ +# dlaswp.$(SUFFIX) dgetrs.$(SUFFIX) dgesv.$(SUFFIX) dpotri.$(SUFFIX) \ + DLAPACKOBJS = \ - dgetf2.$(SUFFIX) dgetrf.$(SUFFIX) dlauu2.$(SUFFIX) dlauum.$(SUFFIX) \ - dpotf2.$(SUFFIX) dpotrf.$(SUFFIX) dtrti2.$(SUFFIX) dtrtri.$(SUFFIX) \ - dlaswp.$(SUFFIX) dgetrs.$(SUFFIX) dgesv.$(SUFFIX) dpotri.$(SUFFIX) \ + dgetrf.$(SUFFIX) QLAPACKOBJS = \ qgetf2.$(SUFFIX) qgetrf.$(SUFFIX) qlauu2.$(SUFFIX) qlauum.$(SUFFIX) \ @@ -372,15 +375,15 @@ XLAPACKOBJS = \ xpotf2.$(SUFFIX) xpotrf.$(SUFFIX) xtrti2.$(SUFFIX) xtrtri.$(SUFFIX) \ xlaswp.$(SUFFIX) xgetrs.$(SUFFIX) xgesv.$(SUFFIX) xpotri.$(SUFFIX) \ -#ifneq ($(NO_LAPACK), 1) +ifneq ($(NO_LAPACK), 1) #SBLASOBJS += $(SLAPACKOBJS) -#DBLASOBJS += $(DLAPACKOBJS) +DBLASOBJS += $(DLAPACKOBJS) #QBLASOBJS += $(QLAPACKOBJS) #CBLASOBJS += $(CLAPACKOBJS) #ZBLASOBJS += $(ZLAPACKOBJS) #XBLASOBJS += $(XLAPACKOBJS) -#endif +endif FUNCOBJS = $(SBLASOBJS) $(DBLASOBJS) $(CBLASOBJS) $(ZBLASOBJS) @@ -1752,7 +1755,7 @@ xgetf2.$(SUFFIX) xgetf2.$(PSUFFIX) : zgetf2.c sgetrf.$(SUFFIX) sgetrf.$(PSUFFIX) : getrf.c $(CC) -c $(CFLAGS) $< -o $(@F) -dgetrf.$(SUFFIX) dgetrf.$(PSUFFIX) : getrf.c +dgetrf.$(SUFFIX) dgetrf.$(PSUFFIX) : lapack/getrf.c $(CC) -c $(CFLAGS) $< -o $(@F) qgetrf.$(SUFFIX) qgetrf.$(PSUFFIX) : getrf.c diff --git a/lapack-netlib/SRC/Makefile b/lapack-netlib/SRC/Makefile index 46a3f7881..018345d41 100644 --- a/lapack-netlib/SRC/Makefile +++ b/lapack-netlib/SRC/Makefile @@ -262,7 +262,7 @@ DLASRC = \ dgels.o dgelsd.o dgelss.o dgelsx.o dgelsy.o dgeql2.o dgeqlf.o \ dgeqp3.o dgeqpf.o dgeqr2.o dgeqr2p.o dgeqrf.o dgeqrfp.o dgerfs.o \ dgerq2.o dgerqf.o dgesc2.o dgesdd.o dgesv.o dgesvd.o dgesvx.o \ - dgetc2.o dgetf2.o dgetrf.o dgetri.o \ + dgetc2.o dgetf2.o dgetri.o \ dgetrs.o dggbak.o dggbal.o dgges.o dggesx.o dggev.o dggevx.o \ dggglm.o dgghrd.o dgglse.o dggqrf.o \ dggrqf.o dggsvd.o dggsvp.o dgtcon.o dgtrfs.o dgtsv.o \ diff --git a/lapack/Makefile b/lapack/Makefile index dd203d222..da88ba00e 100644 --- a/lapack/Makefile +++ b/lapack/Makefile @@ -2,7 +2,7 @@ TOPDIR = .. include ../Makefile.system #SUBDIRS = laswp getf2 getrf potf2 potrf lauu2 lauum trti2 trtri getrs -SUBDIRS = +SUBDIRS = getrf getf2 laswp FLAMEDIRS = laswp getf2 potf2 lauu2 trti2 From 6fc46467093e54076cf22406cac92bb3d22c9d01 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 18 May 2014 19:36:32 +0200 Subject: [PATCH 54/70] enabled and tested optimized zgetrf lapack function --- interface/Makefile | 13 ++++++++----- lapack-netlib/SRC/Makefile | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/interface/Makefile b/interface/Makefile index 92fc79bc2..433faab23 100644 --- a/interface/Makefile +++ b/interface/Makefile @@ -365,10 +365,13 @@ CLAPACKOBJS = \ cpotf2.$(SUFFIX) cpotrf.$(SUFFIX) ctrti2.$(SUFFIX) ctrtri.$(SUFFIX) \ claswp.$(SUFFIX) cgetrs.$(SUFFIX) cgesv.$(SUFFIX) cpotri.$(SUFFIX) \ +#ZLAPACKOBJS = \ +# zgetf2.$(SUFFIX) zgetrf.$(SUFFIX) zlauu2.$(SUFFIX) zlauum.$(SUFFIX) \ +# zpotf2.$(SUFFIX) zpotrf.$(SUFFIX) ztrti2.$(SUFFIX) ztrtri.$(SUFFIX) \ +# zlaswp.$(SUFFIX) zgetrs.$(SUFFIX) zgesv.$(SUFFIX) zpotri.$(SUFFIX) \ + ZLAPACKOBJS = \ - zgetf2.$(SUFFIX) zgetrf.$(SUFFIX) zlauu2.$(SUFFIX) zlauum.$(SUFFIX) \ - zpotf2.$(SUFFIX) zpotrf.$(SUFFIX) ztrti2.$(SUFFIX) ztrtri.$(SUFFIX) \ - zlaswp.$(SUFFIX) zgetrs.$(SUFFIX) zgesv.$(SUFFIX) zpotri.$(SUFFIX) \ + zgetrf.$(SUFFIX) XLAPACKOBJS = \ xgetf2.$(SUFFIX) xgetrf.$(SUFFIX) xlauu2.$(SUFFIX) xlauum.$(SUFFIX) \ @@ -380,7 +383,7 @@ ifneq ($(NO_LAPACK), 1) DBLASOBJS += $(DLAPACKOBJS) #QBLASOBJS += $(QLAPACKOBJS) #CBLASOBJS += $(CLAPACKOBJS) -#ZBLASOBJS += $(ZLAPACKOBJS) +ZBLASOBJS += $(ZLAPACKOBJS) #XBLASOBJS += $(XLAPACKOBJS) endif @@ -1764,7 +1767,7 @@ qgetrf.$(SUFFIX) qgetrf.$(PSUFFIX) : getrf.c cgetrf.$(SUFFIX) cgetrf.$(PSUFFIX) : zgetrf.c $(CC) -c $(CFLAGS) $< -o $(@F) -zgetrf.$(SUFFIX) zgetrf.$(PSUFFIX) : zgetrf.c +zgetrf.$(SUFFIX) zgetrf.$(PSUFFIX) : lapack/zgetrf.c $(CC) -c $(CFLAGS) $< -o $(@F) xgetrf.$(SUFFIX) xgetrf.$(PSUFFIX) : zgetrf.c diff --git a/lapack-netlib/SRC/Makefile b/lapack-netlib/SRC/Makefile index 018345d41..3c76f7c43 100644 --- a/lapack-netlib/SRC/Makefile +++ b/lapack-netlib/SRC/Makefile @@ -335,7 +335,7 @@ ZLASRC = \ zgegs.o zgegv.o zgehd2.o zgehrd.o zgelq2.o zgelqf.o \ zgels.o zgelsd.o zgelss.o zgelsx.o zgelsy.o zgeql2.o zgeqlf.o zgeqp3.o \ zgeqpf.o zgeqr2.o zgeqr2p.o zgeqrf.o zgeqrfp.o zgerfs.o zgerq2.o zgerqf.o \ - zgesc2.o zgesdd.o zgesv.o zgesvd.o zgesvx.o zgetc2.o zgetf2.o zgetrf.o \ + zgesc2.o zgesdd.o zgesv.o zgesvd.o zgesvx.o zgetc2.o zgetf2.o \ zgetri.o zgetrs.o \ zggbak.o zggbal.o zgges.o zggesx.o zggev.o zggevx.o zggglm.o \ zgghrd.o zgglse.o zggqrf.o zggrqf.o \ From eea6f51df9dbbe4417ee1097608da9276441bb5a Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 18 May 2014 20:01:23 +0200 Subject: [PATCH 55/70] enabled and tested optimized sgetrf lapack function --- interface/Makefile | 14 +++++++++----- lapack-netlib/SRC/Makefile | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/interface/Makefile b/interface/Makefile index 433faab23..e436ad002 100644 --- a/interface/Makefile +++ b/interface/Makefile @@ -342,10 +342,14 @@ CBLASOBJS = $(CBLAS1OBJS) $(CBLAS2OBJS) $(CBLAS3OBJS) ZBLASOBJS = $(ZBLAS1OBJS) $(ZBLAS2OBJS) $(ZBLAS3OBJS) XBLASOBJS = $(XBLAS1OBJS) $(XBLAS2OBJS) $(XBLAS3OBJS) +#SLAPACKOBJS = \ +# sgetf2.$(SUFFIX) sgetrf.$(SUFFIX) slauu2.$(SUFFIX) slauum.$(SUFFIX) \ +# spotf2.$(SUFFIX) spotrf.$(SUFFIX) strti2.$(SUFFIX) strtri.$(SUFFIX) \ +# slaswp.$(SUFFIX) sgetrs.$(SUFFIX) sgesv.$(SUFFIX) spotri.$(SUFFIX) \ + SLAPACKOBJS = \ - sgetf2.$(SUFFIX) sgetrf.$(SUFFIX) slauu2.$(SUFFIX) slauum.$(SUFFIX) \ - spotf2.$(SUFFIX) spotrf.$(SUFFIX) strti2.$(SUFFIX) strtri.$(SUFFIX) \ - slaswp.$(SUFFIX) sgetrs.$(SUFFIX) sgesv.$(SUFFIX) spotri.$(SUFFIX) \ + sgetrf.$(SUFFIX) + #DLAPACKOBJS = \ # dgetf2.$(SUFFIX) dgetrf.$(SUFFIX) dlauu2.$(SUFFIX) dlauum.$(SUFFIX) \ @@ -379,7 +383,7 @@ XLAPACKOBJS = \ xlaswp.$(SUFFIX) xgetrs.$(SUFFIX) xgesv.$(SUFFIX) xpotri.$(SUFFIX) \ ifneq ($(NO_LAPACK), 1) -#SBLASOBJS += $(SLAPACKOBJS) +SBLASOBJS += $(SLAPACKOBJS) DBLASOBJS += $(DLAPACKOBJS) #QBLASOBJS += $(QLAPACKOBJS) #CBLASOBJS += $(CLAPACKOBJS) @@ -1755,7 +1759,7 @@ zgetf2.$(SUFFIX) zgetf2.$(PSUFFIX) : zgetf2.c xgetf2.$(SUFFIX) xgetf2.$(PSUFFIX) : zgetf2.c $(CC) -c $(CFLAGS) $< -o $(@F) -sgetrf.$(SUFFIX) sgetrf.$(PSUFFIX) : getrf.c +sgetrf.$(SUFFIX) sgetrf.$(PSUFFIX) : lapack/getrf.c $(CC) -c $(CFLAGS) $< -o $(@F) dgetrf.$(SUFFIX) dgetrf.$(PSUFFIX) : lapack/getrf.c diff --git a/lapack-netlib/SRC/Makefile b/lapack-netlib/SRC/Makefile index 3c76f7c43..981bf1068 100644 --- a/lapack-netlib/SRC/Makefile +++ b/lapack-netlib/SRC/Makefile @@ -157,7 +157,7 @@ SLASRC = \ sgeqrt.o sgeqrt2.o sgeqrt3.o sgemqrt.o \ stpqrt.o stpqrt2.o stpmqrt.o stprfb.o -DSLASRC = spotrs.o sgetrs.o spotrf.o sgetrf.o +DSLASRC = spotrs.o sgetrs.o spotrf.o ifdef USEXBLAS SXLASRC = sgesvxx.o sgerfsx.o sla_gerfsx_extended.o sla_geamv.o \ From 65f2fba4c389976e541120334352b8bead967539 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 18 May 2014 20:32:27 +0200 Subject: [PATCH 56/70] enabled and tested optimized cgetrf lapack function --- interface/Makefile | 14 +++++++++----- lapack-netlib/SRC/Makefile | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/interface/Makefile b/interface/Makefile index e436ad002..1b60ee391 100644 --- a/interface/Makefile +++ b/interface/Makefile @@ -364,10 +364,14 @@ QLAPACKOBJS = \ qpotf2.$(SUFFIX) qpotrf.$(SUFFIX) qtrti2.$(SUFFIX) qtrtri.$(SUFFIX) \ qlaswp.$(SUFFIX) qgetrs.$(SUFFIX) qgesv.$(SUFFIX) qpotri.$(SUFFIX) \ +#CLAPACKOBJS = \ +# cgetf2.$(SUFFIX) cgetrf.$(SUFFIX) clauu2.$(SUFFIX) clauum.$(SUFFIX) \ +# cpotf2.$(SUFFIX) cpotrf.$(SUFFIX) ctrti2.$(SUFFIX) ctrtri.$(SUFFIX) \ +# claswp.$(SUFFIX) cgetrs.$(SUFFIX) cgesv.$(SUFFIX) cpotri.$(SUFFIX) \ + CLAPACKOBJS = \ - cgetf2.$(SUFFIX) cgetrf.$(SUFFIX) clauu2.$(SUFFIX) clauum.$(SUFFIX) \ - cpotf2.$(SUFFIX) cpotrf.$(SUFFIX) ctrti2.$(SUFFIX) ctrtri.$(SUFFIX) \ - claswp.$(SUFFIX) cgetrs.$(SUFFIX) cgesv.$(SUFFIX) cpotri.$(SUFFIX) \ + cgetrf.$(SUFFIX) + #ZLAPACKOBJS = \ # zgetf2.$(SUFFIX) zgetrf.$(SUFFIX) zlauu2.$(SUFFIX) zlauum.$(SUFFIX) \ @@ -386,7 +390,7 @@ ifneq ($(NO_LAPACK), 1) SBLASOBJS += $(SLAPACKOBJS) DBLASOBJS += $(DLAPACKOBJS) #QBLASOBJS += $(QLAPACKOBJS) -#CBLASOBJS += $(CLAPACKOBJS) +CBLASOBJS += $(CLAPACKOBJS) ZBLASOBJS += $(ZLAPACKOBJS) #XBLASOBJS += $(XLAPACKOBJS) @@ -1768,7 +1772,7 @@ dgetrf.$(SUFFIX) dgetrf.$(PSUFFIX) : lapack/getrf.c qgetrf.$(SUFFIX) qgetrf.$(PSUFFIX) : getrf.c $(CC) -c $(CFLAGS) $< -o $(@F) -cgetrf.$(SUFFIX) cgetrf.$(PSUFFIX) : zgetrf.c +cgetrf.$(SUFFIX) cgetrf.$(PSUFFIX) : lapack/zgetrf.c $(CC) -c $(CFLAGS) $< -o $(@F) zgetrf.$(SUFFIX) zgetrf.$(PSUFFIX) : lapack/zgetrf.c diff --git a/lapack-netlib/SRC/Makefile b/lapack-netlib/SRC/Makefile index 981bf1068..789f0f907 100644 --- a/lapack-netlib/SRC/Makefile +++ b/lapack-netlib/SRC/Makefile @@ -252,7 +252,7 @@ CXLASRC = cgesvxx.o cgerfsx.o cla_gerfsx_extended.o cla_geamv.o \ cla_lin_berr.o clarscl2.o clascl2.o cla_wwaddw.o endif -ZCLASRC = cpotrs.o cgetrs.o cpotrf.o cgetrf.o +ZCLASRC = cpotrs.o cgetrs.o cpotrf.o DLASRC = \ dgbbrd.o dgbcon.o dgbequ.o dgbrfs.o dgbsv.o \ From 536875d4639b279eedc25c7a0460ecce7815fd58 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 18 May 2014 21:13:56 +0200 Subject: [PATCH 57/70] enabled and tested optimized getrs lapack functions --- interface/Makefile | 16 ++++++++-------- lapack-netlib/SRC/Makefile | 8 ++++---- lapack/Makefile | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/interface/Makefile b/interface/Makefile index 1b60ee391..957b4a8fe 100644 --- a/interface/Makefile +++ b/interface/Makefile @@ -348,7 +348,7 @@ XBLASOBJS = $(XBLAS1OBJS) $(XBLAS2OBJS) $(XBLAS3OBJS) # slaswp.$(SUFFIX) sgetrs.$(SUFFIX) sgesv.$(SUFFIX) spotri.$(SUFFIX) \ SLAPACKOBJS = \ - sgetrf.$(SUFFIX) + sgetrf.$(SUFFIX) sgetrs.$(SUFFIX) #DLAPACKOBJS = \ @@ -357,7 +357,7 @@ SLAPACKOBJS = \ # dlaswp.$(SUFFIX) dgetrs.$(SUFFIX) dgesv.$(SUFFIX) dpotri.$(SUFFIX) \ DLAPACKOBJS = \ - dgetrf.$(SUFFIX) + dgetrf.$(SUFFIX) dgetrs.$(SUFFIX) QLAPACKOBJS = \ qgetf2.$(SUFFIX) qgetrf.$(SUFFIX) qlauu2.$(SUFFIX) qlauum.$(SUFFIX) \ @@ -370,7 +370,7 @@ QLAPACKOBJS = \ # claswp.$(SUFFIX) cgetrs.$(SUFFIX) cgesv.$(SUFFIX) cpotri.$(SUFFIX) \ CLAPACKOBJS = \ - cgetrf.$(SUFFIX) + cgetrf.$(SUFFIX) cgetrs.$(SUFFIX) #ZLAPACKOBJS = \ @@ -379,7 +379,7 @@ CLAPACKOBJS = \ # zlaswp.$(SUFFIX) zgetrs.$(SUFFIX) zgesv.$(SUFFIX) zpotri.$(SUFFIX) \ ZLAPACKOBJS = \ - zgetrf.$(SUFFIX) + zgetrf.$(SUFFIX) zgetrs.$(SUFFIX) XLAPACKOBJS = \ xgetf2.$(SUFFIX) xgetrf.$(SUFFIX) xlauu2.$(SUFFIX) xlauum.$(SUFFIX) \ @@ -1907,19 +1907,19 @@ zlaswp.$(SUFFIX) zlaswp.$(PSUFFIX) : zlaswp.c xlaswp.$(SUFFIX) xlaswp.$(PSUFFIX) : zlaswp.c $(CC) -c $(CFLAGS) $< -o $(@F) -sgetrs.$(SUFFIX) sgetrs.$(PSUFFIX) : getrs.c +sgetrs.$(SUFFIX) sgetrs.$(PSUFFIX) : lapack/getrs.c $(CC) -c $(CFLAGS) $< -o $(@F) -dgetrs.$(SUFFIX) dgetrs.$(PSUFFIX) : getrs.c +dgetrs.$(SUFFIX) dgetrs.$(PSUFFIX) : lapack/getrs.c $(CC) -c $(CFLAGS) $< -o $(@F) qgetrs.$(SUFFIX) qgetrs.$(PSUFFIX) : getrs.c $(CC) -c $(CFLAGS) $< -o $(@F) -cgetrs.$(SUFFIX) cgetrs.$(PSUFFIX) : zgetrs.c +cgetrs.$(SUFFIX) cgetrs.$(PSUFFIX) : lapack/zgetrs.c $(CC) -c $(CFLAGS) $< -o $(@F) -zgetrs.$(SUFFIX) zgetrs.$(PSUFFIX) : zgetrs.c +zgetrs.$(SUFFIX) zgetrs.$(PSUFFIX) : lapack/zgetrs.c $(CC) -c $(CFLAGS) $< -o $(@F) xgetrs.$(SUFFIX) xgetrs.$(PSUFFIX) : zgetrs.c diff --git a/lapack-netlib/SRC/Makefile b/lapack-netlib/SRC/Makefile index 789f0f907..6b76852b0 100644 --- a/lapack-netlib/SRC/Makefile +++ b/lapack-netlib/SRC/Makefile @@ -157,7 +157,7 @@ SLASRC = \ sgeqrt.o sgeqrt2.o sgeqrt3.o sgemqrt.o \ stpqrt.o stpqrt2.o stpmqrt.o stprfb.o -DSLASRC = spotrs.o sgetrs.o spotrf.o +DSLASRC = spotrs.o spotrf.o ifdef USEXBLAS SXLASRC = sgesvxx.o sgerfsx.o sla_gerfsx_extended.o sla_geamv.o \ @@ -252,7 +252,7 @@ CXLASRC = cgesvxx.o cgerfsx.o cla_gerfsx_extended.o cla_geamv.o \ cla_lin_berr.o clarscl2.o clascl2.o cla_wwaddw.o endif -ZCLASRC = cpotrs.o cgetrs.o cpotrf.o +ZCLASRC = cpotrs.o cpotrf.o DLASRC = \ dgbbrd.o dgbcon.o dgbequ.o dgbrfs.o dgbsv.o \ @@ -263,7 +263,7 @@ DLASRC = \ dgeqp3.o dgeqpf.o dgeqr2.o dgeqr2p.o dgeqrf.o dgeqrfp.o dgerfs.o \ dgerq2.o dgerqf.o dgesc2.o dgesdd.o dgesv.o dgesvd.o dgesvx.o \ dgetc2.o dgetf2.o dgetri.o \ - dgetrs.o dggbak.o dggbal.o dgges.o dggesx.o dggev.o dggevx.o \ + dggbak.o dggbal.o dgges.o dggesx.o dggev.o dggevx.o \ dggglm.o dgghrd.o dgglse.o dggqrf.o \ dggrqf.o dggsvd.o dggsvp.o dgtcon.o dgtrfs.o dgtsv.o \ dgtsvx.o dgttrf.o dgttrs.o dgtts2.o dhgeqz.o \ @@ -336,7 +336,7 @@ ZLASRC = \ zgels.o zgelsd.o zgelss.o zgelsx.o zgelsy.o zgeql2.o zgeqlf.o zgeqp3.o \ zgeqpf.o zgeqr2.o zgeqr2p.o zgeqrf.o zgeqrfp.o zgerfs.o zgerq2.o zgerqf.o \ zgesc2.o zgesdd.o zgesv.o zgesvd.o zgesvx.o zgetc2.o zgetf2.o \ - zgetri.o zgetrs.o \ + zgetri.o \ zggbak.o zggbal.o zgges.o zggesx.o zggev.o zggevx.o zggglm.o \ zgghrd.o zgglse.o zggqrf.o zggrqf.o \ zggsvd.o zggsvp.o \ diff --git a/lapack/Makefile b/lapack/Makefile index da88ba00e..b0e3cf071 100644 --- a/lapack/Makefile +++ b/lapack/Makefile @@ -2,7 +2,7 @@ TOPDIR = .. include ../Makefile.system #SUBDIRS = laswp getf2 getrf potf2 potrf lauu2 lauum trti2 trtri getrs -SUBDIRS = getrf getf2 laswp +SUBDIRS = getrf getf2 laswp getrs FLAMEDIRS = laswp getf2 potf2 lauu2 trti2 From 4f98f8c9b32602f6590f1997be5b272f62c8cb78 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 18 May 2014 21:42:37 +0200 Subject: [PATCH 58/70] enabled and tested optimized potrf lapack functions --- interface/Makefile | 16 ++++++++-------- lapack-netlib/SRC/Makefile | 8 ++++---- lapack/Makefile | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/interface/Makefile b/interface/Makefile index 957b4a8fe..d694591e6 100644 --- a/interface/Makefile +++ b/interface/Makefile @@ -348,7 +348,7 @@ XBLASOBJS = $(XBLAS1OBJS) $(XBLAS2OBJS) $(XBLAS3OBJS) # slaswp.$(SUFFIX) sgetrs.$(SUFFIX) sgesv.$(SUFFIX) spotri.$(SUFFIX) \ SLAPACKOBJS = \ - sgetrf.$(SUFFIX) sgetrs.$(SUFFIX) + sgetrf.$(SUFFIX) sgetrs.$(SUFFIX) spotrf.$(SUFFIX) #DLAPACKOBJS = \ @@ -357,7 +357,7 @@ SLAPACKOBJS = \ # dlaswp.$(SUFFIX) dgetrs.$(SUFFIX) dgesv.$(SUFFIX) dpotri.$(SUFFIX) \ DLAPACKOBJS = \ - dgetrf.$(SUFFIX) dgetrs.$(SUFFIX) + dgetrf.$(SUFFIX) dgetrs.$(SUFFIX) dpotrf.$(SUFFIX) QLAPACKOBJS = \ qgetf2.$(SUFFIX) qgetrf.$(SUFFIX) qlauu2.$(SUFFIX) qlauum.$(SUFFIX) \ @@ -370,7 +370,7 @@ QLAPACKOBJS = \ # claswp.$(SUFFIX) cgetrs.$(SUFFIX) cgesv.$(SUFFIX) cpotri.$(SUFFIX) \ CLAPACKOBJS = \ - cgetrf.$(SUFFIX) cgetrs.$(SUFFIX) + cgetrf.$(SUFFIX) cgetrs.$(SUFFIX) cpotrf.$(SUFFIX) #ZLAPACKOBJS = \ @@ -379,7 +379,7 @@ CLAPACKOBJS = \ # zlaswp.$(SUFFIX) zgetrs.$(SUFFIX) zgesv.$(SUFFIX) zpotri.$(SUFFIX) \ ZLAPACKOBJS = \ - zgetrf.$(SUFFIX) zgetrs.$(SUFFIX) + zgetrf.$(SUFFIX) zgetrs.$(SUFFIX) zpotrf.$(SUFFIX) XLAPACKOBJS = \ xgetf2.$(SUFFIX) xgetrf.$(SUFFIX) xlauu2.$(SUFFIX) xlauum.$(SUFFIX) \ @@ -1835,19 +1835,19 @@ zpotf2.$(SUFFIX) zpotf2.$(PSUFFIX) : zpotf2.c xpotf2.$(SUFFIX) xpotf2.$(PSUFFIX) : zpotf2.c $(CC) -c $(CFLAGS) $< -o $(@F) -spotrf.$(SUFFIX) spotrf.$(PSUFFIX) : potrf.c +spotrf.$(SUFFIX) spotrf.$(PSUFFIX) : lapack/potrf.c $(CC) -c $(CFLAGS) $< -o $(@F) -dpotrf.$(SUFFIX) dpotrf.$(PSUFFIX) : potrf.c +dpotrf.$(SUFFIX) dpotrf.$(PSUFFIX) : lapack/potrf.c $(CC) -c $(CFLAGS) $< -o $(@F) qpotrf.$(SUFFIX) qpotrf.$(PSUFFIX) : potrf.c $(CC) -c $(CFLAGS) $< -o $(@F) -cpotrf.$(SUFFIX) cpotrf.$(PSUFFIX) : zpotrf.c +cpotrf.$(SUFFIX) cpotrf.$(PSUFFIX) : lapack/zpotrf.c $(CC) -c $(CFLAGS) $< -o $(@F) -zpotrf.$(SUFFIX) zpotrf.$(PSUFFIX) : zpotrf.c +zpotrf.$(SUFFIX) zpotrf.$(PSUFFIX) : lapack/zpotrf.c $(CC) -c $(CFLAGS) $< -o $(@F) xpotrf.$(SUFFIX) xpotrf.$(PSUFFIX) : zpotrf.c diff --git a/lapack-netlib/SRC/Makefile b/lapack-netlib/SRC/Makefile index 6b76852b0..2f1e077fb 100644 --- a/lapack-netlib/SRC/Makefile +++ b/lapack-netlib/SRC/Makefile @@ -157,7 +157,7 @@ SLASRC = \ sgeqrt.o sgeqrt2.o sgeqrt3.o sgemqrt.o \ stpqrt.o stpqrt2.o stpmqrt.o stprfb.o -DSLASRC = spotrs.o spotrf.o +DSLASRC = spotrs.o ifdef USEXBLAS SXLASRC = sgesvxx.o sgerfsx.o sla_gerfsx_extended.o sla_geamv.o \ @@ -252,7 +252,7 @@ CXLASRC = cgesvxx.o cgerfsx.o cla_gerfsx_extended.o cla_geamv.o \ cla_lin_berr.o clarscl2.o clascl2.o cla_wwaddw.o endif -ZCLASRC = cpotrs.o cpotrf.o +ZCLASRC = cpotrs.o DLASRC = \ dgbbrd.o dgbcon.o dgbequ.o dgbrfs.o dgbsv.o \ @@ -287,7 +287,7 @@ DLASRC = \ dormr3.o dormrq.o dormrz.o dormtr.o dpbcon.o dpbequ.o dpbrfs.o \ dpbstf.o dpbsv.o dpbsvx.o \ dpbtf2.o dpbtrf.o dpbtrs.o dpocon.o dpoequ.o dporfs.o dposv.o \ - dposvx.o dpotf2.o dpotrf.o dpotri.o dpotrs.o dpstrf.o dpstf2.o \ + dposvx.o dpotf2.o dpotri.o dpotrs.o dpstrf.o dpstf2.o \ dppcon.o dppequ.o \ dpprfs.o dppsv.o dppsvx.o dpptrf.o dpptri.o dpptrs.o dptcon.o \ dpteqr.o dptrfs.o dptsv.o dptsvx.o dpttrs.o dptts2.o drscl.o \ @@ -372,7 +372,7 @@ ZLASRC = \ zlatbs.o zlatdf.o zlatps.o zlatrd.o zlatrs.o zlatrz.o zlatzm.o zlauu2.o \ zlauum.o zpbcon.o zpbequ.o zpbrfs.o zpbstf.o zpbsv.o \ zpbsvx.o zpbtf2.o zpbtrf.o zpbtrs.o zpocon.o zpoequ.o zporfs.o \ - zposv.o zposvx.o zpotf2.o zpotrf.o zpotri.o zpotrs.o zpstrf.o zpstf2.o \ + zposv.o zposvx.o zpotf2.o zpotri.o zpotrs.o zpstrf.o zpstf2.o \ zppcon.o zppequ.o zpprfs.o zppsv.o zppsvx.o zpptrf.o zpptri.o zpptrs.o \ zptcon.o zpteqr.o zptrfs.o zptsv.o zptsvx.o zpttrf.o zpttrs.o zptts2.o \ zrot.o zspcon.o zspmv.o zspr.o zsprfs.o zspsv.o \ diff --git a/lapack/Makefile b/lapack/Makefile index b0e3cf071..f99416fa6 100644 --- a/lapack/Makefile +++ b/lapack/Makefile @@ -2,7 +2,7 @@ TOPDIR = .. include ../Makefile.system #SUBDIRS = laswp getf2 getrf potf2 potrf lauu2 lauum trti2 trtri getrs -SUBDIRS = getrf getf2 laswp getrs +SUBDIRS = getrf getf2 laswp getrs potrf potf2 FLAMEDIRS = laswp getf2 potf2 lauu2 trti2 From 61a2c50e8ea4efa92c2e20e293775d251f8ade47 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 18 May 2014 22:21:16 +0200 Subject: [PATCH 59/70] enabled and tested optimized getf2 lapack functions --- interface/Makefile | 16 ++++++++-------- lapack-netlib/SRC/Makefile | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/interface/Makefile b/interface/Makefile index d694591e6..ff4102d9a 100644 --- a/interface/Makefile +++ b/interface/Makefile @@ -348,7 +348,7 @@ XBLASOBJS = $(XBLAS1OBJS) $(XBLAS2OBJS) $(XBLAS3OBJS) # slaswp.$(SUFFIX) sgetrs.$(SUFFIX) sgesv.$(SUFFIX) spotri.$(SUFFIX) \ SLAPACKOBJS = \ - sgetrf.$(SUFFIX) sgetrs.$(SUFFIX) spotrf.$(SUFFIX) + sgetrf.$(SUFFIX) sgetrs.$(SUFFIX) spotrf.$(SUFFIX) sgetf2.$(SUFFIX) #DLAPACKOBJS = \ @@ -357,7 +357,7 @@ SLAPACKOBJS = \ # dlaswp.$(SUFFIX) dgetrs.$(SUFFIX) dgesv.$(SUFFIX) dpotri.$(SUFFIX) \ DLAPACKOBJS = \ - dgetrf.$(SUFFIX) dgetrs.$(SUFFIX) dpotrf.$(SUFFIX) + dgetrf.$(SUFFIX) dgetrs.$(SUFFIX) dpotrf.$(SUFFIX) dgetf2.$(SUFFIX) QLAPACKOBJS = \ qgetf2.$(SUFFIX) qgetrf.$(SUFFIX) qlauu2.$(SUFFIX) qlauum.$(SUFFIX) \ @@ -370,7 +370,7 @@ QLAPACKOBJS = \ # claswp.$(SUFFIX) cgetrs.$(SUFFIX) cgesv.$(SUFFIX) cpotri.$(SUFFIX) \ CLAPACKOBJS = \ - cgetrf.$(SUFFIX) cgetrs.$(SUFFIX) cpotrf.$(SUFFIX) + cgetrf.$(SUFFIX) cgetrs.$(SUFFIX) cpotrf.$(SUFFIX) cgetf2.$(SUFFIX) #ZLAPACKOBJS = \ @@ -379,7 +379,7 @@ CLAPACKOBJS = \ # zlaswp.$(SUFFIX) zgetrs.$(SUFFIX) zgesv.$(SUFFIX) zpotri.$(SUFFIX) \ ZLAPACKOBJS = \ - zgetrf.$(SUFFIX) zgetrs.$(SUFFIX) zpotrf.$(SUFFIX) + zgetrf.$(SUFFIX) zgetrs.$(SUFFIX) zpotrf.$(SUFFIX) zgetf2.$(SUFFIX) XLAPACKOBJS = \ xgetf2.$(SUFFIX) xgetrf.$(SUFFIX) xlauu2.$(SUFFIX) xlauum.$(SUFFIX) \ @@ -1745,19 +1745,19 @@ cblas_cher2k.$(SUFFIX) cblas_cher2k.$(PSUFFIX) : syr2k.c cblas_zher2k.$(SUFFIX) cblas_zher2k.$(PSUFFIX) : syr2k.c $(CC) -DCBLAS -c $(CFLAGS) -DHEMM $< -o $(@F) -sgetf2.$(SUFFIX) sgetf2.$(PSUFFIX) : getf2.c +sgetf2.$(SUFFIX) sgetf2.$(PSUFFIX) : lapack/getf2.c $(CC) -c $(CFLAGS) $< -o $(@F) -dgetf2.$(SUFFIX) dgetf2.$(PSUFFIX) : getf2.c +dgetf2.$(SUFFIX) dgetf2.$(PSUFFIX) : lapack/getf2.c $(CC) -c $(CFLAGS) $< -o $(@F) qgetf2.$(SUFFIX) qgetf2.$(PSUFFIX) : getf2.c $(CC) -c $(CFLAGS) $< -o $(@F) -cgetf2.$(SUFFIX) cgetf2.$(PSUFFIX) : zgetf2.c +cgetf2.$(SUFFIX) cgetf2.$(PSUFFIX) : lapack/zgetf2.c $(CC) -c $(CFLAGS) $< -o $(@F) -zgetf2.$(SUFFIX) zgetf2.$(PSUFFIX) : zgetf2.c +zgetf2.$(SUFFIX) zgetf2.$(PSUFFIX) : lapack/zgetf2.c $(CC) -c $(CFLAGS) $< -o $(@F) xgetf2.$(SUFFIX) xgetf2.$(PSUFFIX) : zgetf2.c diff --git a/lapack-netlib/SRC/Makefile b/lapack-netlib/SRC/Makefile index 2f1e077fb..dee4be217 100644 --- a/lapack-netlib/SRC/Makefile +++ b/lapack-netlib/SRC/Makefile @@ -102,7 +102,7 @@ SLASRC = \ sgels.o sgelsd.o sgelss.o sgelsx.o sgelsy.o sgeql2.o sgeqlf.o \ sgeqp3.o sgeqpf.o sgeqr2.o sgeqr2p.o sgeqrf.o sgeqrfp.o sgerfs.o \ sgerq2.o sgerqf.o sgesc2.o sgesdd.o sgesv.o sgesvd.o sgesvx.o \ - sgetc2.o sgetf2.o sgetri.o \ + sgetc2.o sgetri.o \ sggbak.o sggbal.o sgges.o sggesx.o sggev.o sggevx.o \ sggglm.o sgghrd.o sgglse.o sggqrf.o \ sggrqf.o sggsvd.o sggsvp.o sgtcon.o sgtrfs.o sgtsv.o \ @@ -177,7 +177,7 @@ CLASRC = \ cgels.o cgelsd.o cgelss.o cgelsx.o cgelsy.o cgeql2.o cgeqlf.o cgeqp3.o \ cgeqpf.o cgeqr2.o cgeqr2p.o cgeqrf.o cgeqrfp.o cgerfs.o \ cgerq2.o cgerqf.o cgesc2.o cgesdd.o cgesv.o cgesvd.o \ - cgesvx.o cgetc2.o cgetf2.o cgetri.o \ + cgesvx.o cgetc2.o cgetri.o \ cggbak.o cggbal.o cgges.o cggesx.o cggev.o cggevx.o cggglm.o \ cgghrd.o cgglse.o cggqrf.o cggrqf.o \ cggsvd.o cggsvp.o \ @@ -262,7 +262,7 @@ DLASRC = \ dgels.o dgelsd.o dgelss.o dgelsx.o dgelsy.o dgeql2.o dgeqlf.o \ dgeqp3.o dgeqpf.o dgeqr2.o dgeqr2p.o dgeqrf.o dgeqrfp.o dgerfs.o \ dgerq2.o dgerqf.o dgesc2.o dgesdd.o dgesv.o dgesvd.o dgesvx.o \ - dgetc2.o dgetf2.o dgetri.o \ + dgetc2.o dgetri.o \ dggbak.o dggbal.o dgges.o dggesx.o dggev.o dggevx.o \ dggglm.o dgghrd.o dgglse.o dggqrf.o \ dggrqf.o dggsvd.o dggsvp.o dgtcon.o dgtrfs.o dgtsv.o \ @@ -335,7 +335,7 @@ ZLASRC = \ zgegs.o zgegv.o zgehd2.o zgehrd.o zgelq2.o zgelqf.o \ zgels.o zgelsd.o zgelss.o zgelsx.o zgelsy.o zgeql2.o zgeqlf.o zgeqp3.o \ zgeqpf.o zgeqr2.o zgeqr2p.o zgeqrf.o zgeqrfp.o zgerfs.o zgerq2.o zgerqf.o \ - zgesc2.o zgesdd.o zgesv.o zgesvd.o zgesvx.o zgetc2.o zgetf2.o \ + zgesc2.o zgesdd.o zgesv.o zgesvd.o zgesvx.o zgetc2.o \ zgetri.o \ zggbak.o zggbal.o zgges.o zggesx.o zggev.o zggevx.o zggglm.o \ zgghrd.o zgglse.o zggqrf.o zggrqf.o \ From ebc95e6f11e64a671c5a42b4bbb85207e8644017 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 18 May 2014 22:41:43 +0200 Subject: [PATCH 60/70] enabled and tested optimized potf2 lapack functions --- interface/Makefile | 23 +++++++++++++++-------- lapack-netlib/SRC/Makefile | 8 ++++---- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/interface/Makefile b/interface/Makefile index ff4102d9a..42e9f50b5 100644 --- a/interface/Makefile +++ b/interface/Makefile @@ -348,7 +348,8 @@ XBLASOBJS = $(XBLAS1OBJS) $(XBLAS2OBJS) $(XBLAS3OBJS) # slaswp.$(SUFFIX) sgetrs.$(SUFFIX) sgesv.$(SUFFIX) spotri.$(SUFFIX) \ SLAPACKOBJS = \ - sgetrf.$(SUFFIX) sgetrs.$(SUFFIX) spotrf.$(SUFFIX) sgetf2.$(SUFFIX) + sgetrf.$(SUFFIX) sgetrs.$(SUFFIX) spotrf.$(SUFFIX) sgetf2.$(SUFFIX) \ + spotf2.$(SUFFIX) #DLAPACKOBJS = \ @@ -357,7 +358,9 @@ SLAPACKOBJS = \ # dlaswp.$(SUFFIX) dgetrs.$(SUFFIX) dgesv.$(SUFFIX) dpotri.$(SUFFIX) \ DLAPACKOBJS = \ - dgetrf.$(SUFFIX) dgetrs.$(SUFFIX) dpotrf.$(SUFFIX) dgetf2.$(SUFFIX) + dgetrf.$(SUFFIX) dgetrs.$(SUFFIX) dpotrf.$(SUFFIX) dgetf2.$(SUFFIX) \ + dpotf2.$(SUFFIX) + QLAPACKOBJS = \ qgetf2.$(SUFFIX) qgetrf.$(SUFFIX) qlauu2.$(SUFFIX) qlauum.$(SUFFIX) \ @@ -370,7 +373,8 @@ QLAPACKOBJS = \ # claswp.$(SUFFIX) cgetrs.$(SUFFIX) cgesv.$(SUFFIX) cpotri.$(SUFFIX) \ CLAPACKOBJS = \ - cgetrf.$(SUFFIX) cgetrs.$(SUFFIX) cpotrf.$(SUFFIX) cgetf2.$(SUFFIX) + cgetrf.$(SUFFIX) cgetrs.$(SUFFIX) cpotrf.$(SUFFIX) cgetf2.$(SUFFIX) \ + cpotf2.$(SUFFIX) #ZLAPACKOBJS = \ @@ -379,7 +383,10 @@ CLAPACKOBJS = \ # zlaswp.$(SUFFIX) zgetrs.$(SUFFIX) zgesv.$(SUFFIX) zpotri.$(SUFFIX) \ ZLAPACKOBJS = \ - zgetrf.$(SUFFIX) zgetrs.$(SUFFIX) zpotrf.$(SUFFIX) zgetf2.$(SUFFIX) + zgetrf.$(SUFFIX) zgetrs.$(SUFFIX) zpotrf.$(SUFFIX) zgetf2.$(SUFFIX) \ + zpotf2.$(SUFFIX) + + XLAPACKOBJS = \ xgetf2.$(SUFFIX) xgetrf.$(SUFFIX) xlauu2.$(SUFFIX) xlauum.$(SUFFIX) \ @@ -1817,19 +1824,19 @@ zlauum.$(SUFFIX) zlauum.$(PSUFFIX) : zlauum.c xlauum.$(SUFFIX) xlauum.$(PSUFFIX) : zlauum.c $(CC) -c $(CFLAGS) $< -o $(@F) -spotf2.$(SUFFIX) spotf2.$(PSUFFIX) : potf2.c +spotf2.$(SUFFIX) spotf2.$(PSUFFIX) : lapack/potf2.c $(CC) -c $(CFLAGS) $< -o $(@F) -dpotf2.$(SUFFIX) dpotf2.$(PSUFFIX) : potf2.c +dpotf2.$(SUFFIX) dpotf2.$(PSUFFIX) : lapack/potf2.c $(CC) -c $(CFLAGS) $< -o $(@F) qpotf2.$(SUFFIX) qpotf2.$(PSUFFIX) : potf2.c $(CC) -c $(CFLAGS) $< -o $(@F) -cpotf2.$(SUFFIX) cpotf2.$(PSUFFIX) : zpotf2.c +cpotf2.$(SUFFIX) cpotf2.$(PSUFFIX) : lapack/zpotf2.c $(CC) -c $(CFLAGS) $< -o $(@F) -zpotf2.$(SUFFIX) zpotf2.$(PSUFFIX) : zpotf2.c +zpotf2.$(SUFFIX) zpotf2.$(PSUFFIX) : lapack/zpotf2.c $(CC) -c $(CFLAGS) $< -o $(@F) xpotf2.$(SUFFIX) xpotf2.$(PSUFFIX) : zpotf2.c diff --git a/lapack-netlib/SRC/Makefile b/lapack-netlib/SRC/Makefile index dee4be217..40bb5625c 100644 --- a/lapack-netlib/SRC/Makefile +++ b/lapack-netlib/SRC/Makefile @@ -127,7 +127,7 @@ SLASRC = \ sormr3.o sormrq.o sormrz.o sormtr.o spbcon.o spbequ.o spbrfs.o \ spbstf.o spbsv.o spbsvx.o \ spbtf2.o spbtrf.o spbtrs.o spocon.o spoequ.o sporfs.o sposv.o \ - sposvx.o spotf2.o spotri.o spstrf.o spstf2.o \ + sposvx.o spotri.o spstrf.o spstf2.o \ sppcon.o sppequ.o \ spprfs.o sppsv.o sppsvx.o spptrf.o spptri.o spptrs.o sptcon.o \ spteqr.o sptrfs.o sptsv.o sptsvx.o spttrs.o sptts2.o srscl.o \ @@ -210,7 +210,7 @@ CLASRC = \ claswp.o clasyf.o clasyf_rook.o clatbs.o clatdf.o clatps.o clatrd.o clatrs.o clatrz.o \ clatzm.o clauu2.o clauum.o cpbcon.o cpbequ.o cpbrfs.o cpbstf.o cpbsv.o \ cpbsvx.o cpbtf2.o cpbtrf.o cpbtrs.o cpocon.o cpoequ.o cporfs.o \ - cposv.o cposvx.o cpotf2.o cpotri.o cpstrf.o cpstf2.o \ + cposv.o cposvx.o cpotri.o cpstrf.o cpstf2.o \ cppcon.o cppequ.o cpprfs.o cppsv.o cppsvx.o cpptrf.o cpptri.o cpptrs.o \ cptcon.o cpteqr.o cptrfs.o cptsv.o cptsvx.o cpttrf.o cpttrs.o cptts2.o \ crot.o cspcon.o cspmv.o cspr.o csprfs.o cspsv.o \ @@ -287,7 +287,7 @@ DLASRC = \ dormr3.o dormrq.o dormrz.o dormtr.o dpbcon.o dpbequ.o dpbrfs.o \ dpbstf.o dpbsv.o dpbsvx.o \ dpbtf2.o dpbtrf.o dpbtrs.o dpocon.o dpoequ.o dporfs.o dposv.o \ - dposvx.o dpotf2.o dpotri.o dpotrs.o dpstrf.o dpstf2.o \ + dposvx.o dpotri.o dpotrs.o dpstrf.o dpstf2.o \ dppcon.o dppequ.o \ dpprfs.o dppsv.o dppsvx.o dpptrf.o dpptri.o dpptrs.o dptcon.o \ dpteqr.o dptrfs.o dptsv.o dptsvx.o dpttrs.o dptts2.o drscl.o \ @@ -372,7 +372,7 @@ ZLASRC = \ zlatbs.o zlatdf.o zlatps.o zlatrd.o zlatrs.o zlatrz.o zlatzm.o zlauu2.o \ zlauum.o zpbcon.o zpbequ.o zpbrfs.o zpbstf.o zpbsv.o \ zpbsvx.o zpbtf2.o zpbtrf.o zpbtrs.o zpocon.o zpoequ.o zporfs.o \ - zposv.o zposvx.o zpotf2.o zpotri.o zpotrs.o zpstrf.o zpstf2.o \ + zposv.o zposvx.o zpotri.o zpotrs.o zpstrf.o zpstf2.o \ zppcon.o zppequ.o zpprfs.o zppsv.o zppsvx.o zpptrf.o zpptri.o zpptrs.o \ zptcon.o zpteqr.o zptrfs.o zptsv.o zptsvx.o zpttrf.o zpttrs.o zptts2.o \ zrot.o zspcon.o zspmv.o zspr.o zsprfs.o zspsv.o \ From aaa9d7fbf8428d3a02b78231d420c7a02f4af85a Mon Sep 17 00:00:00 2001 From: wernsaar Date: Sun, 18 May 2014 23:41:13 +0200 Subject: [PATCH 61/70] marked potri functions as bad because a lot of errors --- interface/lapack/{potri.c => potri.c.bad} | 0 interface/lapack/{zpotri.c => zpotri.c.bad} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename interface/lapack/{potri.c => potri.c.bad} (100%) rename interface/lapack/{zpotri.c => zpotri.c.bad} (100%) diff --git a/interface/lapack/potri.c b/interface/lapack/potri.c.bad similarity index 100% rename from interface/lapack/potri.c rename to interface/lapack/potri.c.bad diff --git a/interface/lapack/zpotri.c b/interface/lapack/zpotri.c.bad similarity index 100% rename from interface/lapack/zpotri.c rename to interface/lapack/zpotri.c.bad From d4237cb7f3632d36ce9cdae008afa533f0b7d51d Mon Sep 17 00:00:00 2001 From: wernsaar Date: Mon, 19 May 2014 11:23:17 +0200 Subject: [PATCH 62/70] marked larf.c as obsolete --- interface/lapack/larf.c | 109 ---------------------------------------- 1 file changed, 109 deletions(-) delete mode 100644 interface/lapack/larf.c diff --git a/interface/lapack/larf.c b/interface/lapack/larf.c deleted file mode 100644 index 3b538c4a2..000000000 --- a/interface/lapack/larf.c +++ /dev/null @@ -1,109 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -static int (*larf[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { - LARF_L, LARF_R, -}; - -int NAME(char *SIDE, blasint *M, blasint *N, FLOAT *v, blasint *incV, FLOAT *tau, FLOAT *c, blasint *ldC, FLOAT *work){ - - blas_arg_t args; - - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - char side_arg = *SIDE; - int side; - - PRINT_DEBUG_NAME; - - TOUPPER(side_arg); - - args.m = *M; - args.n = *N; - args.a = (void *)v; - args.lda = *incV; - args.c = (void *)c; - args.ldc = *ldC; - - args.alpha = (void *)tau; - - side = -1; - if (side_arg == 'L') side = 0; - if (side_arg == 'R') side = 1; - - if (args.m == 0 || args.n == 0) return 0; - -#ifndef COMPLEX - if (*tau == ZERO) return 0; -#else - if ((*(tau + 0) == ZERO) && (*(tau + 1) == ZERO)) return 0; -#endif - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - - larf[side](&args, NULL, NULL, sa, sb, 0); - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.m * args.n, 2. / 3. * args.m * args.n * args.n); - - IDEBUG_END; - - return 0; -} From 9f201558c92e2d36f53f2d0f4c2f3aa63f42edcb Mon Sep 17 00:00:00 2001 From: wernsaar Date: Mon, 19 May 2014 12:00:16 +0200 Subject: [PATCH 63/70] marked lauu2.c and lauum.c as bad --- interface/lapack/larf.c.obsolete | 109 ++++++++++++++++++++++ interface/lapack/{lauu2.c => lauu2.c.bad} | 0 interface/lapack/{lauum.c => lauum.c.bad} | 0 3 files changed, 109 insertions(+) create mode 100644 interface/lapack/larf.c.obsolete rename interface/lapack/{lauu2.c => lauu2.c.bad} (100%) rename interface/lapack/{lauum.c => lauum.c.bad} (100%) diff --git a/interface/lapack/larf.c.obsolete b/interface/lapack/larf.c.obsolete new file mode 100644 index 000000000..3b538c4a2 --- /dev/null +++ b/interface/lapack/larf.c.obsolete @@ -0,0 +1,109 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +static int (*larf[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { + LARF_L, LARF_R, +}; + +int NAME(char *SIDE, blasint *M, blasint *N, FLOAT *v, blasint *incV, FLOAT *tau, FLOAT *c, blasint *ldC, FLOAT *work){ + + blas_arg_t args; + + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + char side_arg = *SIDE; + int side; + + PRINT_DEBUG_NAME; + + TOUPPER(side_arg); + + args.m = *M; + args.n = *N; + args.a = (void *)v; + args.lda = *incV; + args.c = (void *)c; + args.ldc = *ldC; + + args.alpha = (void *)tau; + + side = -1; + if (side_arg == 'L') side = 0; + if (side_arg == 'R') side = 1; + + if (args.m == 0 || args.n == 0) return 0; + +#ifndef COMPLEX + if (*tau == ZERO) return 0; +#else + if ((*(tau + 0) == ZERO) && (*(tau + 1) == ZERO)) return 0; +#endif + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + + larf[side](&args, NULL, NULL, sa, sb, 0); + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.m * args.n, 2. / 3. * args.m * args.n * args.n); + + IDEBUG_END; + + return 0; +} diff --git a/interface/lapack/lauu2.c b/interface/lapack/lauu2.c.bad similarity index 100% rename from interface/lapack/lauu2.c rename to interface/lapack/lauu2.c.bad diff --git a/interface/lapack/lauum.c b/interface/lapack/lauum.c.bad similarity index 100% rename from interface/lapack/lauum.c rename to interface/lapack/lauum.c.bad From 45be9ac111bde752b432f54c5926a4b575d9b5b8 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Mon, 19 May 2014 12:29:29 +0200 Subject: [PATCH 64/70] moved trtri.c and ztrtri.c to the directory lapack --- interface/{ => lapack}/trtri.c | 0 interface/{ => lapack}/ztrtri.c | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename interface/{ => lapack}/trtri.c (100%) rename interface/{ => lapack}/ztrtri.c (100%) diff --git a/interface/trtri.c b/interface/lapack/trtri.c similarity index 100% rename from interface/trtri.c rename to interface/lapack/trtri.c diff --git a/interface/ztrtri.c b/interface/lapack/ztrtri.c similarity index 100% rename from interface/ztrtri.c rename to interface/lapack/ztrtri.c From 9a9e8102398c2db657fa01fc7cea3a8fa408f0e8 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Mon, 19 May 2014 12:42:52 +0200 Subject: [PATCH 65/70] marked trtri.c and ztrtri as bad --- interface/lapack/{trtri.c => trtri.c.bad} | 0 interface/lapack/{ztrtri.c => ztrtri.c.bad} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename interface/lapack/{trtri.c => trtri.c.bad} (100%) rename interface/lapack/{ztrtri.c => ztrtri.c.bad} (100%) diff --git a/interface/lapack/trtri.c b/interface/lapack/trtri.c.bad similarity index 100% rename from interface/lapack/trtri.c rename to interface/lapack/trtri.c.bad diff --git a/interface/lapack/ztrtri.c b/interface/lapack/ztrtri.c.bad similarity index 100% rename from interface/lapack/ztrtri.c rename to interface/lapack/ztrtri.c.bad From 5e550349223c5a1b38169d14f130b26984669f50 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Mon, 19 May 2014 12:53:22 +0200 Subject: [PATCH 66/70] marked zlauu2.c and zlauum.c as bad --- interface/lapack/zlauu2.c.bad | 129 +++++++++++++++++++++++++++++++ interface/lapack/zlauum.c.bad | 141 ++++++++++++++++++++++++++++++++++ 2 files changed, 270 insertions(+) create mode 100644 interface/lapack/zlauu2.c.bad create mode 100644 interface/lapack/zlauum.c.bad diff --git a/interface/lapack/zlauu2.c.bad b/interface/lapack/zlauu2.c.bad new file mode 100644 index 000000000..05603fe1b --- /dev/null +++ b/interface/lapack/zlauu2.c.bad @@ -0,0 +1,129 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "QLAUU2" +#elif defined(DOUBLE) +#define ERROR_NAME "ZLAUU2" +#else +#define ERROR_NAME "CLAUU2" +#endif + +static blasint (*lauu2[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { + +#ifdef XDOUBLE + xlauu2_U, xlauu2_L, +#elif defined(DOUBLE) + zlauu2_U, zlauu2_L, +#else + clauu2_U, clauu2_L, +#endif + }; + +int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ + + blas_arg_t args; + + blasint uplo_arg = *UPLO; + blasint uplo; + blasint info; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.n = *N; + args.a = (void *)a; + args.lda = *ldA; + + TOUPPER(uplo_arg); + + uplo = -1; + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + if (args.lda < MAX(1,args.n)) info = 4; + if (args.n < 0) info = 2; + if (uplo < 0) info = 1; + if (info) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + *Info = - info; + return 0; + } + + *Info = 0; + + if (args.n <= 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + + info = (lauu2[uplo])(&args, NULL, NULL, sa, sb, 0); + + *Info = info; + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(1, .5 * args.n * args.n, + 2. * args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) + + 6. * 1./6. * args.n * (args.n * args.n - 1)); + + IDEBUG_END; + + return 0; +} diff --git a/interface/lapack/zlauum.c.bad b/interface/lapack/zlauum.c.bad new file mode 100644 index 000000000..23990e8e4 --- /dev/null +++ b/interface/lapack/zlauum.c.bad @@ -0,0 +1,141 @@ +/*********************************************************************/ +/* Copyright 2009, 2010 The University of Texas at Austin. */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* 1. Redistributions of source code must retain the above */ +/* copyright notice, this list of conditions and the following */ +/* disclaimer. */ +/* */ +/* 2. 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. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ +/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ +/* AUSTIN 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. */ +/* */ +/* The views and conclusions contained in the software and */ +/* documentation are those of the authors and should not be */ +/* interpreted as representing official policies, either expressed */ +/* or implied, of The University of Texas at Austin. */ +/*********************************************************************/ + +#include +#include "common.h" +#ifdef FUNCTION_PROFILE +#include "functable.h" +#endif + +#ifdef XDOUBLE +#define ERROR_NAME "XLAUUM" +#elif defined(DOUBLE) +#define ERROR_NAME "ZLAUUM" +#else +#define ERROR_NAME "CLAUUM" +#endif + +static blasint (*lauum_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { + LAUUM_U_SINGLE, LAUUM_L_SINGLE, +}; + +#ifdef SMP +static blasint (*lauum_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { + LAUUM_U_PARALLEL, LAUUM_L_PARALLEL, +}; +#endif + +int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ + + blas_arg_t args; + + blasint uplo_arg = *UPLO; + blasint uplo; + blasint info; + FLOAT *buffer; +#ifdef PPC440 + extern +#endif + FLOAT *sa, *sb; + + PRINT_DEBUG_NAME; + + args.n = *N; + args.a = (void *)a; + args.lda = *ldA; + + TOUPPER(uplo_arg); + + uplo = -1; + if (uplo_arg == 'U') uplo = 0; + if (uplo_arg == 'L') uplo = 1; + + info = 0; + if (args.lda < MAX(1,args.n)) info = 4; + if (args.n < 0) info = 2; + if (uplo < 0) info = 1; + if (info) { + BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); + *Info = - info; + return 0; + } + + *Info = 0; + + if (args.n == 0) return 0; + + IDEBUG_START; + + FUNCTION_PROFILE_START(); + +#ifndef PPC440 + buffer = (FLOAT *)blas_memory_alloc(1); + + sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); + sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); +#endif + +#ifdef SMP + args.common = NULL; + args.nthreads = num_cpu_avail(4); + + if (args.nthreads == 1) { +#endif + + *Info = (lauum_single[uplo])(&args, NULL, NULL, sa, sb, 0); + +#ifdef SMP + } else { + + *Info = (lauum_parallel[uplo])(&args, NULL, NULL, sa, sb, 0); + + } +#endif + +#ifndef PPC440 + blas_memory_free(buffer); +#endif + + FUNCTION_PROFILE_END(1, .5 * args.n * args.n, + 2. * args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) + + args.n * (args.n * args.n - 1)); + + IDEBUG_END; + + return 0; +} From 2ff66e661d2a2c2cb37df4c7cd316803e6be4c6c Mon Sep 17 00:00:00 2001 From: wernsaar Date: Mon, 19 May 2014 13:35:32 +0200 Subject: [PATCH 67/70] enabled and tested optimized laswp lapack function --- interface/Makefile | 16 ++--- interface/lapack/zlauu2.c | 129 --------------------------------- interface/lapack/zlauum.c | 141 ------------------------------------- lapack-netlib/SRC/Makefile | 8 +-- 4 files changed, 12 insertions(+), 282 deletions(-) delete mode 100644 interface/lapack/zlauu2.c delete mode 100644 interface/lapack/zlauum.c diff --git a/interface/Makefile b/interface/Makefile index 42e9f50b5..8b87127ef 100644 --- a/interface/Makefile +++ b/interface/Makefile @@ -349,7 +349,7 @@ XBLASOBJS = $(XBLAS1OBJS) $(XBLAS2OBJS) $(XBLAS3OBJS) SLAPACKOBJS = \ sgetrf.$(SUFFIX) sgetrs.$(SUFFIX) spotrf.$(SUFFIX) sgetf2.$(SUFFIX) \ - spotf2.$(SUFFIX) + spotf2.$(SUFFIX) slaswp.$(SUFFIX) #DLAPACKOBJS = \ @@ -359,7 +359,7 @@ SLAPACKOBJS = \ DLAPACKOBJS = \ dgetrf.$(SUFFIX) dgetrs.$(SUFFIX) dpotrf.$(SUFFIX) dgetf2.$(SUFFIX) \ - dpotf2.$(SUFFIX) + dpotf2.$(SUFFIX) dlaswp.$(SUFFIX) QLAPACKOBJS = \ @@ -374,7 +374,7 @@ QLAPACKOBJS = \ CLAPACKOBJS = \ cgetrf.$(SUFFIX) cgetrs.$(SUFFIX) cpotrf.$(SUFFIX) cgetf2.$(SUFFIX) \ - cpotf2.$(SUFFIX) + cpotf2.$(SUFFIX) claswp.$(SUFFIX) #ZLAPACKOBJS = \ @@ -384,7 +384,7 @@ CLAPACKOBJS = \ ZLAPACKOBJS = \ zgetrf.$(SUFFIX) zgetrs.$(SUFFIX) zpotrf.$(SUFFIX) zgetf2.$(SUFFIX) \ - zpotf2.$(SUFFIX) + zpotf2.$(SUFFIX) zlaswp.$(SUFFIX) @@ -1896,19 +1896,19 @@ ztrtri.$(SUFFIX) ztrtri.$(PSUFFIX) : ztrtri.c xtrtri.$(SUFFIX) xtrtri.$(PSUFFIX) : ztrtri.c $(CC) -c $(CFLAGS) $< -o $(@F) -slaswp.$(SUFFIX) slaswp.$(PSUFFIX) : laswp.c +slaswp.$(SUFFIX) slaswp.$(PSUFFIX) : lapack/laswp.c $(CC) -c $(CFLAGS) $< -o $(@F) -dlaswp.$(SUFFIX) dlaswp.$(PSUFFIX) : laswp.c +dlaswp.$(SUFFIX) dlaswp.$(PSUFFIX) : lapack/laswp.c $(CC) -c $(CFLAGS) $< -o $(@F) qlaswp.$(SUFFIX) qlaswp.$(PSUFFIX) : laswp.c $(CC) -c $(CFLAGS) $< -o $(@F) -claswp.$(SUFFIX) claswp.$(PSUFFIX) : zlaswp.c +claswp.$(SUFFIX) claswp.$(PSUFFIX) : lapack/zlaswp.c $(CC) -c $(CFLAGS) $< -o $(@F) -zlaswp.$(SUFFIX) zlaswp.$(PSUFFIX) : zlaswp.c +zlaswp.$(SUFFIX) zlaswp.$(PSUFFIX) : lapack/zlaswp.c $(CC) -c $(CFLAGS) $< -o $(@F) xlaswp.$(SUFFIX) xlaswp.$(PSUFFIX) : zlaswp.c diff --git a/interface/lapack/zlauu2.c b/interface/lapack/zlauu2.c deleted file mode 100644 index 05603fe1b..000000000 --- a/interface/lapack/zlauu2.c +++ /dev/null @@ -1,129 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "QLAUU2" -#elif defined(DOUBLE) -#define ERROR_NAME "ZLAUU2" -#else -#define ERROR_NAME "CLAUU2" -#endif - -static blasint (*lauu2[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { - -#ifdef XDOUBLE - xlauu2_U, xlauu2_L, -#elif defined(DOUBLE) - zlauu2_U, zlauu2_L, -#else - clauu2_U, clauu2_L, -#endif - }; - -int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ - - blas_arg_t args; - - blasint uplo_arg = *UPLO; - blasint uplo; - blasint info; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.n = *N; - args.a = (void *)a; - args.lda = *ldA; - - TOUPPER(uplo_arg); - - uplo = -1; - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - if (args.lda < MAX(1,args.n)) info = 4; - if (args.n < 0) info = 2; - if (uplo < 0) info = 1; - if (info) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - *Info = - info; - return 0; - } - - *Info = 0; - - if (args.n <= 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - - info = (lauu2[uplo])(&args, NULL, NULL, sa, sb, 0); - - *Info = info; - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(1, .5 * args.n * args.n, - 2. * args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) - + 6. * 1./6. * args.n * (args.n * args.n - 1)); - - IDEBUG_END; - - return 0; -} diff --git a/interface/lapack/zlauum.c b/interface/lapack/zlauum.c deleted file mode 100644 index 23990e8e4..000000000 --- a/interface/lapack/zlauum.c +++ /dev/null @@ -1,141 +0,0 @@ -/*********************************************************************/ -/* Copyright 2009, 2010 The University of Texas at Austin. */ -/* All rights reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* 1. Redistributions of source code must retain the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer. */ -/* */ -/* 2. 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. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ -/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ -/* AUSTIN 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. */ -/* */ -/* The views and conclusions contained in the software and */ -/* documentation are those of the authors and should not be */ -/* interpreted as representing official policies, either expressed */ -/* or implied, of The University of Texas at Austin. */ -/*********************************************************************/ - -#include -#include "common.h" -#ifdef FUNCTION_PROFILE -#include "functable.h" -#endif - -#ifdef XDOUBLE -#define ERROR_NAME "XLAUUM" -#elif defined(DOUBLE) -#define ERROR_NAME "ZLAUUM" -#else -#define ERROR_NAME "CLAUUM" -#endif - -static blasint (*lauum_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { - LAUUM_U_SINGLE, LAUUM_L_SINGLE, -}; - -#ifdef SMP -static blasint (*lauum_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = { - LAUUM_U_PARALLEL, LAUUM_L_PARALLEL, -}; -#endif - -int NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){ - - blas_arg_t args; - - blasint uplo_arg = *UPLO; - blasint uplo; - blasint info; - FLOAT *buffer; -#ifdef PPC440 - extern -#endif - FLOAT *sa, *sb; - - PRINT_DEBUG_NAME; - - args.n = *N; - args.a = (void *)a; - args.lda = *ldA; - - TOUPPER(uplo_arg); - - uplo = -1; - if (uplo_arg == 'U') uplo = 0; - if (uplo_arg == 'L') uplo = 1; - - info = 0; - if (args.lda < MAX(1,args.n)) info = 4; - if (args.n < 0) info = 2; - if (uplo < 0) info = 1; - if (info) { - BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME)); - *Info = - info; - return 0; - } - - *Info = 0; - - if (args.n == 0) return 0; - - IDEBUG_START; - - FUNCTION_PROFILE_START(); - -#ifndef PPC440 - buffer = (FLOAT *)blas_memory_alloc(1); - - sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A); - sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B); -#endif - -#ifdef SMP - args.common = NULL; - args.nthreads = num_cpu_avail(4); - - if (args.nthreads == 1) { -#endif - - *Info = (lauum_single[uplo])(&args, NULL, NULL, sa, sb, 0); - -#ifdef SMP - } else { - - *Info = (lauum_parallel[uplo])(&args, NULL, NULL, sa, sb, 0); - - } -#endif - -#ifndef PPC440 - blas_memory_free(buffer); -#endif - - FUNCTION_PROFILE_END(1, .5 * args.n * args.n, - 2. * args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.)) - + args.n * (args.n * args.n - 1)); - - IDEBUG_END; - - return 0; -} diff --git a/lapack-netlib/SRC/Makefile b/lapack-netlib/SRC/Makefile index 40bb5625c..bacb13928 100644 --- a/lapack-netlib/SRC/Makefile +++ b/lapack-netlib/SRC/Makefile @@ -118,7 +118,7 @@ SLASRC = \ slaqtr.o slar1v.o slar2v.o ilaslr.o ilaslc.o \ slarf.o slarfb.o slarfg.o slarfgp.o slarft.o slarfx.o slargv.o \ slarrv.o slartv.o \ - slarz.o slarzb.o slarzt.o slaswp.o slasy2.o slasyf.o slasyf_rook.o \ + slarz.o slarzb.o slarzt.o slasy2.o slasyf.o slasyf_rook.o \ slatbs.o slatdf.o slatps.o slatrd.o slatrs.o slatrz.o slatzm.o \ slauu2.o slauum.o sopgtr.o sopmtr.o sorg2l.o sorg2r.o \ sorgbr.o sorghr.o sorgl2.o sorglq.o sorgql.o sorgqr.o sorgr2.o \ @@ -207,7 +207,7 @@ CLASRC = \ clarf.o clarfb.o clarfg.o clarft.o clarfgp.o \ clarfx.o clargv.o clarnv.o clarrv.o clartg.o clartv.o \ clarz.o clarzb.o clarzt.o clascl.o claset.o clasr.o classq.o \ - claswp.o clasyf.o clasyf_rook.o clatbs.o clatdf.o clatps.o clatrd.o clatrs.o clatrz.o \ + clasyf.o clasyf_rook.o clatbs.o clatdf.o clatps.o clatrd.o clatrs.o clatrz.o \ clatzm.o clauu2.o clauum.o cpbcon.o cpbequ.o cpbrfs.o cpbstf.o cpbsv.o \ cpbsvx.o cpbtf2.o cpbtrf.o cpbtrs.o cpocon.o cpoequ.o cporfs.o \ cposv.o cposvx.o cpotri.o cpstrf.o cpstf2.o \ @@ -278,7 +278,7 @@ DLASRC = \ dlaqtr.o dlar1v.o dlar2v.o iladlr.o iladlc.o \ dlarf.o dlarfb.o dlarfg.o dlarfgp.o dlarft.o dlarfx.o \ dlargv.o dlarrv.o dlartv.o \ - dlarz.o dlarzb.o dlarzt.o dlaswp.o dlasy2.o dlasyf.o dlasyf_rook.o \ + dlarz.o dlarzb.o dlarzt.o dlasy2.o dlasyf.o dlasyf_rook.o \ dlatbs.o dlatdf.o dlatps.o dlatrd.o dlatrs.o dlatrz.o dlatzm.o dlauu2.o \ dlauum.o dopgtr.o dopmtr.o dorg2l.o dorg2r.o \ dorgbr.o dorghr.o dorgl2.o dorglq.o dorgql.o dorgqr.o dorgr2.o \ @@ -368,7 +368,7 @@ ZLASRC = \ zlarfg.o zlarft.o zlarfgp.o \ zlarfx.o zlargv.o zlarnv.o zlarrv.o zlartg.o zlartv.o \ zlarz.o zlarzb.o zlarzt.o zlascl.o zlaset.o zlasr.o \ - zlassq.o zlaswp.o zlasyf.o zlasyf_rook.o \ + zlassq.o zlasyf.o zlasyf_rook.o \ zlatbs.o zlatdf.o zlatps.o zlatrd.o zlatrs.o zlatrz.o zlatzm.o zlauu2.o \ zlauum.o zpbcon.o zpbequ.o zpbrfs.o zpbstf.o zpbsv.o \ zpbsvx.o zpbtf2.o zpbtrf.o zpbtrs.o zpocon.o zpoequ.o zporfs.o \ From abad6f66d608d0fefab7db7f81cdb9dc6091a979 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Mon, 19 May 2014 13:50:02 +0200 Subject: [PATCH 68/70] marked trti2.c and ztrti2.c as bad --- interface/{trti2.c => lapack/trti2.c.bad} | 0 interface/{ztrti2.c => lapack/ztrti2.c.bad} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename interface/{trti2.c => lapack/trti2.c.bad} (100%) rename interface/{ztrti2.c => lapack/ztrti2.c.bad} (100%) diff --git a/interface/trti2.c b/interface/lapack/trti2.c.bad similarity index 100% rename from interface/trti2.c rename to interface/lapack/trti2.c.bad diff --git a/interface/ztrti2.c b/interface/lapack/ztrti2.c.bad similarity index 100% rename from interface/ztrti2.c rename to interface/lapack/ztrti2.c.bad From 0d75f3b6a21ac3e5e2cb52f36308c3093bce7a04 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Mon, 19 May 2014 14:44:53 +0200 Subject: [PATCH 69/70] enabled and tested optimized gesv lapack functions --- interface/Makefile | 16 ++++++++-------- lapack-netlib/SRC/Makefile | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/interface/Makefile b/interface/Makefile index 8b87127ef..16d59a6e6 100644 --- a/interface/Makefile +++ b/interface/Makefile @@ -349,7 +349,7 @@ XBLASOBJS = $(XBLAS1OBJS) $(XBLAS2OBJS) $(XBLAS3OBJS) SLAPACKOBJS = \ sgetrf.$(SUFFIX) sgetrs.$(SUFFIX) spotrf.$(SUFFIX) sgetf2.$(SUFFIX) \ - spotf2.$(SUFFIX) slaswp.$(SUFFIX) + spotf2.$(SUFFIX) slaswp.$(SUFFIX) sgesv.$(SUFFIX) #DLAPACKOBJS = \ @@ -359,7 +359,7 @@ SLAPACKOBJS = \ DLAPACKOBJS = \ dgetrf.$(SUFFIX) dgetrs.$(SUFFIX) dpotrf.$(SUFFIX) dgetf2.$(SUFFIX) \ - dpotf2.$(SUFFIX) dlaswp.$(SUFFIX) + dpotf2.$(SUFFIX) dlaswp.$(SUFFIX) dgesv.$(SUFFIX) QLAPACKOBJS = \ @@ -374,7 +374,7 @@ QLAPACKOBJS = \ CLAPACKOBJS = \ cgetrf.$(SUFFIX) cgetrs.$(SUFFIX) cpotrf.$(SUFFIX) cgetf2.$(SUFFIX) \ - cpotf2.$(SUFFIX) claswp.$(SUFFIX) + cpotf2.$(SUFFIX) claswp.$(SUFFIX) cgesv.$(SUFFIX) #ZLAPACKOBJS = \ @@ -384,7 +384,7 @@ CLAPACKOBJS = \ ZLAPACKOBJS = \ zgetrf.$(SUFFIX) zgetrs.$(SUFFIX) zpotrf.$(SUFFIX) zgetf2.$(SUFFIX) \ - zpotf2.$(SUFFIX) zlaswp.$(SUFFIX) + zpotf2.$(SUFFIX) zlaswp.$(SUFFIX) zgesv.$(SUFFIX) @@ -1932,19 +1932,19 @@ zgetrs.$(SUFFIX) zgetrs.$(PSUFFIX) : lapack/zgetrs.c xgetrs.$(SUFFIX) xgetrs.$(PSUFFIX) : zgetrs.c $(CC) -c $(CFLAGS) $< -o $(@F) -sgesv.$(SUFFIX) sgesv.$(PSUFFIX) : gesv.c +sgesv.$(SUFFIX) sgesv.$(PSUFFIX) : lapack/gesv.c $(CC) -c $(CFLAGS) $< -o $(@F) -dgesv.$(SUFFIX) dgesv.$(PSUFFIX) : gesv.c +dgesv.$(SUFFIX) dgesv.$(PSUFFIX) : lapack/gesv.c $(CC) -c $(CFLAGS) $< -o $(@F) qgesv.$(SUFFIX) qgesv.$(PSUFFIX) : gesv.c $(CC) -c $(CFLAGS) $< -o $(@F) -cgesv.$(SUFFIX) cgesv.$(PSUFFIX) : gesv.c +cgesv.$(SUFFIX) cgesv.$(PSUFFIX) : lapack/gesv.c $(CC) -c $(CFLAGS) $< -o $(@F) -zgesv.$(SUFFIX) zgesv.$(PSUFFIX) : gesv.c +zgesv.$(SUFFIX) zgesv.$(PSUFFIX) : lapack/gesv.c $(CC) -c $(CFLAGS) $< -o $(@F) xgesv.$(SUFFIX) xgesv.$(PSUFFIX) : gesv.c diff --git a/lapack-netlib/SRC/Makefile b/lapack-netlib/SRC/Makefile index bacb13928..d8cef80ba 100644 --- a/lapack-netlib/SRC/Makefile +++ b/lapack-netlib/SRC/Makefile @@ -101,7 +101,7 @@ SLASRC = \ sgegs.o sgegv.o sgehd2.o sgehrd.o sgelq2.o sgelqf.o \ sgels.o sgelsd.o sgelss.o sgelsx.o sgelsy.o sgeql2.o sgeqlf.o \ sgeqp3.o sgeqpf.o sgeqr2.o sgeqr2p.o sgeqrf.o sgeqrfp.o sgerfs.o \ - sgerq2.o sgerqf.o sgesc2.o sgesdd.o sgesv.o sgesvd.o sgesvx.o \ + sgerq2.o sgerqf.o sgesc2.o sgesdd.o sgesvd.o sgesvx.o \ sgetc2.o sgetri.o \ sggbak.o sggbal.o sgges.o sggesx.o sggev.o sggevx.o \ sggglm.o sgghrd.o sgglse.o sggqrf.o \ @@ -176,7 +176,7 @@ CLASRC = \ cgegs.o cgegv.o cgehd2.o cgehrd.o cgelq2.o cgelqf.o \ cgels.o cgelsd.o cgelss.o cgelsx.o cgelsy.o cgeql2.o cgeqlf.o cgeqp3.o \ cgeqpf.o cgeqr2.o cgeqr2p.o cgeqrf.o cgeqrfp.o cgerfs.o \ - cgerq2.o cgerqf.o cgesc2.o cgesdd.o cgesv.o cgesvd.o \ + cgerq2.o cgerqf.o cgesc2.o cgesdd.o cgesvd.o \ cgesvx.o cgetc2.o cgetri.o \ cggbak.o cggbal.o cgges.o cggesx.o cggev.o cggevx.o cggglm.o \ cgghrd.o cgglse.o cggqrf.o cggrqf.o \ @@ -261,7 +261,7 @@ DLASRC = \ dgegs.o dgegv.o dgehd2.o dgehrd.o dgelq2.o dgelqf.o \ dgels.o dgelsd.o dgelss.o dgelsx.o dgelsy.o dgeql2.o dgeqlf.o \ dgeqp3.o dgeqpf.o dgeqr2.o dgeqr2p.o dgeqrf.o dgeqrfp.o dgerfs.o \ - dgerq2.o dgerqf.o dgesc2.o dgesdd.o dgesv.o dgesvd.o dgesvx.o \ + dgerq2.o dgerqf.o dgesc2.o dgesdd.o dgesvd.o dgesvx.o \ dgetc2.o dgetri.o \ dggbak.o dggbal.o dgges.o dggesx.o dggev.o dggevx.o \ dggglm.o dgghrd.o dgglse.o dggqrf.o \ @@ -335,7 +335,7 @@ ZLASRC = \ zgegs.o zgegv.o zgehd2.o zgehrd.o zgelq2.o zgelqf.o \ zgels.o zgelsd.o zgelss.o zgelsx.o zgelsy.o zgeql2.o zgeqlf.o zgeqp3.o \ zgeqpf.o zgeqr2.o zgeqr2p.o zgeqrf.o zgeqrfp.o zgerfs.o zgerq2.o zgerqf.o \ - zgesc2.o zgesdd.o zgesv.o zgesvd.o zgesvx.o zgetc2.o \ + zgesc2.o zgesdd.o zgesvd.o zgesvx.o zgetc2.o \ zgetri.o \ zggbak.o zggbal.o zgges.o zggesx.o zggev.o zggevx.o zggglm.o \ zgghrd.o zgglse.o zggqrf.o zggrqf.o \ From a0ae53966f7c0214c572d7f329022abc58b7141c Mon Sep 17 00:00:00 2001 From: wernsaar Date: Mon, 19 May 2014 15:57:18 +0200 Subject: [PATCH 70/70] removed debug flag from Makefile.rule --- Makefile.rule | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.rule b/Makefile.rule index 9c2847a5c..6b604b781 100644 --- a/Makefile.rule +++ b/Makefile.rule @@ -127,7 +127,7 @@ NO_AFFINITY = 1 # Common Optimization Flag; # The default -O2 is enough. -COMMON_OPT = -O0 +# COMMON_OPT = -O2 # gfortran option for LAPACK FCOMMON_OPT = -frecursive @@ -136,7 +136,7 @@ FCOMMON_OPT = -frecursive COMMON_PROF = -pg # Build Debug version -DEBUG = 1 +# DEBUG = 1 # # End of user configuration