At the heart of the problem is that the Fourier transform is periodic causing edge artifacts, either because the FT sees a mirror image (if you mirror) or zeros (if you pad) . But I'm not sure what the solution is.
I suspect that if you just go the frequency space you can apply your filter directly, but sometimes your function is singular in the frequency domain, but you still gotta convolve it. For example, 1/k <-> sign(x), where sign(x) is perfectly fine in coordinate space, but 1/k isn't in momentum space.
Yeah, there are indeed some tricks to reduce the problem, but I don't see a clear way if you need to get an exact solution, given infinite compute time. Maybe you can expand the simulation domain and cut out the boundary?
Basically, the way to reduce artifacts is to use a much larger region and cut the edges. You can, for example, pad your signal (and download more RAM) with flipped over copies and only keep the middle one.
But in my case one of the signals is generated analytically, so maybe I can resolve the edges by the analytic signal larger than the experimental one (in coordinate space)
The problem with what I just wrote is that it assumes there is no signal outside of my measured signal, which in this case is true, but generally, not...
@ratchetfreak As far as I can tell it's based on bus propagation speeds, the prior pause duration was unrealistic for some packages leading to significant slowdowns and bus locks that were unnecessary.
it just so happens that .net was trying to be overclever instead of going "whelp we've spun for 10k cycles YIELD
they could potentially spin for millions of cycles
@Mgetz Yeah, I read about that last year. Didn't notice a large difference in our use-cases since they're always paired with a cache miss which is much worse.
@StackedCrooked IIRC you implemented IP stack before. I have to implement IPv6 over Bluetooth for my master's thesis - do you have any recommended resources? Books? Thanks
Btw, IPv6 is not implemented directly on top of Bluetooth. It's implemented on top of a link layer (most likely Ethernet). So the fact that you're using bluetooth or something else shouldn't affect the IPv6 code at all.
@Puppy It tries to allocate memory, actually merges shit out-of-place in O(n) time if enough memory is available and gradually fall down to an algorithm that doesn't use memory at all and runs in O(n log n)
std::stable_partition does the same kind of thing IIRC
@Puppy basically
You need really specific conditions to be able to allocate heap memory and have it exhausted without causing a crash of some kind
In memory-constrained environments you'd probably just use the stable in-place merge algorithm by Kim & Kutzner that still runs in O(n), or allocate a small stack buffer to have it be a bit faster
@Mysticial So, my code arena allocates ~200+ GB of RAM, on Windows it takes fucking forever (1+ minute) to start. Is there some trick to rapidly allocating memory on Windows? When I tried multi-threading the allocation and blasting 36 threads, the system became somewhat unresponsive.
And yes, if you multi-thread page-commit to heavily, you''ll put the system into some sort of catastrophic lock contention which takes like exponentially longer.
@Mikhail You also need the perms set for it.
And on older OS's (Windows 10 Creator's Update and earlier?) you also need admin.
Either way, the page-commit overhead in Windows is hilariously bad. A few years ago, I made library that exposes my pi program's bignum internals. And I also made a small project that uses it in a naive way to compute Pi and such. Basically every new object is a new allocation. And temp memory is allocated/freed at will since it's easy on the programmer.
On my 4-core Haswell, computing Pi to 100 million digits leads to about 50% if the CPU time spent in the kernel handling page-faults from the allocations.
On my 10-core Skylake, it's closer to 70 - 80%.
It's so bad that all the ISA optimizations (i.e. AVX) don't matter shit since the program literally spends all its time in the kernel spin-locking.
And now in post-meltdown world, I see page-table invalidation instructions added to the mix when I pull it up in VTune.
This is probably what they mean by, "Windows sucks for HPC".
On the flip side, I have a unit test runner that tries to budget memory and carefully chooses what tests to run at the same time to avoid running the system out of memory. This works very well in Windows. But in Linux, the actual memory overshoots by as much as 50%. Seems that either Linux or glibc is being much more aggressive with pooling that it - well - runs the system out of memory.
@Mysticial it's kinda the difference between HeapAlloc and VirtualAlloc, glibc is in effect built on the latter. Whereas MSVC leans heavily on the former to do all its allocation (to the point they can't supply a c11 alligned_alloc)
@Mysticial Windows sucks for HPC for a lot of reasons, IO not the least
@Mgetz My disk-swapping/compute performance was historically typically better in Windows than in Linux. But that gap has narrowed to almost zero recently if all Linux is tweaked correctly.
General compute was also better in Windows than in Linux. This was because Windows had a real thread pool whereas Linux didn't. This performance gap has narrowed since I implemented my own pool. But Windows remains ahead by a few %.
I wonder if hpc clusters will actually deploy spectre fixes. Most cluster nodes are partially managed by an external chip, and I'm not aware of real hpc where different users share a node.
@Mysticial What was the difference between atd::async thread pooling on Linux vs Windows? I think on Windows it sometimes pooled but on Linux, I never saw any pooling. Was that a compiler, libc issue or something internal?
I've been using my own thread pool since 2016. And I've only checked the older stuff (std::async, thread-spawning) for correctness and not for performance.
@Mikhail If you wanna test it, the latest version of my pi program was built with VS2017+ICC for all the AVX binaries.
Set the parallel framework to std::async launch, run the program through VTune and see if the thread life-time count is reasonable or through the roof.
@Mgetz Does it even matter if the thread is reused or not? Does reusing a thread violate the as-if rule?
@Mysticial only if thread_local is an issue, but I suspect that std::async doesn't make any guarantees there anyway
aaand I'm wrong
> If the async flag is set (i.e. (policy & std::launch::async) != 0), then async executes the callable object f on a new thread of execution (with all thread-locals initialized) as if spawned by std::thread(std::forward<F>(f), std::forward<Args>(args)...), except that if the function f returns a value or throws an exception, it is stored in the shared state accessible through the std::future that async returns to the caller.
it's all about thread_local
I suspect you could still implement that on a thread pool
Honestly looks like it's irrelevant if you pass the deferred flag
> If the deferred flag is set (i.e. (policy & std::launch::deferred) != 0), then async converts f and args... the same way as by std::thread constructor, but does not spawn a new thread of execution. Instead, lazy evaluation is performed[...]
because GCC sucks in various random soul deadening ways
Honestly I think it was laziness. They knew they could get away with it. There is no OS facility for a threadpool and Linus AFAIK is firmly opposed to adding one, so they said 'screw it'
@Mgetz kinda makes sense, if you hire a significant amount of compute then the only thing running on there is your own stuff so why would you need to hack around in that
@ratchetfreak If the AVX Spectre thing turns out to be real, I'm gonna laugh and cry at the same time if the fix is to disable AVX at the OS level by turning off XSAVE.
Monday is almost over and still no reply from Intel. If nothing happens by the end of the week, my blog is going up.