Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #59637

Re: matrix multiplication

From anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups comp.lang.forth
Subject Re: matrix multiplication
Date 2017-05-21 07:19 +0000
Organization Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID <2017May21.091909@mips.complang.tuwien.ac.at> (permalink)
References (1 earlier) <39defc56-99d0-42d7-8242-c16df26ca409@googlegroups.com> <2017May19.171325@mips.complang.tuwien.ac.at> <2017May19.192659@mips.complang.tuwien.ac.at> <2017May20.122135@mips.complang.tuwien.ac.at> <a7cd6738-5a15-4ac0-a042-8a80f1529d61@googlegroups.com>

Show all headers | View raw


krishna.myneni@ccreweb.org writes:
>A next step could be to do the computations in parallel on a multi-core system, following the example I posted earlier:
>
>ftp://ccreweb.org/software/kforth/examples/parallel-mm.4th
>
>Do gforth, vfxlin, and swift forth provide fork and mmap syscalls, or equivalents?

There is multi-threading support in these systems (for Gforth in the
development version) that you could use; then you also don't need to
share the memory with mmap.

However, my next step would be to implement cache blocking.  While the
slowdown from going beyond the cache is (to me) surprisingly low for
the FAXPY-based version, that is on a system that is otherwise idle
(interestingly both on my PC and on the Odroid C2).  If the system
makes more use of its multiple cores, and especially if you want to
have several instances of matrix multiply running on them,using less
main memory bandwidth by using cache blocking should help.

Another thing that I would (in general) do before using multiple cores
is vectorization.  Unfortunately, we don't have vector support in
Forth, not even in a system-specific way, yet (AFAIK).

And if I am really interested in multiplying a lot of matrices
quickly, I would use a library specialized for that, i.e., ATLAS, or
one provided by the CPU manufacturer.

> We should be able to realize a speedup of ~n times by distributing the computing over n cores. Matrix multiplication is an easy computation to parallelize.

But you realize this speedup only if your computation does not become
memory-bandwidth bound.

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2017: http://www.euroforth.org/ef17/

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

matrix multiplication krishna.myneni@ccreweb.org - 2017-05-17 15:13 -0700
  Re: matrix multiplication stephen@mpeforth.com (Stephen Pelc) - 2017-05-17 22:31 +0000
    Re: matrix multiplication krishna.myneni@ccreweb.org - 2017-05-17 15:39 -0700
      Re: matrix multiplication rickman <gnuarm@gmail.com> - 2017-05-18 03:22 -0400
        Re: matrix multiplication krishna.myneni@ccreweb.org - 2017-05-18 00:29 -0700
          Re: matrix multiplication rickman <gnuarm@gmail.com> - 2017-05-18 03:48 -0400
          Re: matrix multiplication anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-18 08:42 +0000
  Re: matrix multiplication krishna.myneni@ccreweb.org - 2017-05-18 00:25 -0700
    Re: matrix multiplication anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-19 15:13 +0000
      Re: matrix multiplication anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-19 17:26 +0000
        Re: matrix multiplication Alex <alex@rivadpm.com> - 2017-05-19 18:56 +0100
        Re: matrix multiplication Paul Rubin <no.email@nospam.invalid> - 2017-05-19 21:48 -0700
        Re: matrix multiplication anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-20 10:21 +0000
          Re: matrix multiplication krishna.myneni@ccreweb.org - 2017-05-20 06:12 -0700
          Re: matrix multiplication krishna.myneni@ccreweb.org - 2017-05-20 09:47 -0700
            Re: matrix multiplication Paul Rubin <no.email@nospam.invalid> - 2017-05-20 15:31 -0700
              Re: matrix multiplication krishna.myneni@ccreweb.org - 2017-05-21 04:46 -0700
                Re: matrix multiplication mhx@iae.nl - 2017-05-21 13:41 -0700
                Re: matrix multiplication krishna.myneni@ccreweb.org - 2017-05-21 15:32 -0700
            Re: matrix multiplication anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-21 07:19 +0000
              Re: matrix multiplication krishna.myneni@ccreweb.org - 2017-05-21 05:10 -0700
                Re: matrix multiplication anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-21 14:29 +0000
                Re: matrix multiplication krishna.myneni@ccreweb.org - 2017-05-21 09:17 -0700
      Re: matrix multiplication stephen@mpeforth.com (Stephen Pelc) - 2017-05-19 20:54 +0000
      Re: matrix multiplication krishna.myneni@ccreweb.org - 2017-05-19 14:33 -0700
        Re: matrix multiplication krishna.myneni@ccreweb.org - 2017-05-19 16:12 -0700
        Re: matrix multiplication anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-20 14:48 +0000
    Re: matrix multiplication krishna.myneni@ccreweb.org - 2017-05-19 18:38 -0700

csiph-web