Parallelizing spatial matrix operations

Chris Rolfe's icon

I'm working on parallelizing a jitter mop algorithm that needs to know the row (y-axis).

From MaxAPI-5.1.1: "[i]f your object performs some kind of spatial operation... you will ... need to account for the matrix segmentation used by the parallel utilities"

I thought to store the base pointer in my object and then do something like the following in calculate_ndim:

    int start_row = (bop - x->bop) / minfo->dimstride[1];

My question is: is pointer arithmetic a kosher approach? Can I rely on the memory being contiguous, etc.

Cheers,
Chris

Chris Rolfe's icon

Bump.

Maybe the question was unclear?

Joshua Kit Clayton's icon

Yes, that is actually a clever way to accomplish this.

It's not documented in the SDK, but we pass on the stack the t_jit_parallel_ndim_worker struct after all the traditional arguments to your calculate_ndim function. You can grab the row from t_jit_parallel_ndim_worker.offset[1].

Let us know if you have issues.

-Joshua