From: Akshay S. <ak...@us...> - 2013-01-19 23:40:58
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "matlisp". The branch, tensor has been updated via c8fdfac6f7cd8e4dd91f49bf7794a579cb8a5ffc (commit) from fb2502032f279c0981185f2380ae3e4abf9d04a7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c8fdfac6f7cd8e4dd91f49bf7794a579cb8a5ffc Author: Akshay Srinivasan <aks...@gm...> Date: Sat Jan 19 15:35:34 2013 -0800 o Committing some changes on dlsode. Callback macro is sort-of broken. Callbacks apparently allocate some memory in a non-gc'ed portion heap. Runs out of memory after ~600 calls to dlsode. diff --git a/matlisp.asd b/matlisp.asd index cbb1979..287657f 100644 --- a/matlisp.asd +++ b/matlisp.asd @@ -151,7 +151,7 @@ :components ((:file "gemv"))) (:module "matlisp-level-3" :pathname "level-3" - :depends-on ("matlisp-base" "matlisp-classes" "foreign-core" "matlisp-level-1") + :depends-on ("matlisp-base" "matlisp-classes" "foreign-core" "matlisp-level-1" "matlisp-level-2") :components ((:file "gemm"))) #+nil(:module "matlisp-lapack" :pathname "lapack" diff --git a/packages.lisp b/packages.lisp index 01f0df8..6e70c2a 100644 --- a/packages.lisp +++ b/packages.lisp @@ -75,6 +75,7 @@ #:linear-array-type #:list-dimensions #:lvec-foldl #:lvec-foldr #:lvec-max #:lvec-min #:lvec-eq + #:lvec-map-foldl! #:lvec-map-foldr! #:lvec->list #:lvec->list! #:compile-and-eval ;;Macros diff --git a/src/level-3/gemm.lisp b/src/level-3/gemm.lisp index f0b9523..32a879a 100644 --- a/src/level-3/gemm.lisp +++ b/src/level-3/gemm.lisp @@ -60,12 +60,15 @@ (cstp-C (col-stride C) :type index-type) (hd-C (head C) :type index-type) (sto-C (store C) :type ,(linear-array-type (getf opt :store-type)))) - ;;Replace with separate loops to maximize Row-ordered MM performance + ;;Replace with separate loops to maximize Row-ordered MM performance (when (eq job-A :t) (rotatef rstp-A cstp-A)) (when (eq job-B :t) (rotatef rstp-B cstp-B)) ;; + (unless (,(getf opt :f=) beta (,(getf opt :fid*))) + (,(getf opt :num-scal) beta C)) + ;; (let-typed ((of-A hd-A :type index-type) (of-B hd-B :type index-type) (of-C hd-C :type index-type) diff --git a/src/packages/odepack/dlsode.lisp b/src/packages/odepack/dlsode.lisp index 7728cd9..323c76e 100644 --- a/src/packages/odepack/dlsode.lisp +++ b/src/packages/odepack/dlsode.lisp @@ -9,7 +9,8 @@ (cffi:use-foreign-library libodepack) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#+nil(def-fortran-routine testde :void +#+nil +(def-fortran-routine testde :void (field (:callback :void (c-neq :integer :input) (c-t :double-float :input) @@ -72,7 +73,7 @@ do (progn (setq tout (aref t-array i)) (multiple-value-bind (y-out ts-out istate-out rwork-out iwork-out) - (dlsode field neq y ts tout itol rtol atol itask istate iopt rwork lrw iwork liw (cffi:null-pointer) mf) + (dlsode field neq y ts tout itol rtol atol itask istate iopt rwork lrw iwork liw #'(lambda (&rest th) (declare (ignore th))) mf) (setq ts ts-out) (setq istate istate-out)) (funcall report ts y))))) diff --git a/src/utilities/lvec.lisp b/src/utilities/lvec.lisp index a46edf0..2891b36 100644 --- a/src/utilities/lvec.lisp +++ b/src/utilities/lvec.lisp @@ -14,6 +14,22 @@ :for ret = (aref vec (1- (length vec))) :then (funcall func (aref vec i) ret) :finally (return ret))) +(definline lvec-map-foldl! (func vec) + (declare (type vector)) + (loop + :for i :of-type fixnum :from 0 :below (length vec) + :for ret = (aref vec 0) :then (funcall func (aref vec i) ret) + :do (setf (aref vec i) ret) + :finally (return (values ret vec)))) + +(definline lvec-map-foldr! (func vec) + (declare (type vector)) + (loop + :for i :of-type fixnum :downfrom (1- (length vec)) :to 0 + :for ret = (aref vec (1- (length vec))) :then (funcall func (aref vec i) ret) + :do (setf (aref vec i) ret) + :finally (return (values ret vec)))) + (definline lvec-max (vec) (declare (type vector vec)) (loop :for ele :across vec diff --git a/tests/loopy-tests.lisp b/tests/loopy-tests.lisp index 29e4245..ece1513 100644 --- a/tests/loopy-tests.lisp +++ b/tests/loopy-tests.lisp @@ -152,31 +152,38 @@ (defun test-mm-lisp-lin (n) (declare (type fixnum n)) - (let*-typed ((A (make-real-tensor n n)) - (B (make-real-tensor n n)) - (C (make-real-tensor n n)) - (sto-A (store A) :type real-store-vector) - (sto-B (store B) :type real-store-vector) - (sto-C (store C) :type real-store-vector)) - (time - (let-typed ((of-A 0 :type index-type) - (of-B 0 :type index-type) - (of-C 0 :type index-type)) + (let ((A (make-real-tensor n n)) + (B (make-real-tensor n n)) + (C (make-real-tensor n n))) + (let*-typed ((sto-A (store A) :type real-store-vector) + (sto-B (store B) :type real-store-vector) + (sto-C (store C) :type real-store-vector)) (very-quickly - (loop :repeat n - :do (progn - (loop :repeat n - :do (let-typed ((ele-A (aref sto-A of-A) :type real-type)) - (loop :repeat n - :do (progn - (incf (aref sto-C of-C) (* ele-A (aref sto-B of-B))) - (incf of-C) - (incf of-B))) - (decf of-C n) - (incf of-A))) - (incf of-C n) - (setf of-B 0)))))) - t)) + (mod-dotimes (idx (dimensions A)) + with (linear-sums (of-A (strides A)) + (of-B (strides B))) + do (progn + (real-type.value-writer (random 1d0) sto-A of-A) + (real-type.value-writer (random 1d0) sto-B of-B)))) + (time + (let-typed ((of-A 0 :type index-type) + (of-B 0 :type index-type) + (of-C 0 :type index-type)) + (very-quickly + (loop :repeat n + :do (progn + (loop :repeat n + :do (let-typed ((ele-A (aref sto-A of-A) :type real-type)) + (loop :repeat n + :do (progn + (incf (aref sto-C of-C) (* ele-A (aref sto-B of-B))) + (incf of-C) + (incf of-B))) + (decf of-C n) + (incf of-A))) + (incf of-C n) + (setf of-B 0)))))) + t))) (defun test-mm-ddot (n) (let ((t-a (make-real-tensor n n)) ----------------------------------------------------------------------- Summary of changes: matlisp.asd | 2 +- packages.lisp | 1 + src/level-3/gemm.lisp | 5 +++- src/packages/odepack/dlsode.lisp | 5 ++- src/utilities/lvec.lisp | 16 +++++++++++ tests/loopy-tests.lisp | 55 +++++++++++++++++++++---------------- 6 files changed, 56 insertions(+), 28 deletions(-) hooks/post-receive -- matlisp |