Add linux port#12
Conversation
This commit adds a linux platform layer. The two necessary non-platform changes are: - Adding a sprintf-style platform function (Statusf) for the main code to call instead of wsprintf. - Changing `struct time` to `struct timestamp` because it conflicts with a type already defined on linux. The format specifier differences between wsprintf and the linux sprintf are handled by manually converting the format strings in the platform layer instead of changing any other existing code.
|
This is delightful - thank you very much! I am very busy at the moment so I may not be able to merge this in until the weekend (I'd like to go over it and make sure I understand all the changes). But this is great, and I'm very happy to have a Linux port. - Casey |
|
Dear @btolsch , great work on the Linux port. With just a few changes it also compiles and runs under MacOS. In In In the same file, replace the call to I tested with clang 9.0.0 under MacOS 10.14. |
|
Is there anything holding back this merge now? Or was it just forgotten to time? |
|
Nothing is holding it back other than me having time to test it. - Casey |
|
For the Linux version in this PR, I wrote a small fix that makes it compile on my machine using clang and extract the relevant information for avx512. I also did a comparison test between Windows and Linux on the same machine. CPU: AMD Ryzen 7 7800X3D 8-Core Processor The histograms show that the Linux version is outperforming the Win32 version. Time series shows that there are some spikes occurring periodically. Not sure what to make of that yet. Perhaps more people should do measurements. |


I hope you find this helpful; if not, feel free to close this.
First of all, I did compile this with both MSVC and clang on Windows. I also got roughly the same numbers on both Linux and Windows (though I didn't take any statistics, measure whether there was a difference in the gate operation, etc.). So that's something.
There were two changes I had to make to the main code to get this to work on Linux (the format strings are a separate issue). There was one direct usage of
wsprintfin blandwidth.c, so I added a platform functionStringfto do that. I also had to renamestruct timebecause it collides with the Linux definition.I wrote a conversion function to go from
wsprintfformat strings to Linuxsprintfstrings (just the 64-bit int issue). The other alternative I could see is using macros like so:That makes the format strings slightly harder to read though, so that wasn't really my first choice in this case.
There are also fixes for #11 and the clang
CTAssertTODO in here if you don't get to them first.Lastly, I didn't try to emulate your braces/spacing yet. I can take a shot at cleaning that up if you want to merge this.