News for hackers. Stuff that matters.
Re:Outperforming LAPACK with C++ metaprogramming by contravariant on Monday January 29, 2018 @09:41AM (#16257728)
What made you choose a python script rather than C++ templates or the C preprocessor?
Re:Outperforming LAPACK with C++ metaprogramming by dpwm on Monday January 29, 2018 @10:34AM (#16258035)
It was a hack. I knew the C compiler could do these optimizations at compile-time that would take me longer to implement at run-time and would probably introduce mistakes. I could well have used the C-processor, but the parameters needed to be taken from a file for each program.

The simulation was run about 100 times with different parameters. Instead of taking about an hour each they instead took about 12 minutes each, with the only difference being baking in all the parameters as constants and letting GCC do the rest.

Re:Outperforming LAPACK with C++ metaprogramming by mmlb on Monday January 29, 2018 @10:04AM (#16257835)
The way I read GP, the python script can very well do the equivalent of gcc -DPARAM=42 -o binary-param=42 && ./binary-param-42.

edit: oh nm, reread GP...

Re:Outperforming LAPACK with C++ metaprogramming by dpwm on Monday January 29, 2018 @10:41AM (#16258073)
Pretty much, except with more parameters taken from a file. The substituting in of parameters was done in Python just so that I could manually check the output for a few cases.

I think if I had to do something similar again today, any script would output a shell script that used command line macro definitions. That didn't really occur to me at the time.