Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Documentation/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Bug fixes:
- 2026.1.2 update: fix x-angle in beam specification
- 2026.1.3: further fixes for beam view glitches for long renders
- 2026.1.4: fix addPulse sequence function
- 2026.1.5: fix loading of waveforms

Programming things:
- The CPU FFT library was switched to PocketFFT. This leads to much better performance on the AMD systems I tested; slightly worse on Intel. However, it also makes maintenance and compiling much easier.
Expand Down
12 changes: 8 additions & 4 deletions Source/Devices/LWEActiveDeviceCPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,12 @@ class CPUDevice : public LWEDevice {
#endif
int deviceCalloc(void** ptr, const size_t N, const size_t elementSize) override {
const size_t request = N*elementSize;
const size_t standard_alignment = 2*sizeof(deviceFP);
const size_t bytes = (request % standard_alignment) ? standard_alignment * (request / standard_alignment) + standard_alignment : request;
const size_t standard_alignment = 64;
const size_t bytes = standard_alignment * ((request + standard_alignment - 1)/standard_alignment);
#ifndef _WIN32
*ptr = std::aligned_alloc(standard_alignment, bytes);
#else
*ptr = std::malloc(bytes);
*ptr = _aligned_malloc(bytes, standard_alignment);
#endif
if(*ptr == nullptr) return 1;
std::memset(*ptr, 0, bytes);
Expand All @@ -266,7 +266,11 @@ class CPUDevice : public LWEDevice {
}

void deviceFree(void* block) override {
std::free(block);
#ifndef _WIN32
std::free(block);
#else
_aligned_free(block);
#endif
}

inline bool isTheCanaryPixelNaN(const deviceFP* canaryPointer) {
Expand Down
14 changes: 7 additions & 7 deletions Source/LightwaveExplorerUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,14 @@ int loadWaveformFile(
const int64_t NfreqData = lineCount / 2 + 1;

//FFT the waveform onto a frequency grid
std::vector<std::complex<double>> fftOfEin(NfreqData, 0.0);
std::vector<std::complex<double>> fftOfEin(NfreqData, std::complex<double>(0.0));
pocketfft::r2c(
{static_cast<size_t>(lineCount)},
{sizeof(float)},
{sizeof(std::complex<double>)},
pocketfft::shape_t{0}, pocketfft::FORWARD,
Ein.data(), fftOfEin.data(),
1.0);
{static_cast<size_t>(lineCount)},
{sizeof(double)},
{sizeof(std::complex<double>)},
pocketfft::shape_t{0}, pocketfft::FORWARD,
Ein.data(), fftOfEin.data(),
1.0);

//apply a time shift so that the frequency-domain solution
//oscillates slowly (will be undone after interpolation)
Expand Down
Loading