Agenda and Timeline

  • 19:00 - 19:30: Welcome, Grab a drink, Grab a Pizza, Set up your workspace
  • 19:30 - 19:45: Introduction to the Hack Evening and the Challenge
  • 19:45 - 21:45: Write Code, Ask Questions, Get Help, Repeat - Have Fun!
  • 21:45 - 22:00: Wrap-up

Introduction

See the README.md

Learning Opportunities

Some things are more like side quests, others are important to get a reasonale speed.

Learning Opportunities

CLI

There are a few rust libraries available to create a CLI for your solution. This is a great opportunity to learn how to use them. Here we want to suggest two libraries, clap and argh.

Clap

You could use clap - A full-featured, fast Command Line Argument Parser for Rust, to create a CLI for your solution.

:Note: clap has a sort of a declarative syntax, which works with rust proc macros. It's very well documented in form of examples, and reduces the boilerplate code you have to write for parsing command line arguments. This is very useful to explore if you are new to clap. Besides you can still use the procedural API if you prefer.

Alternative Argh

There is different library called Argh that comes with a declarative syntax for defining command line arguments. It's a bit less feature-rich than clap, yet it's powerful and easy to use.

Ideas for your CLI

Here are some optional ideas for CLI options you could implement:

  • support a --help flag to print a help message
  • support multiple input files at once (e.g. file1.csv file2.csv file3.csv)
  • support different output formats, e.g. JSON, CSV, etc. (e.g. --output-format json)
  • support different output destinations, e.g. file (e.g. --output-file output.csv)
  • support different output verbosity levels (e.g. --verbose, --debug, etc.)
  • support different error handling strategies (e.g. --ignore-errors, --fail-fast, etc.)
  • show a nice progress bar while processing the input files

Learning Opportunities

Threading

Rust has a powerful threading model that allows you to write concurrent code safely. This is a great opportunity to learn how to use it. Here we want to suggest the crate rayon that will likely lead you down a path where you will learn about std::sync::Arc, std::sync::RwLock and std::sync::mpsc::channel and a likes.

rayon is a data parallelism library for Rust. It is a simple and efficient library that allows you to write parallel code that is easy to read and understand. It is a great way to get started with parallel programming in Rust.

Please note that parallelism of IO is a tricky, so you might seek help of channels to communicate between threads.

Learning Opportunities

Some Ideas

  • buffered IO
  • io_uring for async IO
  • no string usage and use byte slices instead
  • SIMD float parsing

Submission

To submit your solution, please create a fork of this repository and submit a pull request to the main branch. Your pull request should include the following:

  • A new directory in the solutions directory named after your GitHub username.
  • This should contain a binary rust project with your solution.
  • The binary should accept a single argument, that is the file path to the input file.

For example, if your GitHub username is sassman, your solution should be in solutions/sassman. It should be callable like this:

cd solutions/sassman
cargo run --release -- ../../samples/weather_100.csv

The output should be written to stdout.

Please note that CI will run on your pull request to ensure that your solution compiles and runs correctly.

:NOTE: If you have any questions, feel free to ask in the #hack-evening-2024-4 channel on the Rust Munich Discord server.

Good luck! 🦀

CI is your friend

  • Your PR is automatically checked by GitHub Actions
  • Benchmarks are exectued and results are provided as Comment on the PR, you can use this as a tool
  • Flamegraphs are also produced during the build, they should appear on the PR as comment as well

Submission Evaluation

We are evaluating submissions by benchmarking them on a set of three self-hosted Github runners with dedicated vCPU cores. The servers are AMD EPYC instances (CCX33) from Hetzner with the following specs:

resourcevalue
dedicated vCPU cores8
RAM in GB32
disk space in GB240

You submission will be terminated after 8 minutes (including build time).

$ cat /proc/cpuinfo # with just the last core shown
processor       : 7
vendor_id       : AuthenticAMD
cpu family      : 25
model           : 1
model name      : AMD EPYC Processor
stepping        : 1
microcode       : 0x1000065
cpu MHz         : 2396.400
cache size      : 512 KB
physical id     : 0
siblings        : 8
core id         : 3
cpu cores       : 4
apicid          : 7
initial apicid  : 7
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm rep_good nopl cpuid extd_apicid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext perfctr_core invpcid_single ssbd ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves clzero xsaveerptr wbnoinvd arat umip pku ospke rdpid fsrm
bugs            : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass srso
bogomips        : 4792.80
TLB size        : 1024 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:

Conclusion

  • We will share the leaderboard results on Discord in the next day
  • Please use discord to share your solution with others
  • Next event date and time announcement

We need your Feedback!

Help us to improve the Rust Munich Meetup by providing your feedback. Scan the QR code or click the link below to fill out the feedback form.

qrcode

Feedback Form

Leaderboard

RankUserMean [s]Stddev [s]
1hovinen hovinen60.687397549820005± 0.2872044826675961
2girstenbrei girstenbrei118.67308134039999± 2.8637700908595756
3iOperator iOperator169.38963314021996± 0.5828509560199935
4marcoow marcoow175.49558819898± 1.0326829202256727
5alexsotocx alexsotocx179.78462991153998± 1.1681295019958327
6barsuhn barsuhn190.29944273508002± 5.240300546077779
7Akaame Akaame232.71483228380004± 1.8100177534131772

updated at: 2024-12-13 10:35:27+00:00