SpRegTiling / sparse-register-tiling

9 stars 2 forks source link

Does `construct_method` need to run twice? #5

Closed reikdas closed 6 months ago

reikdas commented 7 months ago

There seems to be some code duplication here - https://github.com/SpRegTiling/sparse-register-tiling/blob/main/cpp_testbed/demo/SPMM_demo.cpp#L563-L568 and https://github.com/SpRegTiling/sparse-register-tiling/blob/main/cpp_testbed/demo/SPMM_demo.cpp#L588-L593. Does construct_method actually need to run twice?

LucasWilkinson commented 7 months ago

Hi @reikdas

for the first construct_method loop you shared:

https://github.com/SpRegTiling/sparse-register-tiling/blob/main/cpp_testbed/demo/SPMM_demo.cpp#L563-L568

we construct everything that is not "mkl", guarded by this if:

if (method.method_id != "mkl") {

this is because this can be executed in parallel by uncommenting //#pragma omp parallel for to speed-up testing, unfortnately MKL handles its own threading so doesn't like to be constructed in an OpenMP environment. So instead we have a second loop that is never run in parallel here:

https://github.com/SpRegTiling/sparse-register-tiling/blob/main/cpp_testbed/demo/SPMM_demo.cpp#L588-L593

that only constructs the mkl methods, guarded by:

if (method.method_id == "mkl") {

I hope this helps!

reikdas commented 6 months ago

Thanks!