Script crashes Ubuntu 24.04 server

4 ビュー (過去 30 日間)
Kersten
Kersten 2024 年 11 月 28 日
コメント済み: Harald 2024 年 11 月 28 日
Hello,
I have run into an issue with the Ubuntu server I am running the code on, where each time the code starts it increases the CPU usage, but does not allocate any memory, even when the variable size is not neglible. The server appears alive for roughly 10 minutes, bevore crashing. It does not generate any crash log or anything similar. Once it crashed, it doesnt respond to anything, and requires the power plug to be pulled in order to shut it down.
Server Specs:
Ubuntu 24.04.1 LTS
2x 64 Core AMD Epic CPU
~1 TB of meory,
NVIDIA RTX A400
Code:
% Parameters
N = 100000; % Total number of comb lines
f_rep = 1e9; % Repetition frequency in Hz
f_CEO = 25e6; % Carrier-envelope offset frequency in Hz
f_center = 100e12; % Central frequency in Hz
T_rep = 1 / f_rep; % Repetition period
M = 20; % Number of periods
delta_t = T_rep * M; % Time window
delta_f = 1 / delta_t; % Frequency resolution
F_max = f_center + (N) * f_rep + f_CEO; % Maximum frequency (half span)
Fs = 10 * F_max; % Sampling frequency
T = 1 / Fs; % Sampling period
L = floor(Fs / delta_f); % Signal length
t = (0:L-1) * T; % Time vector
% Chunking parameters
chunk_size = 500; % Number of modes per chunk
num_chunks = ceil(N / chunk_size);
% Initialize the result
X = zeros(1, L); % Signal accumulator
% Start parallel pool if not already running
if isempty(gcp('nocreate'))
parpool; % Use all 128 cores available
end
% Parallel processing for chunks
parfor c = 1:num_chunks
% Compute indices for the current chunk
start_idx = (c-1) * chunk_size + 1;
end_idx = min(c * chunk_size, N);
% Symmetrically distribute the comb lines around f_center
% Calculate the frequencies symmetrically around the central frequency
f_k_chunk = f_center + f_CEO + (start_idx - (N/2)) * f_rep : f_rep : f_center + f_CEO + (end_idx - (N/2)) * f_rep;
% Local chunk computation
chunk_X = zeros(1, L);
for j = 1:length(f_k_chunk)
chunk_X = chunk_X + cos(2 * pi * f_k_chunk(j) * t);
end
% Accumulate the chunk result
X = X + chunk_X; % Reduction operation
end
% Windowing using the Blackman-Harris window
window = blackmanharris(L)'; % Generate the window (transpose to row vector)
% Apply the window to the time-domain signal
X_windowed = X .* window;
% Normalize the windowed signal (optional, ensures consistent amplitude scaling)
X_windowed = X_windowed / mean(window);
% Time domain plot
figure;
plot(t, X_windowed);
title("Time Domain Signal");
xlabel("Time (seconds)");
ylabel("Amplitude");
% Frequency domain analysis
Y = fft(X_windowed); % Compute the FFT
P2 = abs(Y / L); % Normalize the FFT output
P1 = P2(1:L/2+1); % Single-sided spectrum
P1(2:end-1) = 2 * P1(2:end-1); % Convert to single-sided amplitude spectrum
f = Fs / L * (0:(L/2)); % Frequency vector
% Plot the frequency spectrum
figure;
plot(f, P1, 'LineWidth', 1);
title("Single-Sided Amplitude Spectrum");
xlabel("Frequency (Hz)");
ylabel("|P1(f)|");
Any ideas what may be the problem is welcome, I am at the end of my rope.
Thanks
Update: Done some testing, apparently, at 10 processers, it uses 250 GB of memory... While it is working now, the next question is why toe scrip requires so much memory, and what all of the overhead is for.
Thanks
  1 件のコメント
Harald
Harald 2024 年 11 月 28 日
Hi,
while I also cannot tell why that each process would use 25 GB of memory as is, you may be able to significantly reduce memory overhead and improve performance by using threaded pools:
parpool("Threads")
Others may be able to provide more input on memory consumption.
Best wishes,
Harald

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeMeasurements and Feature Extraction についてさらに検索

製品


リリース

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by