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

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

Open
rageworx opened this issue Mar 9, 2023 · 9 comments
Open

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

rageworx opened this issue Mar 9, 2023 · 9 comments
Assignees
Labels
enhancement New feature or request

Comments

@rageworx
Copy link
Owner

rageworx commented Mar 9, 2023

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

@rageworx rageworx added the enhancement New feature or request label Mar 9, 2023
@rageworx rageworx self-assigned this Mar 9, 2023
@rageworx
Copy link
Owner Author

rageworx commented Mar 9, 2023

homebrew llvm should be installed by brew install llvm.

@rageworx
Copy link
Owner Author

rageworx commented Mar 9, 2023

homebrew openmp should be installed by brew install libomp.

@rageworx
Copy link
Owner Author

rageworx commented Mar 9, 2023

Some makefiles created for testing openmp.
- makefiles/Makefile.homebrewllvm
- Makefiles/Makefile.testmachomebrew

@rageworx
Copy link
Owner Author

rageworx commented Mar 9, 2023

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
Copy link
Owner Author

rageworx commented Mar 9, 2023

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

@rageworx
Copy link
Owner Author

rageworx commented Mar 9, 2023

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.
  • 8233 ms. -> 799 ms. , about 10 times faster.

@rageworx
Copy link
Owner Author

rageworx commented Mar 9, 2023

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.
  • 67340 ms. -> 5770 ms. , about 10 times faster.

@rageworx
Copy link
Owner Author

rageworx commented Mar 9, 2023

Conclusion

  • openMP makes 10 times better performance on old-generaiton Mac systems, specially Intel CPUs.

@rageworx
Copy link
Owner Author

rageworx commented Mar 9, 2023

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant