From 7fb1d8cccd01edb4338d6369f6dc5e3a779841d7 Mon Sep 17 00:00:00 2001 From: Nicola Vitucci Date: Thu, 18 Jul 2019 00:31:30 +0100 Subject: [PATCH 1/7] Added -obpath parameter to install_sedumi.m The -obpath parameter can be used to manually supply a path to the OpenBLAS headers. Its usage is -obpath=/path/to/openblas/headers (e.g. /usr/include/openblas). --- install_sedumi.m | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/install_sedumi.m b/install_sedumi.m index b936a31..662018d 100644 --- a/install_sedumi.m +++ b/install_sedumi.m @@ -36,6 +36,13 @@ function install_sedumi( varargin ) need_rebuild = any( strcmp( varargin, '-rebuild' ) ); no_path = any( strcmp( varargin, '-nopath' ) ); +openblas_path = ''; +for v = 1:length(varargin) + [ob_S, ob_E, ob_TE, ob_M, ob_T, ob_NM, ob_SP] = regexp( varargin{v}, '-obpath=(?.*)' ); + if ~isempty(ob_NM.path) + openblas_path = ob_NM.path; + end +end targets64={... 'bwblkslv.c sdmauxFill.c sdmauxRdot.c',... @@ -156,6 +163,16 @@ function install_sedumi( varargin ) IS64BIT = ~ISOCTAVE & strcmp(COMPUTER(end-1:end),'64'); flags = {}; libs = {}; + + if ~isempty(openblas_path) + if ~isdir(openblas_path) + disp('OpenBLAS path not valid!'); + break; + else + flags{end+1} = strcat('-I', openblas_path); + end + end + if ISOCTAVE, % Octave has mwSize and mwIndex hardcoded in mex.h as ints. % There is no definition for mwSignedIndex so include it here. From ee231145b12f3cbd57a1bc7209e882aded2bffb4 Mon Sep 17 00:00:00 2001 From: Nicola Vitucci Date: Thu, 18 Jul 2019 19:23:20 +0100 Subject: [PATCH 2/7] Replaced break with return --- install_sedumi.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_sedumi.m b/install_sedumi.m index 662018d..7c755a3 100644 --- a/install_sedumi.m +++ b/install_sedumi.m @@ -167,7 +167,7 @@ function install_sedumi( varargin ) if ~isempty(openblas_path) if ~isdir(openblas_path) disp('OpenBLAS path not valid!'); - break; + return; else flags{end+1} = strcat('-I', openblas_path); end From b2b6261bf9fc9675001c162714592469afadfdd1 Mon Sep 17 00:00:00 2001 From: Nicola Vitucci Date: Thu, 18 Jul 2019 19:27:26 +0100 Subject: [PATCH 3/7] Fixed isempty bug --- install_sedumi.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_sedumi.m b/install_sedumi.m index 7c755a3..591821f 100644 --- a/install_sedumi.m +++ b/install_sedumi.m @@ -39,7 +39,7 @@ function install_sedumi( varargin ) openblas_path = ''; for v = 1:length(varargin) [ob_S, ob_E, ob_TE, ob_M, ob_T, ob_NM, ob_SP] = regexp( varargin{v}, '-obpath=(?.*)' ); - if ~isempty(ob_NM.path) + if ~isempty(ob_NM) && ~isempty(ob_NM.path) openblas_path = ob_NM.path; end end From 472017dce723e2a8191abac9a871158d48df90ed Mon Sep 17 00:00:00 2001 From: nvitucci Date: Fri, 19 Jul 2019 23:07:13 +0100 Subject: [PATCH 4/7] Updated error message --- install_sedumi.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/install_sedumi.m b/install_sedumi.m index 591821f..2643623 100644 --- a/install_sedumi.m +++ b/install_sedumi.m @@ -166,7 +166,9 @@ function install_sedumi( varargin ) if ~isempty(openblas_path) if ~isdir(openblas_path) - disp('OpenBLAS path not valid!'); + disp('Please set the correct OpenBLAS include path with'); + disp(' install_sedumi -obpath=/path/to/openblas/headers'); + disp('(the directory where the f77blas.h file is located).'); return; else flags{end+1} = strcat('-I', openblas_path); From e6fd89945a1cee4662e3bcda9c010b17401a713b Mon Sep 17 00:00:00 2001 From: nvitucci Date: Fri, 19 Jul 2019 23:11:02 +0100 Subject: [PATCH 5/7] Replaced isdir --- install_sedumi.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_sedumi.m b/install_sedumi.m index 2643623..314ace4 100644 --- a/install_sedumi.m +++ b/install_sedumi.m @@ -165,7 +165,7 @@ function install_sedumi( varargin ) libs = {}; if ~isempty(openblas_path) - if ~isdir(openblas_path) + if exist (openblas_path, "dir") ~= 7 disp('Please set the correct OpenBLAS include path with'); disp(' install_sedumi -obpath=/path/to/openblas/headers'); disp('(the directory where the f77blas.h file is located).'); From 5050b676225e9a3a23a5f9dc24a9310a7a7c9119 Mon Sep 17 00:00:00 2001 From: nvitucci Date: Fri, 19 Jul 2019 23:12:54 +0100 Subject: [PATCH 6/7] Updated regexp return values --- install_sedumi.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_sedumi.m b/install_sedumi.m index 314ace4..e20ffef 100644 --- a/install_sedumi.m +++ b/install_sedumi.m @@ -38,7 +38,7 @@ function install_sedumi( varargin ) no_path = any( strcmp( varargin, '-nopath' ) ); openblas_path = ''; for v = 1:length(varargin) - [ob_S, ob_E, ob_TE, ob_M, ob_T, ob_NM, ob_SP] = regexp( varargin{v}, '-obpath=(?.*)' ); + ob_NM = regexp( varargin{v}, '-obpath=(?.*)', 'names' ); if ~isempty(ob_NM) && ~isempty(ob_NM.path) openblas_path = ob_NM.path; end From 563e5fe0c50a933ae890a3b2422bdd91985580df Mon Sep 17 00:00:00 2001 From: nvitucci Date: Fri, 19 Jul 2019 23:27:53 +0100 Subject: [PATCH 7/7] Added default value for -obpath and updated error message --- install_sedumi.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/install_sedumi.m b/install_sedumi.m index e20ffef..f8cf7f0 100644 --- a/install_sedumi.m +++ b/install_sedumi.m @@ -185,6 +185,10 @@ function install_sedumi( varargin ) flags{end+1} = '-O'; flags{end+1} = '-DOCTAVE'; libs{end+1} = '-lblas'; + + if isempty(openblas_path) + flags{end+1} = strcat('-I', '/usr/include/openblas'); + end else flags{end+1} = '-O'; if IS64BIT && ( VERSION >= 7.03 ), @@ -244,6 +248,8 @@ function install_sedumi( varargin ) disp( line ); disp( 'SeDuMi was not successfully installed.' ); disp( 'Please attempt to correct the errors and try again.' ); + disp( 'For example, try setting the OpenBLAS include path with' ); + disp(' install_sedumi -obpath=/path/to/openblas/headers'); elseif ~no_path, disp( line ); fprintf( 'Adding SeDuMi to the %s path:\n', prog );