Click here to Skip to main content
15,914,642 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Anatomy of High-Performance Matrix Multiplication Pin
Rick York1-Mar-18 4:38
mveRick York1-Mar-18 4:38 
GeneralRe: Anatomy of High-Performance Matrix Multiplication Pin
CodeWraith1-Mar-18 4:40
CodeWraith1-Mar-18 4:40 
GeneralRe: Anatomy of High-Performance Matrix Multiplication Pin
megaadam1-Mar-18 4:46
professionalmegaadam1-Mar-18 4:46 
GeneralRe: Anatomy of High-Performance Matrix Multiplication Pin
harold aptroot1-Mar-18 4:55
harold aptroot1-Mar-18 4:55 
GeneralRe: Anatomy of High-Performance Matrix Multiplication Pin
Marc Clifton1-Mar-18 5:02
mvaMarc Clifton1-Mar-18 5:02 
GeneralRe: Anatomy of High-Performance Matrix Multiplication Pin
Chris Maunder1-Mar-18 5:15
cofounderChris Maunder1-Mar-18 5:15 
GeneralRe: Anatomy of High-Performance Matrix Multiplication Pin
den2k881-Mar-18 5:08
professionalden2k881-Mar-18 5:08 
GeneralRe: Anatomy of High-Performance Matrix Multiplication Pin
Arthur V. Ratz1-Mar-18 5:30
professionalArthur V. Ratz1-Mar-18 5:30 
Hi, Chris.

I've read your post about through with a certain interest. Norm
ally, in my opinion neither C# nor JavaScript and even Node.JS are not considered to be the best platforms for high-performance computing, specifically matrix operations:

1.C# and .NET Framework have System.Threading and System.Threading.Tasks packages that implement such things as Parallel.For and Parallel.Foreach methods that use POSIX threads to perform parallel loop execution. Unfortunately, POSIX threads are mainly based on "stealing" threads scheduling mechanism, and, thus, the loop execution cannot be perfectly parallelized and either scaled across multiple CPU's cores.

2. JavaScript has a Worker object that allows to spawn particular fragments of code running in parallel. The same is also about Parallel.JS library as well. Unfortunately, the either Worker object or Parallel.JS have the number of issues that for many programming tasks obstacle from delivering a proper parallel code that might be perfectly scaled across all CPU's cores. For example, multithreading in JavaScript does not yet allow to provide and implement synchronization mechanism for the threads spawned during the code execution.

3. Node.js which is also known as server-side JavaScript has the number of issues such as numbers of memory leaks in node.exe executable, various bugs and errors related to 64-bit platform. Since the time when Node.js era began, there's still no such things as tight loop parallelization, synchronization of threads, etc.

What I've recommended:

To be more specific addressing the matrix multiplication task, I would recommend writing the code in C++ and use OpenMP performance library to deliver the modern code that will be executed in parallel and will be perfectly scaled across all cores of your CPU. Here's an example of parallel code in C++ using OpenMP library implementing matrix multiplication:

C++
#include <iostream>

int A[3][3] = { { 2, 9, 7 },
                { 1, 6, 4 },
                { 9, 1, 8 } };

int B[3][3] = { { 8, 1, 3 },
                { 6, 5, 2 },
                { 4, 7, 9 } };

int C[3][3] = { { 0 } };

using namespace std;

int i,j;

const int N = 3;

int main()
{
    #pragma omp parallel for private(i,j) shared(A,B,C) collapse(2)
    for (i = 0; i < N; i++)
         for (j = 0; j < N; j++)
         {
              for (int t = 0; t < N; t++)
                   C[i][j] += A[i][t] * B[t][j];
         }

    for (i = 0; i < N; i++)
    {
         for (j = 0; j < N; j++)
              std::cout << C[i][j] << " ";

         std::cout << "\n";
    }

    return 0;
}

Ref: cpp.sh/2lsa3
GeneralRe: Anatomy of High-Performance Matrix Multiplication Pin
RickZeeland1-Mar-18 5:38
mveRickZeeland1-Mar-18 5:38 
GeneralRe: Anatomy of High-Performance Matrix Multiplication Pin
CPallini1-Mar-18 6:04
mveCPallini1-Mar-18 6:04 
GeneralRe: Anatomy of High-Performance Matrix Multiplication Pin
PIEBALDconsult2-Mar-18 11:13
mvePIEBALDconsult2-Mar-18 11:13 
GeneralFavourite Operator Of The Day Pin
Chris Maunder1-Mar-18 4:20
cofounderChris Maunder1-Mar-18 4:20 
GeneralRe: Favourite Operator Of The Day Pin
Richard Deeming1-Mar-18 4:24
mveRichard Deeming1-Mar-18 4:24 
GeneralRe: Favourite Operator Of The Day Pin
Chris Maunder1-Mar-18 4:28
cofounderChris Maunder1-Mar-18 4:28 
GeneralRe: Favourite Operator Of The Day Pin
Richard Deeming1-Mar-18 4:33
mveRichard Deeming1-Mar-18 4:33 
GeneralRe: Favourite Operator Of The Day Pin
Chris Maunder1-Mar-18 5:16
cofounderChris Maunder1-Mar-18 5:16 
GeneralRe: Favourite Operator Of The Day Pin
W Balboos, GHB1-Mar-18 5:54
W Balboos, GHB1-Mar-18 5:54 
GeneralFound it! Pin
CodeWraith1-Mar-18 2:58
CodeWraith1-Mar-18 2:58 
PraiseRe: Found it! Pin
RickZeeland1-Mar-18 3:22
mveRickZeeland1-Mar-18 3:22 
GeneralRe: Found it! Pin
CodeWraith1-Mar-18 3:39
CodeWraith1-Mar-18 3:39 
JokeRe: Found it! Pin
RickZeeland1-Mar-18 3:55
mveRickZeeland1-Mar-18 3:55 
GeneralRe: Found it! Pin
PIEBALDconsult1-Mar-18 3:57
mvePIEBALDconsult1-Mar-18 3:57 
GeneralRe: Found it! Pin
RickZeeland1-Mar-18 4:04
mveRickZeeland1-Mar-18 4:04 
GeneralRe: Found it! Pin
CodeWraith1-Mar-18 5:00
CodeWraith1-Mar-18 5:00 
GeneralRe: Found it! Pin
RickZeeland1-Mar-18 5:27
mveRickZeeland1-Mar-18 5:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.