Parrot is an array fusion GPU library built on NVIDIA's CCCL libaries (Thrust/CUB).
See the code
Parrot is an array fusion GPU library built on NVIDIA's CCCL libraries (Thrust/CUB). It provides efficient GPU-accelerated operations with lazy evaluation semantics, allowing for chaining of operations without unnecessary intermediate materializations.
#include "parrot.hpp"#include "parrot.hpp"
int main() {
// Create arrays
auto A = parrot::array({3, 4, 0, 8, 2});
auto B = parrot::array({6, 7, 2, 1, 8});
auto C = parrot::array({2, 5, 7, 4, 3});
// Chain operations
(B * C + A).print(); // Output: 15 39 14 12 26
}
#include "parrot.hpp"
using namespace parrot::literals;
auto softmax(auto matrix) {
auto cols = matrix.ncols();
auto z = matrix - matrix.maxr(2_ic).replicate(cols);
auto num = z.exp();
auto den = num.sum(2_ic);
return num / den.replicate(cols);
}
int main() {
auto matrix = parrot::range(6).as<float>().reshape({2, 3});
softmax(matrix).print();
}
# Clone the repository
git clone <repository-url>
cd parrot
# Create build directory
mkdir build && cd build
# Configure and build
cmake ..
cmake --build . -j$(nproc)
# Run tests
ctest
For detailed build instructions, see BUILDING.md.
Parrot provides significant code reduction compared to other CUDA libraries:
| Library | Code Reduction |
|---|---|
| Thrust | ~10x less code |
See detailed comparisons in our documentation.
The examples/ directory contains:
getting_started/ - Simple examples to get startedmachine_learning/ - Machine learning examplesthrust/ - Parrot implementations of Thrust examplesreal_world/ - Parrot versions of examples from open source projects# All tests
ctest
# Individual test categories
./test_basic # Basic operations
./test_sorting # Sorting algorithms
./test_math # Mathematical operations
./test_reductions # Reduction operations
# Run clang-tidy
./scripts/run-clang-tidy.sh
# Auto-fix issues
./scripts/run-clang-tidy.sh --fix
# Install dependencies
uv venv
uv pip install -r requirements.txt
# Build docs
cd scripts && ./build-docs.sh
parrot/
├── parrot.hpp # Main header (single-file library)
├── thrustx.hpp # Extended Thrust utilities
├── examples/ # Example code
│ ├── getting_started/ # Simple getting-started examples
│ ├── machine_learning/ # Softmax, more to come
│ ├── thrust/ # Parrot versions of Thrust examples
│ └── real_world/ # Parrot versions of examples from open source projects
├── docs/ # Documentation source
├── tests/ # Unit tests
└── scripts/ # Development scripts
We welcome contributions! Please see our CONTRIBUTING.md guide for details on:
All contributions must comply with the Apache License 2.0.
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
This project includes third-party software components. See THIRD_PARTY_LICENSES for complete license information and attributions.
Built on top of NVIDIA Thrust and CUDA.
Cuda
74.7%
Shell
12.1%
Python
7.6%
CMake
5.6%
Parrot is an array fusion GPU library built on NVIDIA's CCCL libaries (Thrust/CUB).
See the code
Parrot is an array fusion GPU library built on NVIDIA's CCCL libraries (Thrust/CUB). It provides efficient GPU-accelerated operations with lazy evaluation semantics, allowing for chaining of operations without unnecessary intermediate materializations.
#include "parrot.hpp"#include "parrot.hpp"
int main() {
// Create arrays
auto A = parrot::array({3, 4, 0, 8, 2});
auto B = parrot::array({6, 7, 2, 1, 8});
auto C = parrot::array({2, 5, 7, 4, 3});
// Chain operations
(B * C + A).print(); // Output: 15 39 14 12 26
}
#include "parrot.hpp"
using namespace parrot::literals;
auto softmax(auto matrix) {
auto cols = matrix.ncols();
auto z = matrix - matrix.maxr(2_ic).replicate(cols);
auto num = z.exp();
auto den = num.sum(2_ic);
return num / den.replicate(cols);
}
int main() {
auto matrix = parrot::range(6).as<float>().reshape({2, 3});
softmax(matrix).print();
}
# Clone the repository
git clone <repository-url>
cd parrot
# Create build directory
mkdir build && cd build
# Configure and build
cmake ..
cmake --build . -j$(nproc)
# Run tests
ctest
For detailed build instructions, see BUILDING.md.
Parrot provides significant code reduction compared to other CUDA libraries:
| Library | Code Reduction |
|---|---|
| Thrust | ~10x less code |
See detailed comparisons in our documentation.
The examples/ directory contains:
getting_started/ - Simple examples to get startedmachine_learning/ - Machine learning examplesthrust/ - Parrot implementations of Thrust examplesreal_world/ - Parrot versions of examples from open source projects# All tests
ctest
# Individual test categories
./test_basic # Basic operations
./test_sorting # Sorting algorithms
./test_math # Mathematical operations
./test_reductions # Reduction operations
# Run clang-tidy
./scripts/run-clang-tidy.sh
# Auto-fix issues
./scripts/run-clang-tidy.sh --fix
# Install dependencies
uv venv
uv pip install -r requirements.txt
# Build docs
cd scripts && ./build-docs.sh
parrot/
├── parrot.hpp # Main header (single-file library)
├── thrustx.hpp # Extended Thrust utilities
├── examples/ # Example code
│ ├── getting_started/ # Simple getting-started examples
│ ├── machine_learning/ # Softmax, more to come
│ ├── thrust/ # Parrot versions of Thrust examples
│ └── real_world/ # Parrot versions of examples from open source projects
├── docs/ # Documentation source
├── tests/ # Unit tests
└── scripts/ # Development scripts
We welcome contributions! Please see our CONTRIBUTING.md guide for details on:
All contributions must comply with the Apache License 2.0.
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
This project includes third-party software components. See THIRD_PARTY_LICENSES for complete license information and attributions.
Built on top of NVIDIA Thrust and CUDA.
Cuda
74.7%
Shell
12.1%
Python
7.6%
CMake
5.6%