Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is "lapacke" really needed? #1424

Closed
deepim opened this issue Feb 9, 2017 · 4 comments

Comments

@deepim
Copy link

commented Feb 9, 2017

Hi
I'm compiling CNTK-2.0.beta10.0 on linux now, and openblas is used instead of intel MKL. and found that lapacke.h is used in CPUMatrix.cpp. This introduces the dependency of lapacke and netlib's lapack. Not sure if this exists in previous release or not. but just wondering:
1, is it possible to remove dependency of lapacke? using openblas only?
2, if not, may be good to add notes in the doc.

Kenneth

@mahilleb-msft

This comment has been minimized.

Copy link
Member

commented Feb 9, 2017

Hi @Lancerkz, as far as I can recall, you still need to have the header, however, the actual library / run-time dependency can from OpenBLAS, if you make sure to compile it with LAPACK LAPACKE. This should be automatically done when a Fortran compiler (e.g., gfortran) is present. Take a look at https://github.com/Microsoft/CNTK/blob/master/Tools/docker/CNTK-CPUOnly-Image/Dockerfile, where we also check for OpenBlas being configured as expected.

Hope that helps, Mark

@deepim

This comment has been minimized.

Copy link
Author

commented Feb 9, 2017

Hi @mahilleb-msft
I meant to get rid of LAPACKE otherwise, as you mentioned, gfortran is needed. Anyway, I got your idea. I can compile LAPACKE. and with some tricks I did in compiling I can compile CNTK too. not sure if I missed something. Here are my tricks.
1, I added '-fPIC' in LAPACKE makefile to avoid link errors from cntk.
2, I explicitly added 'lapacke' in following part in CNTK makefile.

ifeq ("$(MATHLIB)","openblas")
    INCLUDEPATH += $(OPENBLAS_PATH)/include
    LIBPATH += $(OPENBLAS_PATH)/lib
    LIBS_LIST += openblas m pthread lapacke
    CPPFLAGS += -DUSE_OPENBLAS
endif
@mahilleb-msft

This comment has been minimized.

Copy link
Member

commented Feb 9, 2017

Ok, good that that works for you. Alternatively, if you recompile OpenBlas now that you've got gfortran, I don't think you need to link to lapacke specifically, the OpenBlas library would include it.

Best, Mark

@deepim

This comment has been minimized.

Copy link
Author

commented Feb 9, 2017

Hi Mark
thanks for quick response.
it could be the reason. I remember that I installed gfortran after first link error. and use liblapacke.a directly afterwards. I was not aware that lapacke would be included in libopenblas if gfortran is installed.

Kenneth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.