I originally tried using dynamically allocated arrays (commented out lines), but ran into some trouble getting the code to work which was solved by using statically allocated buffers and simple pointers to those buffers.
This solved the problem getting the code to work, but assumes a specific matrix size.
Either, we need to solve the dynamically allocated arrays, or we can use some slight metaprogramming to solve this problem. SInce we compile just before using, we know the size of this array at compile time (in fact, we know the size of all of our arrays at compile time. This allows us to use the stack rather than the heap for some of our arrays. Stack allocated memory can be easier to use, as it is allocated and freed implicitly.
Ways we could go about this: python format strings using format to replace certain fields with the numbers we want. This could actually help (probably not noticeably) the transfer costs, as many of the things we need could be transferred in the instructions themselves rather than as parameters.
Otherwise we could use a C preprocessor macro to #define VEC_SIZE 9 and then use VEC_SIZE * VEC_SIZE where the square is needed. This is, in my opinion slightly more elegant, though may take the compiler (a probably trival amount of ) time. This way, a single line can be added to the source code handed to the compiler, and not have to worry about the rest
Have you tried single precision complex arrays? Also, did you build your own numpy library from source? Things may have changed greatly since this was last commented.
https://github.com/wright-group/WrightSim/blob/8c23c2431a80f1eb87be6613c69a9db399354be8/WrightSim/mixed/propagate.py#L177-L185
I originally tried using dynamically allocated arrays (commented out lines), but ran into some trouble getting the code to work which was solved by using statically allocated buffers and simple pointers to those buffers. This solved the problem getting the code to work, but assumes a specific matrix size.
Either, we need to solve the dynamically allocated arrays, or we can use some slight metaprogramming to solve this problem. SInce we compile just before using, we know the size of this array at compile time (in fact, we know the size of all of our arrays at compile time. This allows us to use the stack rather than the heap for some of our arrays. Stack allocated memory can be easier to use, as it is allocated and freed implicitly.
Ways we could go about this: python format strings using format to replace certain fields with the numbers we want. This could actually help (probably not noticeably) the transfer costs, as many of the things we need could be transferred in the instructions themselves rather than as parameters.
Otherwise we could use a C preprocessor macro to
#define VEC_SIZE 9
and then useVEC_SIZE * VEC_SIZE
where the square is needed. This is, in my opinion slightly more elegant, though may take the compiler (a probably trival amount of ) time. This way, a single line can be added to the source code handed to the compiler, and not have to worry about the rest