Counter and Theme Toggle - Chapel Typing CST Test
Loading…
Counter and Theme Toggle — Chapel Code
Demonstrates a simple counter with theme toggling using Chapel variables, procedures, and I/O.
var count: int = 0;
var isDark: bool = false;
proc updateUI() {
writeln("Counter: ", count);
writeln("Theme: ", if isDark then "Dark" else "Light");
}
proc increment() {
count += 1;
updateUI();
}
proc decrement() {
count -= 1;
updateUI();
}
proc reset() {
count = 0;
updateUI();
}
proc toggleTheme() {
isDark = !isDark;
updateUI();
}
// Simulate actions
updateUI();
increment();
increment();
toggleTheme();
decrement();
reset();Chapel Language Guide
Chapel is a parallel programming language designed for high-performance computing (HPC). Developed by Cray Inc., it provides productivity features for writing scalable and portable parallel programs, combining high-level abstractions with fine-grained control over concurrency and data distribution.
Primary Use Cases
- ▸High-performance computing (HPC) applications
- ▸Scientific simulations and modeling
- ▸Data-intensive parallel processing
- ▸Algorithm prototyping for supercomputers
- ▸Education in parallel and distributed programming
Notable Features
- ▸Global-view programming model for distributed memory
- ▸Task and data parallelism support
- ▸Domain maps for data distribution
- ▸High-level abstractions with optional low-level control
- ▸Portability across HPC platforms
Origin & Creator
Developed by Cray Inc. as part of the Cray Cascade project, first released in 2009.
Industrial Note
Chapel is mainly used in research, supercomputing centers, and scientific computing environments requiring scalable parallel execution.