https://github.com/tiernogs/enyo
A fork of the fast C++17 multithreaded PBRT library
https://github.com/tiernogs/enyo
c17 cpu for-loop multiprocessing multithreading pbrt-v4
Last synced: about 1 year ago
JSON representation
A fork of the fast C++17 multithreaded PBRT library
- Host: GitHub
- URL: https://github.com/tiernogs/enyo
- Owner: TiernoGs
- License: apache-2.0
- Created: 2024-02-18T12:47:54.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2025-01-08T17:29:54.000Z (over 1 year ago)
- Last Synced: 2025-01-19T20:32:08.190Z (over 1 year ago)
- Topics: c17, cpu, for-loop, multiprocessing, multithreading, pbrt-v4
- Language: C++
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ENYO: A fast multiprocessing C++17 library forked from PBRT v4 (CPU only)
This small lib grants you the power of multithreading in C++! It should be fairly easy to use and is compatible with the new standards of Cpp.
Moreover, the lib is a fork from pbrt-v4 available at this URL: https://github.com/mmp/pbrt-v4
## Requirements
- CMake
- C++ 17 compiler
## Platforms supported
- Windows
- Linux (Tested on Ubuntu 18)
- !Untested on MacOS!
## Documentation
### Build options
`ENYO_BUILD_TEST` builds the template C++ executable
`ENYO_FORCE_DEBUG` prints output message in Release mode
### Code example
#### Single "for-loop" example to calculate _sin(x)/x_
As shown below, the *'ParallelFor'* loop corresponds to a C *for-loop* `for(int64_t i = 0; i < 256; i++)`
```c++
std::array arr;
enyo::ParallelFor(0, 256, [&](const int64_t& i)
{
arr[i] = sin(PI * double(i) / 256.0);
arr[i] /= float(i) + epsilon;
});
```
#### 2D "for-loop" example to calculate _x * y_
```c++
std::array, 64> arr;
enyo::ParallelFor2D({ {0,0}, {64, 64} }, [&](const std::pair& p)
{
arr[p.first][p.second] = (p.first + 1) * (p.second + 1);
});
```