changeset 12395:ae50074dd6ff octave-forge

activated and documented the autotuning and plot features available with librsb-1.1. the autotuning feature is still experimental.
author michelemartone
date Tue, 11 Mar 2014 08:08:15 +0000
parents ca40d374e7bb
children fa3fb3268caa
files main/sparsersb/doc/sparsersb.txt main/sparsersb/src/configure.base main/sparsersb/src/sparsersb.cc
diffstat 3 files changed, 44 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/main/sparsersb/doc/sparsersb.txt	Mon Mar 10 11:38:50 2014 +0000
+++ b/main/sparsersb/doc/sparsersb.txt	Tue Mar 11 08:08:15 2014 +0000
@@ -12,6 +12,10 @@
      the file turns out to contain a Matrix Market vector, this will be
      loaded as such.
 
+ -- Loadable Function: sparsersb (A,"save",MTXFILENAME)
+     Saves a sparse RSB matrix as a Matrix Market matrix file named
+     MTXFILENAME.
+
  -- Loadable Function: S = sparsersb (I, J, SV, M, N, NZMAX)
      Create a sparse RSB matrix given integer index vectors I and J, a
      1-by-`nnz' vector of real of complex values SV, overall dimensions
@@ -54,6 +58,18 @@
      If A is a sparsersb matrix and S is a string, S will be
      interpreted as a query string about matrix A.
 
+ -- Loadable Function: S = sparsersb (A,"render", FILENAME[, RWIDTH,
+          RHEIGHT])
+     If A is a sparsersb matrix and FILENAME is a string, A will be
+     rendered as an Encapsulated Postcript file FILENAME. Optionally,
+     width and height can be specified. Defaults are 512.
+
+ -- Loadable Function: S = sparsersb (A,"autotune"[, TRANSA, NRHS,
+          MAXR, TMAX, TN, SF])
+     If A is a sparsersb matrix, autotuning of the matrix will take
+     place, with SpMV and autotuning parameters. After "autotune", the
+     remaining parameters are optional.
+
      Please note that on `sparsersb' type variables are available most,
      but not all of the operators available for `full' or `sparse'
      typed variables.
--- a/main/sparsersb/src/configure.base	Mon Mar 10 11:38:50 2014 +0000
+++ b/main/sparsersb/src/configure.base	Tue Mar 11 08:08:15 2014 +0000
@@ -390,6 +390,8 @@
    headers:   $includedir
 
 octave-forge is configured with
+   CXX:         $CXX
+   CXXFLAGS:    $CXXFLAGS
    octave:      $OCTAVE (version $OCTAVE_VERSION)
    mkoctfile:	$MKOCTFILE for Octave $subver
    swig:        $SWIG"
--- a/main/sparsersb/src/sparsersb.cc	Mon Mar 10 11:38:50 2014 +0000
+++ b/main/sparsersb/src/sparsersb.cc	Tue Mar 11 08:08:15 2014 +0000
@@ -1,5 +1,5 @@
 /*
- Copyright (C) 2011-2013   Michele Martone   <michelemartone _AT_ users.sourceforge.net>
+ Copyright (C) 2011-2014   Michele Martone   <michelemartone _AT_ users.sourceforge.net>
 
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
@@ -17,6 +17,8 @@
 
 /*
  * TODO wishlist:
+ * adapt to when octave_idx_type is 64 bit long
+ * rsb_file_vec_save (1.1)
  * all *.m files shall go to inst/
  * switch to using bootstrap.sh (instead autogen.sh) and configure.ac with environment variables, so it can be called from pkg install sparsersb-1.0.0.tar.gz 
  * produce ../doc/sparsersb.txi; can use get_help_text
@@ -209,6 +211,15 @@
 #else
 #define RSBOI_BINOP_PREVAILING_TYPE(V1,V2) RSBOI_TYPECODE
 #endif
+#if defined(RSB_LIBRSB_VER) && (RSB_LIBRSB_VER>=10100)
+#define RSBOI_10100_DOC \
+"@deftypefnx {Loadable Function} {@var{s} =} "RSBOI_FNS" (@var{A},\"render\", @var{filename}[, @var{rWidth}, @var{rHeight}])\n"\
+"If @var{A} is a "RSBOI_FNS" matrix and @var{filename} is a string, @var{A} will be rendered as an Encapsulated Postcript file @var{filename}. Optionally, width and height can be specified. Defaults are 512.\n"\
+"@deftypefnx {Loadable Function} {@var{s} =} "RSBOI_FNS" (@var{A},\"autotune\"[, @var{transA}, @var{nrhs}, @var{maxr}, @var{tmax}, @var{tn}, @var{sf}])\n"\
+"If @var{A} is a "RSBOI_FNS" matrix, autotuning of the matrix will take place, with SpMV and autotuning parameters. After \"autotune\", the remaining parameters are optional.\n"
+#else
+#define RSBOI_10100_DOC	""
+#endif
 
 void rsboi_strerr(rsb_err_t errval)
 {
@@ -916,7 +927,7 @@
 			/* FIXME: and now ? */
 #endif
 			if(rcm.VA==NULL)
-				nnzA=0;
+				nnzA = 0;
 			else
 				errval = rsb_mtx_get_coo(this->mtxAp,rcm.VA,rcm.IA,rcm.JA,RSB_FLAG_C_INDICES_INTERFACE);
 			rcm.nrA=this->rows();
@@ -1801,6 +1812,7 @@
 \n"\
 /*If any of @var{sv}, @var{i} or @var{j} are scalars, they are expanded\n\ 
 to have a common size.\n*/
+RSBOI_10100_DOC""\
 "\n\
 Please note that on @code{"RSBOI_FNS"} type variables are available most, but not all of the operators available for @code{full} or @code{sparse} typed variables.\n\
 \n\
@@ -1866,7 +1878,7 @@
 		rsb_err_t errval=RSB_ERR_NO_ERROR;
 		/* these are user settable */
 		rsb_coo_idx_t nrhs=0;
-		rsb_int_t oitmax=1;
+		rsb_int_t maxr=1;
 		rsb_time_t tmax=2.0;
 		rsb_int_t tn=0;
 		rsb_real_t sf=1.0;
@@ -1883,14 +1895,15 @@
 
 		if (nargin > 2) transA = RSB_CHAR_AS_TRANSPOSITION(args(2).string_value()[0]);
 		if (nargin > 3) nrhs=args(3).scalar_value();
-		if (nargin > 4) oitmax=args(4).scalar_value();
+		if (nargin > 4) maxr=args(4).scalar_value();
 		if (nargin > 5) tmax=args(5).scalar_value();
 		if (nargin > 6) tn=args(6).scalar_value();
 		if (nargin > 7) sf=args(7).scalar_value();
 
+		// ...
 		if(!osmp || !osmp->mtxAp)
 			goto ret;/* FIXME: error handling missing here */
-		errval = rsb_tune_spmm(&osmp->mtxAp,&sf,&tn,oitmax,tmax,transA,alphap,osmp->mtxAp,nrhs,order,Bp,ldB,betap,Cp,ldC);
+		errval = rsb_tune_spmm(&osmp->mtxAp,&sf,&tn,maxr,tmax,transA,alphap,NULL/*osmp->mtxAp*/,nrhs,order,Bp,ldB,betap,Cp,ldC);
 		/* FIXME: serious error handling missing here */
 		goto ret;
 	}
@@ -1898,14 +1911,18 @@
 
 
 #if defined(RSB_LIBRSB_VER) && (RSB_LIBRSB_VER>=10100)
-	if (nargin == 3 && isr 
+	if (nargin >= 3 && isr 
  		&& args(1).is_string() && args(1).string_value().substr(0,6)=="render"
 		&& args(2).is_string())
 	{
-		rsb_err_t errval=RSB_ERR_NO_ERROR;
-		std::string rmf=args(2).string_value();
-		rsb_coo_idx_t pmWidth=512, pmHeight=512;
+		rsb_err_t errval = RSB_ERR_NO_ERROR;
+		std::string rmf = args(2).string_value();
+		rsb_coo_idx_t pmWidth = 512, pmHeight = 512;
 		rsb_flags_t marf = RSB_MARF_EPS;
+		/* may tell the user to supply a sparsersb matrix in case input is not 'sparse' */
+
+		if (nargin > 2) pmWidth = args(3).scalar_value();
+		if (nargin > 3) pmHeight = args(4).scalar_value();
 
 		if(!osmp || !osmp->mtxAp)
 			goto ret;/* FIXME: error handling missing here */