embotech/ecos

ECOS causing CVX 2.1 and 3.0 to crash under Windows 7 64 bit

Closed this issue · 4 comments

ECOS appears to install correctly under windows 7 and MATLAB 2014B, by which I mean a mex file called ecos.mexw64 is produced using the Windows SDK 7.1 (C) compiler CVX recognizes the shim and lists ecos as a solver when I run cvx_setup, but it crashes while running the script below. The same behavior is seen under CVX 2.1 and CVX 3.0.

The crash occurs immediately after ecos declares the number of variables and constraints. The crash is serious and brings MATLAB 2014B down. The script runs to completion with SeDuMi, SDPT3 and SCS, so I am pretty sure the problem is not with the script. Also, ECOS worked with this script a few months ago before MATLAB2014B...I will try to check whether it works with 2014A and this compiler.

% Sets up an example X-Band ELINT problem.

clear all
close all

% Parameters:

K = 5; % Number of discrete sinusoids.
B = 1000; % Radar Bandwidth (MHz).
TDWELL = 0.08; % Dwell time (microseconds)from GTRI paper
PAD = 4; % zero pad
N = 2_PAD_TDWELL*B; % Number of complex samples at the Nyquist rate.
M = N/10; % Number of samples.

% Pick K frequencies centered on gates.

DF = B/(N/4-1); % Gate size
J = randi([0,N/4-1],[K,1]); % Gate numbers
Freq = DF_(J) - 0.5_B;

Phi = -pi + pi_rand(K,1); % Uniform from -pi to pi
A = 0.25 + 0.75_abs(rand(K,1)); % Uniformly distrbuted between 0.25 and 1

% Plot ground truth power spectrum.

figure
stem(Freq,A.^2/max(A.^2))
axis([-0.5_B,0.5_B,0,1.1])
xlabel('Frequency (MHz)')
ylabel('Power Spectrum (normalized units)')
title('Input sinusoids')

% Build I & Q time series.

n = (1:N)';
T = N/B; % Makes the number of complex samples B_T per Shannon.
dt = T/(N-1);
t = (n-1)_dt; % Unit is microseconds
ZI = zeros(N,1);
ZQ = zeros(N,1);
for k = 1:K
ZI = ZI + A(k)_cos(Freq(k)_t + Phi(k));
ZQ = ZQ + A(k)_sin(Freq(k)_t + Phi(k));
end
Z = ZI + 1i*ZQ;

% Plot PSD obtained via N-point DFT

spectrum = fftshift(fft(Z,N));
psd = conj(spectrum).spectrum;
psdnorm = psd/max(psd);
ff = 2_pi_B
(-N/2:N/2-1)/N;
figure
plot(ff,psdnorm)
axis([-500,500,0,1.1])
xlabel('Frequency (MHz)')
ylabel('PSD from DFT (normalized)')
title('Power spectrum from DFT')

figure
plot(t(1:100,1),ZI(1:100,1))
hold on
plot(t(1:100,1),ZQ(1:100,1),'r--')
xlabel('Time (microseconds)')
ylabel('Amplitude (normalized units)')
legend('Real','Imaginary')
hold off

pick = [(1:N)' rand(N,1)];
shuffled = sortrows(pick,2);
nz = sortrows(shuffled(1:M,1));

% load('ELINT_data','K','B','T','Freq','Phi','A','N','M','t','nz','ZI','ZQ')

Z = ZI + 1i*ZQ;

% Add receiver noise and quantization noise

bits = 24; % Bits of precision.
Z = floor(Z_2^bits)/(2^bits); % Add quantization noise.
SNR = 20; % SNR (dB).
R = 10^(SNR/10);
u =(randn(N,1) + 1i_randn(N,1))/sqrt(2);
alpha = sqrt((Z'Z)/(R(u'_u)));
Z = Z + alpha_u; % Add white noise.

% Build NxN DFT matrix

WFACTOR = cos(2_pi/N)+1i_sin(2_pi/N);
W = zeros(N,N);
for n = 1:N
for m = 1:N
W(m,n)= WFACTOR^(m_n);
end
end

% Build deleted DFT matrix A by stacking the M rows W(nz(m),:)(m = 1...M)

A = W(nz(1),:);
ZZ = Z(nz(1));
for m=2:M
A = [A;W(nz(m),:)];
ZZ = [ ZZ; Z(nz(m))];
end

% Use CVX to find sparsest solution to underdetermined system

save('CVX_inputs','N','M','A','ZZ') % To be translated into SOCP form.

cvx_begin
cvx_solver ecos
variable F(N,1) complex;
minimize ( norm(F,1) )
subject to
A*F == ZZ
cvx_end

figure
psd = fftshift(conj(F).F);
psdnorm = psd/max(psd);
ff = 2_pi_B
(-N/2:N/2-1)/N;
plot(ff,psdnorm)
xlabel('Frequency (MHz)')
ylabel('Sparse PSD 10% (normalized)')
axis([-0.5_B 0.5_B 0 1.1])


Paul, I believe this has been fixed in the development branch, see #83. If you check out that one you also find a compiled MEX file for use in Matlab Win 64.

Hello Alex,

There is a problem when I run cvx_install_ecos. The output is as follows:

cvx_install_ecos
Compiling LDL...Building with 'Microsoft Windows SDK 7.1 (C)'.
MEX completed successfully.
[done]
Compiling AMD...Building with 'Microsoft Windows SDK 7.1 (C)'.
MEX completed successfully.
[done]
Compiling ecos...Building with 'Microsoft Windows SDK 7.1 (C)'.
Error using mex
ecos_bb_preproc.c
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(25) : warning C4244: 'return' : conversion from 'idxint' to 'int', possible loss of data
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(142) : error C2275: 'ecos_bb_pwork' : illegal use of this type as an expression
../include\ecos_bb.h(71) : see declaration of 'ecos_bb_pwork'
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(142) : error C2065: 'prob' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(145) : error C2065: 'prob' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(145) : error C2223: left of '->maxiter' must point to struct/union
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(148) : error C2065: 'prob' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(148) : error C2223: left of '->best_x' must point to struct/union
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(151) : error C2065: 'prob' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(151) : error C2223: left of '->nodes' must point to struct/union
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(154) : error C2065: 'prob' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(154) : error C2223: left of '->node_ids' must point to struct/union
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(157) : error C2065: 'prob' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(157) : error C2223: left of '->tmp_node_id' must point to struct/union
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(160) : error C2065: 'prob' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(160) : error C2223: left of '->bool_vars_idx' must point to struct/union
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(163) : error C2065: 'prob' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(163) : error C2223: left of '->ecos_prob' must point to struct/union
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(170) : error C2065: 'prob' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(170) : error C2223: left of '->num_bool_vars' must point to struct/union
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(172) : error C2065: 'prob' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(172) : error C2223: left of '->global_U' must point to struct/union
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(172) : error C2065: 'INFINITY' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(175) : error C2065: 'prob' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(175) : error C2223: left of '->h' must point to struct/union
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(175) : error C2065: 'prob' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(175) : error C2223: left of '->ecos_prob' must point to struct/union
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(178) : error C2065: 'prob' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(178) : error C2223: left of '->A' must point to struct/union
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(178) : error C2065: 'prob' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(178) : error C2223: left of '->ecos_prob' must point to struct/union
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(179) : error C2065: 'prob' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(179) : error C2223: left of '->G' must point to struct/union
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(179) : error C2065: 'prob' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(179) : error C2223: left of '->ecos_prob' must point to struct/union
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(180) : error C2065: 'prob' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(180) : error C2223: left of '->c' must point to struct/union
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(180) : error C2065: 'prob' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(180) : error C2223: left of '->ecos_prob' must point to struct/union
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(181) : error C2065: 'prob' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(181) : error C2223: left of '->b' must point to struct/union
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(181) : error C2065: 'prob' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(181) : error C2223: left of '->ecos_prob' must point to struct/union
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(184) : error C2065: 'prob' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(184) : error C2223: left of '->ecos_prob' must point to struct/union
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(186) : error C2065: 'prob' : undeclared identifier
C:\Users\mountcastle\Downloads\ecos-develop\ecos_bb\ecos_bb_preproc.c(186) : warning C4047: 'return' : 'ecos_bb_pwork *' differs in levels of indirection from 'int'

Error in makemex (line 61)
eval(cmd);

Error in cvx_install_ecos (line 1)
makemex

If you're using CVX 3.0, you should not be running cvx_install_ecos anyway. Just add the ECOS matlab directory to your MATLAB path and re-run cvx_setup.

Thank you, Michael. That was my problem alright.
Thanks, Alex. All good. ECOS rules! - Paul