Comments (6)
Thanks a lot for this useful guide! I will add it to the docs in the next release. ๐
I might also be able to include some of the changes you did in the defines in a way that works for both Linux and Windows. Will look into that.
from proxtv.
Hi there,
I have been following your guide and everything works great up to the point when the mex interface files need to be generated. At that point, for instance when building
mex -v -lblas -lf2c -llapack CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTV1_condat.cpp "*.obj"
I get the error message
TVL1opt.obj : error LNK2019: unresolved external symbol dpttrs_ referenced in function PN_TV1
even though CLAPACK libraries are located in my PATH, and indeed by looking at the debug messages I can see that the mex compiler is finding them. So for some reason even if CLAPACK is being linked those symbols cannot be reached.
Did you experience any issue similar to this one?
Regards,
รlvaro.
from proxtv.
Hi Alvaro,
I was fighting the the same problem as you; at that time, I figured that my compilation of clapack was wrong, that I made an error when compiling this lib, that's why I didn't mention it in my guide. I'm very sorry for that/
So, as far as I remember ... it appears that the standard solution of clapack does not include all the files, in particular dpttrf.c and dpttrs.c (and many others). After spending a couple of hours for looking for these functions and a nice solution with it, I ended by a brute force solution: I added all the files of the source directory (for me, it's somthing like "[...]\clapack-3.2\clapack-3.2.1-CMAKE\SRC", where all *.c files are) to the project lapack. For that, just Add Existing Elements to the project lapack and select all files. Then, clean the whole solution and generate the libs. To avoid some troubles, I started with arithchk, f2c, then blas, then lapack.
At the end, check with dumpbin if the symbols dpttrt and dpttrs are there. You should see some lines with "SECTD notype Static | $pdata$dpttrs_" for example, showing that these functions are in the lib.
Hope that will help you!
Sincerely yours,
Benoit
from proxtv.
Yes! That was the root of the issue! Thanks Benoit! ๐
I remember now that I experienced similar problems a year ago. It seems that most precompiled versions of LAPACK+BLAS only include a very thin layer of the LAPACK functionalities. I compiled CLAPACK myself from sources using cygwin and with that I managed to install the library. :)
Now, I'm running the matlab demos I included in the library and strangely enough some of them throw a segmentation fault exception. These were heavily tested under Linux, so some strange behavior must be surfacing from the mex interfaces... did you experience any similar issue when putting the library to use?
Regards,
รlvaro.
from proxtv.
Hi,
I didn't run all the demos, only the 1D proxTV function, which is of great interest for me. No segfault for me on this function as far as I remember.
Indeed, if you have run strong tests, it should work under Windows. I may try to find some time to run some tests on my PC in the next days; hope we'll find a solution!
Best Regards,
Benoรฎt
from proxtv.
I recently installed the toolbox proxTV on Windows with Matlab (compiled with Microsoft Visual C++ 2017), but followed slightly different steps. I leave them here in case it is useful for others.
-
I downloaded the code as zip and extracted it in the desired location
-
I modified the install.m script as follows: โ
- In the 'Compile C modules' section, โI added the paths to the LAPACK and BLAS libraries that come with Matlab. For me they are located at c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft. The result looks like this:
% Compile C modules mex -v -c -cxx CXXOPTIMFLAGS=-O3 CXXFLAGS='$CXXFLAGS -fopenmp -fPIC' LDFLAGS='$LDFLAGS -fopenmp' ... -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack ... -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas ... ../src/TVgenopt.cpp ../src/TVL1opt.cpp ../src/TVL1Wopt.cpp ... ../src/TVL2opt.cpp ../src/TVLPopt.cpp ../src/TV2Dopt.cpp ... ../src/TV2DWopt.cpp ../src/TVNDopt.cpp ../src/LPopt.cpp ... ../src/utils.cpp ../src/condat_fast_tv.cpp ../src/johnsonRyanTV.cpp ... ../src/TVL1opt_tautstring.cpp ../src/TVL1opt_hybridtautstring.cpp ... ../src/TVL1opt_kolmogorov.cpp
- In the 'Compile mex -v interfaces' section, โI replaced the flags "-lblas -llapack -lm" with the paths to the LAPACK and BLAS libraries that come with Matlab. For me this solved the link error that was mentioned in this same discussion. I also modified every *.o for *.obj. With these changes the section looks like this:
% Compile mex -v interfaces mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTV1_condat.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTV1_condattautstring.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTV1_johnson.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTV1_PN.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTV1_linearizedTautString.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTV1_classicTautString.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTV1_hybridTautString.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTV1_kolmogorov.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" TVL1Weighted.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" TVL1Weighted_tautString.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTV2_morec.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTV2_PGc.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTV2_morec2.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTVgen.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTV2D_DR.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTV2D_PD.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTV2D_CondatChambollePock.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTV2D_Yang.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTV2D_Kolmogorov.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTV2DL1W.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTV3D_Yang.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTVND_PDR.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTVp_GPFW.cpp "*.obj" mex -v -cxx -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwlapack -L"c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft" -lmwblas CXXOPTIMFLAGS=-O3 CXXFLAGS="\$CXXFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" solveTV.cpp "*.obj"
- In the 'Compile C modules' section, โI added the paths to the LAPACK and BLAS libraries that come with Matlab. For me they are located at c:\Program Files\MATLAB\R2020b\extern\lib\win64\microsoft. The result looks like this:
-
I modified the references to dpttrf_ and dpttrs_, to dpttrf and dpttrs respectively, for the following files in the src directory: TVL1opt.cpp, TVL1Wopt.cpp, TVL2opt.cpp, TVLPopt.cpp. This is based on stuff I read online about _ being a UNIX convention. From this post in Matlab answers: the 'extra underscore _ at the end of the BLAS library names indicate UNIX convention names, but you are compiling on a Windows machine and these trailing underscores are not present in the names in the Windows versions of these libraries'.
-
Run install.m. The first section of install.m ('Compile C modules') makes the source cpp files into obj files in the 'matlab' folder. The second section of install.m ('Compile mex -v interfaces') takes the interface cpp files and the obj files in the 'matlab' folder and generates mexw64 files for the interfaces.
-
Check everything works well by trying out the demos. Following these steps I was able to run all of them.
The only thing I'd like to double check is about a point raised in this post where they suggest replacing int for mwSignedIndex. If someone could offer guidance on that point that would be great. Thanks!
from proxtv.
Related Issues (20)
- maximum relevant lambda for tv1_1d
- Python demos images not rendering correctly
- Weighted loss function HOT 4
- Missing docs for lapack pre-requisites HOT 1
- Missing docs for demos dependencies HOT 1
- pls help me in resolving this HOT 2
- Control reaches end of non-void function HOT 1
- Tag 3.2.2 HOT 1
- Precompiled distributions HOT 1
- For complex variables HOT 1
- Prebundled Windows wheels
- 3.3.0 pypi wheels are not valid manylinux wheels HOT 5
- cannot install on macOS or ubuntu HOT 4
- Documentation clarification; monitoring objective functional along iterations HOT 3
- Weighted Objective of the library?
- Please provide either Py3.8 wheels or a sdist on PyPI
- proxtv installation HOT 3
- Second order total variation [feature request] HOT 2
- Behaviour on Mac HOT 1
- plans to port proxtv to numba or cupy HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from proxtv.