You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@systemds.apache.org by GitBox <gi...@apache.org> on 2022/07/31 22:23:45 UTC

[GitHub] [systemds] kev-inn opened a new pull request, #1643: [SYSTEMDS-3393] Implement SIMD usage for basic dense dense MM

kev-inn opened a new pull request, #1643:
URL: https://github.com/apache/systemds/pull/1643

   # `DoubleVector` replacement for matrix multiply
   JDK 17 adds `Vector` classes to use SIMD instructions. This PR replaces the basic dense dense matrix multiply with an equivalent `DoubleVector` implementation. It is necessary to use JDK 17, therefore we should not merge this yet, but keep it in staging for future reference.
   
   As an experiment we check a simple matrix multiply:
   `Z = X %*% Y`, $X\in \mathbb{R}^{n\times k}, Y\in \mathbb{R}^{k\times m}$
   
   The experiment script performs 10 matrix multiplications and saves the time of the last 5 to give the JVM some time to optimize.
   
   ## Vary rows n, m fixed at 1000
   
   ### Alpha Node
   | $k = 1000$ | $k = 10000$ |
   | --------------- | --------------- |
   | ![plot_alpha_n_1000](https://user-images.githubusercontent.com/41760497/174668244-dec90cb2-4ded-4e8a-9b9a-16408c818809.svg) | ![plot_alpha_n_10000](https://user-images.githubusercontent.com/41760497/174668238-c9f6b988-6b55-4c1f-845c-399ad6bf1ed0.svg) |
   
   
   ### Lima Node
   | $k = 1000$ | $k = 10000$ |
   | --------------- | --------------- |
   | ![plot_lima_n_1000](https://user-images.githubusercontent.com/41760497/174668254-4fb11b22-b6b3-45c4-883c-572f469ec9b9.svg) | ![plot_lima_n_10000](https://user-images.githubusercontent.com/41760497/174668248-2a6d2b1c-d4b7-4296-9fed-ed3fed8d84d1.svg) |
   
   ## Vary cols m, n fixed at 1000
   
   ### Alpha Node
   | $k = 1000$ | $k = 10000$ |
   | --------------- | --------------- |
   | ![plot_alpha_m_1000](https://user-images.githubusercontent.com/41760497/174668241-3a829378-525b-464e-bf4e-9d1eff373125.svg) | ![plot_alpha_m_10000](https://user-images.githubusercontent.com/41760497/174668233-7c5120a1-b243-4fa6-bf3a-2e0c05d75308.svg) |
   
   ### Lima Node
   | $k = 1000$ | $k = 10000$ |
   | --------------- | --------------- |
   | ![plot_lima_m_1000](https://user-images.githubusercontent.com/41760497/174668252-8fefdd71-dd72-4d24-a851-eea6f660b88d.svg) | ![plot_lima_m_10000](https://user-images.githubusercontent.com/41760497/174668246-0824fbae-900f-49a9-9010-0edb8ffbc7fd.svg) |
   
   ## Conclusion
   The implementation seems to boost the performance in most cases. The case where we vary the number of columns n on the alpha node needs some more exploration, but it seems we are never worse than the current implementation.
   
   ## Experiment Script
   
   ```R
   X = read($Xfname);
   Y = read($Yfname);
   
   lim = 10;
   R = matrix(0, rows=lim, cols=1);
   for (i in 1:lim) {
     t1 = time();
     Z = X %*% Y;
     t2 = time();
     R[i,1] = (t2-t1)/1000000;
   }
   
   print(sum(Z));
   res = R[5:lim,];
   write(res, $fname, format="csv", sep="\t");
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@systemds.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [systemds] kev-inn commented on pull request #1643: [SYSTEMDS-3393] Implement SIMD usage for basic dense dense MM

Posted by GitBox <gi...@apache.org>.
kev-inn commented on PR #1643:
URL: https://github.com/apache/systemds/pull/1643#issuecomment-1161407309

   > What if you use some of the other experimental JVM that should have better support ?
   
   Which ones do you have in mind, and what kind of support do you expect (which the current does not support)? To clarify, do you expect better performance or that we can remove the `--add-modules=jdk.incubator.vector` flag?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@systemds.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [systemds] Baunsgaard commented on pull request #1643: Implement SIMD usage for basic dense dense MM

Posted by GitBox <gi...@apache.org>.
Baunsgaard commented on PR #1643:
URL: https://github.com/apache/systemds/pull/1643#issuecomment-1160904752

   What if you use some of the other experimental JVM that should have better support ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@systemds.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [systemds] Baunsgaard closed pull request #1643: [SYSTEMDS-3393] Implement SIMD usage for basic dense dense MM

Posted by GitBox <gi...@apache.org>.
Baunsgaard closed pull request #1643: [SYSTEMDS-3393] Implement SIMD usage for basic dense dense MM
URL: https://github.com/apache/systemds/pull/1643


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@systemds.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [systemds] phaniarnab commented on pull request #1643: Implement SIMD usage for basic dense dense MM

Posted by GitBox <gi...@apache.org>.
phaniarnab commented on PR #1643:
URL: https://github.com/apache/systemds/pull/1643#issuecomment-1160834039

   This looks pretty good. I think Alpha has wider SIMD registers, which explains why most configurations perform better in Alpha.
   Is there any JVM flag that you needed to enable? If so, can you please mention those as well for documentation purposes? @kev-inn 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@systemds.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [systemds] kev-inn commented on pull request #1643: [SYSTEMDS-3393] Implement SIMD usage for basic dense dense MM

Posted by GitBox <gi...@apache.org>.
kev-inn commented on PR #1643:
URL: https://github.com/apache/systemds/pull/1643#issuecomment-1200495480

   Closed by 9bf0a9fd9a64264301b0fc9310d6d9f976780870 (messed up the commit message)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@systemds.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [systemds] kev-inn commented on pull request #1643: [SYSTEMDS-3393] Implement SIMD usage for basic dense dense MM

Posted by GitBox <gi...@apache.org>.
kev-inn commented on PR #1643:
URL: https://github.com/apache/systemds/pull/1643#issuecomment-1200493306

   # More experiments
   Dump of more experiments and updated plots.
   
   All in all the results look promising, but we can also clearly some of the weak spots.
   
   ## Alpha
   ### Variable columns
   ![Alpha_1_1000_variable](https://user-images.githubusercontent.com/41760497/182043533-79eed741-00be-41ee-8d88-13161d581937.png)
   ![Alpha_10_1000_variable](https://user-images.githubusercontent.com/41760497/182043557-4dadde00-fb3a-4459-a067-792b73ac996b.png)
   ![Alpha_1000_1_variable](https://user-images.githubusercontent.com/41760497/182043558-3c376386-c5e7-4909-9130-5e437e7c4ef4.png)
   ![Alpha_1000_10_variable](https://user-images.githubusercontent.com/41760497/182043559-97feb4dd-827f-4eed-9b71-77278520a5e1.png)
   ![Alpha_1000_1000_variable](https://user-images.githubusercontent.com/41760497/182043562-335b34d7-2772-4037-abe7-7aafa0746b53.png)
   ![Alpha_1000_10000_variable](https://user-images.githubusercontent.com/41760497/182043574-d6af273e-d412-4d46-af14-787560ad4d15.png)
   ### Variable rows
   ![Alpha_variable_1_1000](https://user-images.githubusercontent.com/41760497/182043616-bb621d8b-521f-48c5-9df7-4ac8e0c4ca92.png)
   ![Alpha_variable_10_1000](https://user-images.githubusercontent.com/41760497/182043617-270e5e69-c1ef-4961-bfaa-1cc406a082d9.png)
   ![Alpha_variable_1000_1](https://user-images.githubusercontent.com/41760497/182043620-bb46533d-ac81-44ed-8e8d-eda69d443aef.png)
   ![Alpha_variable_1000_10](https://user-images.githubusercontent.com/41760497/182043637-bd3954f1-194a-4fe0-8c28-e5ed734a77a8.png)
   ![Alpha_variable_1000_1000](https://user-images.githubusercontent.com/41760497/182043639-0da4d6f5-4cc6-4a7e-9cf6-6a4f76a3dd65.png)
   ![Alpha_variable_10000_1000](https://user-images.githubusercontent.com/41760497/182043641-a3e074d6-25f6-403c-9d55-981dbb011629.png)
   
   ## Lima
   ### Variable columns
   ![Lima_1_1000_variable](https://user-images.githubusercontent.com/41760497/182043661-0b1d1585-c3c8-420f-8512-698fbc494a8b.png)
   ![Lima_10_1000_variable](https://user-images.githubusercontent.com/41760497/182043665-a01d0a4c-7168-499f-9d80-ced7bbecfa6c.png)
   ![Lima_1000_1_variable](https://user-images.githubusercontent.com/41760497/182043674-32a5356c-b42b-433a-a901-118132306acf.png)
   ![Lima_1000_10_variable](https://user-images.githubusercontent.com/41760497/182043682-b03148b5-20e6-43f7-b9ff-6ebc7e9982ae.png)
   ![Lima_1000_1000_variable](https://user-images.githubusercontent.com/41760497/182043688-8c74481d-cda2-4cc6-8e36-d1680d0a3860.png)
   ![Lima_1000_10000_variable](https://user-images.githubusercontent.com/41760497/182043690-ae84581c-8cad-426f-b245-5cb95c40f349.png)
   
   ### Variable rows
   ![Lima_variable_1_1000](https://user-images.githubusercontent.com/41760497/182043700-031857da-90b1-404b-b22f-ad9740764857.png)
   ![Lima_variable_10_1000](https://user-images.githubusercontent.com/41760497/182043703-b2da91e9-754c-4f56-b84c-f7c3d0171992.png)
   ![Lima_variable_1000_1](https://user-images.githubusercontent.com/41760497/182043704-81dfe3ca-3135-4612-8f27-5fe6d38c2891.png)
   ![Lima_variable_1000_10](https://user-images.githubusercontent.com/41760497/182043710-5e1db105-dbe5-468e-a3ac-9dc3757c02cd.png)
   ![Lima_variable_1000_1000](https://user-images.githubusercontent.com/41760497/182043713-6dc0a433-bc53-4bf8-beab-425ba381eb79.png)
   ![Lima_variable_10000_1000](https://user-images.githubusercontent.com/41760497/182043717-20f6f39b-b214-4ca5-a80a-c1d06d8d58cb.png)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@systemds.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [systemds] Baunsgaard commented on pull request #1643: [SYSTEMDS-3393] Implement SIMD usage for basic dense dense MM

Posted by GitBox <gi...@apache.org>.
Baunsgaard commented on PR #1643:
URL: https://github.com/apache/systemds/pull/1643#issuecomment-1164475133

   > > What if you use some of the other experimental JVM that should have better support ?
   > 
   > Which ones do you have in mind, and what kind of support do you expect (which the current does not support)? To clarify, do you expect better performance or that we can remove the `--add-modules=jdk.incubator.vector` flag?
   
   Project Panama: https://openjdk.java.net/projects/panama/
   And JDK 19 have the official full support for vectorizing; https://openjdk.org/jeps/426
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@systemds.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [systemds] kev-inn closed pull request #1643: [SYSTEMDS-3393] Implement SIMD usage for basic dense dense MM

Posted by GitBox <gi...@apache.org>.
kev-inn closed pull request #1643: [SYSTEMDS-3393] Implement SIMD usage for basic dense dense MM
URL: https://github.com/apache/systemds/pull/1643


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@systemds.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [systemds] kev-inn commented on pull request #1643: [SYSTEMDS-3393] Implement SIMD usage for basic dense dense MM

Posted by GitBox <gi...@apache.org>.
kev-inn commented on PR #1643:
URL: https://github.com/apache/systemds/pull/1643#issuecomment-1172137748

   I ran the experiments again with jdk-19 (early access).
   It seems to still require the same additional flags and still is part of the incubator module. This might be due to the early access version.
   Results are similar, with the addition of sometimes one single iteration, of our sample, taking ~3-4x the time. Probably due to GC. This already existed before though and was introduced in my last commit. Or maybe I just got lucky in my first run, before the second commit. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@systemds.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [systemds] kev-inn commented on pull request #1643: Implement SIMD usage for basic dense dense MM

Posted by GitBox <gi...@apache.org>.
kev-inn commented on PR #1643:
URL: https://github.com/apache/systemds/pull/1643#issuecomment-1160853048

   > This looks pretty good. I think Alpha has wider SIMD registers, which explains why most configurations perform better in Alpha. Is there any JVM flag that you needed to enable? If so, can you please mention those as well for documentation purposes? @kev-inn
   
   Note the varying columns case for Alpha though, Lima is faster with `DoubleVector` than Alpha. I will take a closer look why that might be. 
   
   Yes, the flag is `--add-modules=jdk.incubator.vector`, which has to be added when running systemds (see the `systemds` script). 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@systemds.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org