News for hackers. Stuff that matters.
Re:Neanderthal vs. ND4J – Native Performance, Java and CPU by blueyes on Friday June 22, 2018 @04:59PM (#17377298)
TL/DR In Nd4j, historically, mmuli returns an F-ordered array. If you specify C-ordered result, you'll have F->C conversion underneath, and C -> F assign takes time.

ND4J returns the `mmuli` result in F order, and DL$J is aware of that. We design our algorithms around this. It is possible to get the `mmuli` result in C order, but it'll cause an additional conversion operation call, which is expensive. That's exactly what Dragan did. So on one hand - he's right: in the CCC case, Neanderthal is faster, because he doesn't have to do the F->C conversion of the result.

We make mmuli always return F because of Cuda. The cuBLAS implementation has no option for C ordered output.

`mmuli` CCC always introduces a dup for us. We expect the gemm result to always be F, so if result is not F, each operation allocates tempResult array, F ordered, and does result.assign(tempResult).

Re:Neanderthal vs. ND4J – Native Performance, Java and CPU by dragandj on Friday June 22, 2018 @05:11PM (#17377392)
Neanderthal handles C order in cuBLAS without problems, though.

Thanks for the explanation. I used the code that ND4J guys provided, assuming that they'd do the right thing. Also read my response to crockpotveggies: provide the ND4J code that you think is optimal, and ND4J and Neanderthal results on your machine, and I'll be happy to write a follow up.

Re:Neanderthal vs. ND4J – Native Performance, Java and CPU by blueyes on Friday June 22, 2018 @09:45PM (#17378968)
That's great, but that's not the essential point for us. with cuBLAS, there is no room for an output layout argument.

transpose is the only option.

cublasStatus_t cublasSgemm(cublasHandle_t handle, cublasOperation_t transa, cublasOperation_t transb, int m, int n, int k, const float alpha, const float A, int lda, const float B, int ldb, const float beta, float *C, int ldc)