rageworx / libsrcnn

Super-Resolution imaging with Convolutional Neural Network library for G++, Non-OpenCV model.
http://rageworx.pe.kr/search/SRCNN
GNU Lesser General Public License v3.0
16 stars 1 forks source link

Experimental issue : OpenMP on macOS, homebrew llvm + libomp #13

Open rageworx opened 1 year ago

rageworx commented 1 year ago

Default llvm (clang) of macOS not supports openmp basically. Experimental performance enhancement for Intel CPU based Mac systems.

rageworx commented 1 year ago

homebrew llvm should be installed by brew install llvm.

rageworx commented 1 year ago

homebrew openmp should be installed by brew install libomp.

rageworx commented 1 year ago

Some makefiles created for testing openmp.

rageworx commented 1 year ago

Generating dylib successfully done, with makefiles/Makefile.homebrewllvm with make dylib. homebrew llvm doesn't support multi-architecture, Cannot use multiple -arch parameters for universal binary.

rageworx commented 1 year ago

homebrew llvm dylib + macOS native llvm-gcc linking successfully worked.

rageworx commented 1 year ago

Performance extremely increased for butterfly.png on my old MacBook Pro Ratina 13" (2015) CTO, Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz.

>  bin/srcnntest Pictures/butterfly.png --scale=2
- Loading image : Pictures/butterfly.png
- Image loaded type : PNG | 256 x 256 x 3 bytes
- Scaling ratio : 2.00
- Filter : Bicubic
- Processing SRCNN ... Test Ok, took 799 ms.
- Saving rezied result to Pictures/butterfly_resized.png ... Ok.
- Saving convolution result to Pictures/butterfly_convolution.png ... Ok.
rageworx commented 1 year ago

Testing performance with test.jpg,

>  bin/srcnntest Pictures/test.jpg --scale=2
- Loading image : Pictures/test.jpg
- Image loaded type : JPEG | 960 x 540 x 3 bytes
- Scaling ratio : 2.00
- Filter : Bicubic
- Processing SRCNN ... Test Ok, took 5770 ms.
- Saving rezied result to Pictures/test_resized.png ... Ok.
- Saving convolution result to Pictures/test_convolution.png ... Ok.
rageworx commented 1 year ago

Conclusion

rageworx commented 1 year ago

macOS12 OpenMP dylib

libsrcnn-dylib-macOS12-intel-experimental.zip

dependancy

>  otool -L lib/libsrcnn.dylib
lib/libsrcnn.dylib:
    lib/libsrcnn.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/opt/llvm/lib/c++/libc++.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/local/opt/llvm/lib/libomp.dylib (compatibility version 5.0.0, current version 5.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)