Skip to content

Commit

Permalink
Add "Rayon Challenge" lab
Browse files Browse the repository at this point in the history
  • Loading branch information
jolisper committed May 11, 2024
1 parent 0f1e08e commit 576610a
Show file tree
Hide file tree
Showing 6 changed files with 414 additions and 3 deletions.
18 changes: 18 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ members = [
"week-2/Lesson 1 - Rust Safety and Security Features/w2l1-lesson-reflections",
"week-2/Lesson 2 - Security Programming with Rust/rust-crypto_hashes",
"week-2/Lesson 2 - Security Programming with Rust/rust-software-security",
"week-2/Lesson 2 - Security Programming with Rust/decoder-ring", "week-2/Lesson 2 - Security Programming with Rust/w2l2-lesson-reflections", "week-2/Lesson 3 - Concurrency with Rust/concurrency-parallelism", "week-2/Lesson 3 - Concurrency with Rust/data-races-race-conditions", "week-2/Lesson 3 - Concurrency with Rust/send-sync", "week-2/Lesson 3 - Concurrency with Rust/atomics", "week-2/Lesson 3 - Concurrency with Rust/distributed-computing-concurrency", "week-2/Lesson 3 - Concurrency with Rust/challenges-opportunities-distributed", "week-2/Lesson 3 - Concurrency with Rust/dining-philosophers", "week-2/Lesson 3 - Concurrency with Rust/w2l3-lesson-reflections",
"week-2/Lesson 2 - Security Programming with Rust/decoder-ring", "week-2/Lesson 2 - Security Programming with Rust/w2l2-lesson-reflections", "week-2/Lesson 3 - Concurrency with Rust/concurrency-parallelism", "week-2/Lesson 3 - Concurrency with Rust/data-races-race-conditions", "week-2/Lesson 3 - Concurrency with Rust/send-sync", "week-2/Lesson 3 - Concurrency with Rust/atomics", "week-2/Lesson 3 - Concurrency with Rust/distributed-computing-concurrency", "week-2/Lesson 3 - Concurrency with Rust/challenges-opportunities-distributed", "week-2/Lesson 3 - Concurrency with Rust/dining-philosophers", "week-2/Lesson 3 - Concurrency with Rust/w2l3-lesson-reflections", "week-2/Lesson 3 - Concurrency with Rust/rayon-challenge",
]
resolver = "2"
7 changes: 5 additions & 2 deletions week-2/Lesson 3 - Concurrency with Rust/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
SHELL := /bin/bash
.PHONY: help all concurrency-parallelism data-races-race-conditions send-sync atomics distributed-computing-concurrency challenges-opportunities-distributed dining-philosophers w2l3-lesson-reflections
.PHONY: help all concurrency-parallelism data-races-race-conditions send-sync atomics distributed-computing-concurrency challenges-opportunities-distributed dining-philosophers w2l3-lesson-reflections rayon-challenge

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

all: concurrency-parallelism data-races-race-conditions send-sync atomics distributed-computing-concurrency challenges-opportunities-distributed dining-philosophers w2l3-lesson-reflections ## Build all projects
all: concurrency-parallelism data-races-race-conditions send-sync atomics distributed-computing-concurrency challenges-opportunities-distributed dining-philosophers w2l3-lesson-reflections rayon-challenge ## Build all projects

concurrency-parallelism: ## Build concurrency-parallelism project
make -C "concurrency-parallelism" clean test build
Expand All @@ -29,3 +29,6 @@ dining-philosophers: ## Build dining-philosophers project

w2l3-lesson-reflections: ## Build w2l3-lesson-reflections project
make -C "w2l3-lesson-reflections" clean test build

rayon-challenge: ## Build rayon-challenge project
make -C "rayon-challenge" clean test build
10 changes: 10 additions & 0 deletions week-2/Lesson 3 - Concurrency with Rust/rayon-challenge/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "rayon-challenge"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rayon = "1.5.3"
num_cpus = "1.13.1"
39 changes: 39 additions & 0 deletions week-2/Lesson 3 - Concurrency with Rust/rayon-challenge/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
SHELL := /bin/bash
.PHONY: help clean lint format test doc build run bump

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

clean: ## Remove all build artifacts
cargo clean

lint: ## Lint code
@rustup component add rustfmt 2> /dev/null
cargo clippy

format: ## Format code
@rustup component add rustfmt 2> /dev/null
cargo fmt

test: ## Run tests
cargo test

doc: ## Generate documentation
cargo doc --no-deps

bench: ## Run benchmarks
cargo bench

build: ## Build
cargo build

all: clean lint format test doc build ## Build and run

run: ## Run
cargo run

bump: ## Bump version
@echo "Current version: $$(cargo pkgid | grep -o '#.*' | cut -d# -f2)"
@read -p "Enter new version: " new_version && \
sed -i "s/version = \".*\"/version = \"$$new_version\"/" Cargo.toml && \
echo "Updated to new version: $$(cargo pkgid | grep -o '#.*' | cut -d# -f2)"
Loading

0 comments on commit 576610a

Please sign in to comment.