English
Tasks
Complete the task of the chosen difficulty level for your variant number.
Variants
Variant 1. Area under a curve
1. Initial level. Create a console program that computes Parallel.For with local sums, and prints both values, the errors relative to Math.PI, and the time of both approaches.
2. Basic level. Create a console program that prompts for the integration limits
3. Advanced level. Create an integrate console application that accepts the options --function sin|exp|poly, --from, --to, --eps, --rule mid|trap|simpson, --threads 1,2,4,8,16, and --help. For each thread count, the program computes the integral with error control by Runge’s rule, prints a “threads – time –
Variant 2. Adaptive integration
1. Initial level. Create a console program that computes Parallel.Invoke for the two halves of a segment down to depth 8, and prints both values, the errors, the number of function evaluations, and the time.
2. Basic level. Create a console program that prompts for the tolerance (from
3. Advanced level. Create an adaptive console application that, for three functions with singularities (Parallel.For, and recursive tasks with depth thresholds of 4, 8, 12, and 16. Options: --eps, --threads, --csv <file>, --help. The program prints a “function – method – time –
Variant 3. Multiple integral
1. Initial level. Create a console program that computes the double integral Parallel.For over grid rows, and prints the value, the error, and the time of both approaches.
2. Basic level. Create a console program that prompts for a rectangle
3. Advanced level. Create a double-integral console application that accepts a function from a list (--function gauss|poly|trig), a domain, the number of nodes, the option --layout rows|cols|blocks, --threads 1,2,4,8,16, and --help. The program doubles the grid until the tolerance --eps is reached by Runge’s rule, prints the time, speedup, and efficiency for each thread count, and writes the results to CSV. A domain outside the allowed limits or an odd number of nodes produces a message in the error stream and exit code 1.
Variant 4. Volume of a solid by the Monte Carlo method
1. Initial level. Create a console program that estimates the volume of a ball of radius 1 by the Monte Carlo method from 100,000,000 random points of the cube Parallel.For blocks, each with its own Random with seed 2026 + k. The program prints the estimate, the exact value
2. Basic level. Create a console program that prompts for the number of points (from
3. Advanced level. Create a montecarlo console application that estimates the volume of a solid defined by a system of inequalities from a list (--body ball|torus|intersection) in a space of dimension 2 to 10 (--dim), with the options --points, --blocks, --seed, --threads, and --help. The program prints the estimate with a confidence interval and a time and speedup table for different thread counts, and checks the reproducibility of two runs with the same seed. Invalid options go to the error stream with exit code 1.
Variant 5. Roots of a polynomial
1. Initial level. Create a console program that finds all roots of the Chebyshev polynomial Parallel.For) and refines them by bisection in parallel. The program prints the number of roots, the first 5 roots, and the largest difference from the exact values
2. Basic level. Create a console program that prompts for the coefficients of a polynomial (up to degree 20) and a segment, validates the input, isolates the roots on a grid with a user-specified number of segments, and refines them by parallel bisection to
3. Advanced level. Create a roots console application that reads a polynomial from a file (space-separated coefficients) and accepts the options --from, --to, --segments, --method bisect|psection|newton, --threads, and --help. The psection method evaluates the polynomial simultaneously at
Variant 6. Newton’s method basins
1. Initial level. Create a console program that, for the equation System.Numerics.Complex, Parallel.For over rows) and prints how many points converged to each of the three roots and how many did not, and the time of the sequential and parallel versions.
2. Basic level. Create a console program that prompts for the degree
3. Advanced level. Create a newton-basins console application that accepts a polynomial (--poly "1 0 0 -1"), a domain, the image size, --schedule static|cyclic|dynamic, --threads, and --help. The program builds the basins of attraction, writes a PGM image, and prints a “distribution – time –
Variant 7. A system of nonlinear equations
1. Initial level. Create a console program that solves the system Parallel.For) and prints the distinct solutions found (to within
2. Basic level. Create a console program that prompts for the dimension
3. Advanced level. Create a newton-system console application that solves a system from a list (--system chain|broyden|trig) of dimension --n by Newton’s method with a parallel Jacobian (--jacobian analytic|numeric) and parallel solution of the linear system by Gaussian elimination. Options: --tol, --threads, --help. The program prints a table of iterations (residual norm, step, time) and the overall speedup, and a message in the error stream with exit code 2 if the method did not converge.
Variant 8. Dot product and norms
1. Initial level. Create a console program that computes the dot product of two vectors of 10,000,000 random double values with a block distribution on 1, 2, 4, and 8 threads (Parallel.For over thread numbers) and prints the results and the time for each thread count.
2. Basic level. Create a console program that prompts for the vector length, the number of threads, and the block size, validates the input, and computes the dot product, the Euclidean norm, and the maximum absolute value with the block, cyclic, and block-cyclic distributions. The program prints a “distribution – time –
3. Advanced level. Create a vecdist console application that computes the dot product of two random vectors of length --n with the block, cyclic, and block-cyclic distributions for --threads 1,2,4,8,16 and block sizes --blocks 1,64,1024,65536, writes the table to CSV, and separately demonstrates reproducibility: 5 runs of a nondeterministic reduction (lock in localFinally) and 5 runs of a deterministic one. For vectors larger than the L3 cache, the program computes the achieved bandwidth in GB/s. Option --help; option errors use exit code 1.
Variant 9. Matrix–vector multiplication
1. Initial level. Create a console program that multiplies a Parallel.For over stripe numbers), checks that the results match, and prints the time and speedup.
2. Basic level. Create a console program that prompts for the matrix size and the number of threads, validates the input, and multiplies the matrix by a vector with horizontal stripes and with vertical stripes with a reduction of the partial vectors. The program prints a “scheme – time –
3. Advanced level. Create a matvec console application that multiplies a random --sizes and thread counts --threads. The program measures memory bandwidth with a separate test, builds the prediction --help; errors use exit code 1.
Variant 10. Checkerboard matrix multiplication and Fox’s algorithm
1. Initial level. Create a console program that multiplies two
2. Basic level. Create a console program that prompts for the matrix size Barrier: broadcasting block
3. Advanced level. Create a fox console application that multiplies random matrices with Fox’s algorithm (threads of a Barrier, broadcasting blocks of --sizes and grids --grids 1,2,3,4. The program counts the amount of copied data (the analog of communication) and the barrier time, prints an “
Variant 11. Cannon’s algorithm
1. Initial level. Create a console program that, for a
2. Basic level. Create a console program that prompts for the matrix size Barrier. The program prints the time, the speedup, and the largest difference from sequential multiplication.
3. Advanced level. Create a cannon console application that multiplies two random Barrier) with the options --n, --grid, --kernel scalar|simd, --repeat, and --help. The program separately measures the time of the alignment, multiplications, copies, and barriers of each thread and prints a table of time by stage, the speedup predicted by the model, and the measured speedup. Invalid sizes use exit code 1; a discrepancy from sequential multiplication of more than
Variant 12. Transposing a large matrix
1. Initial level. Create a console program that transposes an double matrix with a simple double loop and with Parallel.For over rows, checks the result, and prints the time of both approaches.
2. Basic level. Create a console program that prompts for the matrix size and a list of block sizes, validates the input, and transposes the matrix by blocks in parallel over rows of blocks. The program prints a “block – time – GB/s” table and marks the best block size.
3. Advanced level. Create a transpose console application that compares transposing into a new matrix and in place (for a square matrix), the simple and blocked variants, and static and dynamic distribution of blocks, for sizes --sizes and threads --threads. The program writes a table with the bandwidth to CSV, checks each result, and accepts --help. Odd or excessively large sizes (beyond the available memory) produce a message in the error stream and exit code 1.
Variant 13. The conjugate gradient method
1. Initial level. Create a console program that solves a tridiagonal system of 1,000,000 equations (
2. Basic level. Create a console program that prompts for the size
3. Advanced level. Create a cg console application that solves the Poisson equation on an --size) by the conjugate gradient method with the options --tol, --threads, --reduction deterministic|lock, and --help. The program writes a convergence plot to a CSV file (iteration, residual norm), prints a “threads – iterations – time –
Variant 14. The power method
1. Initial level. Create a console program that finds the eigenvalue of largest magnitude of a
2. Basic level. Create a console program that prompts for the matrix size and the tolerance, validates the input, generates a random symmetric matrix, and finds its eigenvalue of largest magnitude by the power method with vector normalization until the Rayleigh quotient converges. Matrix–vector multiplication and the norm are computed in parallel; the program prints an “iteration – estimate – change” table every 10 iterations and the time.
3. Advanced level. Create a power console application that reads a matrix from a CSV file or generates it (--random <n>), finds the largest eigenvalue by the power method and the smallest by inverse iteration (solving the system by the conjugate gradient method for symmetric matrices), measures the time with different thread counts (--threads), and accepts --help. A nonsymmetric matrix for inverse iteration produces a warning; file errors use exit code 2.
Variant 15. Spline interpolation
1. Initial level. Create a console program that builds a cubic spline from 1000 nodes of the function Parallel.For, printing the largest error relative to Math.Sin and the time.
2. Basic level. Create a console program that prompts for the number of nodes and the number of evaluation points, validates the input, builds a natural cubic spline (tridiagonal algorithm) for the function
3. Advanced level. Create a spline console application that reads nodes from a CSV file, takes evaluation points from another file or from the option --grid a:b:n, evaluates the spline in parallel with three distributions of points (block, cyclic, sorted points in blocks), and compares their times. Options: --threads, --output, --help; unordered or duplicate nodes produce a message in the error stream and exit code 2.
Variant 16. The least squares method
1. Initial level. Create a console program that generates 10,000,000 noisy points of
2. Basic level. Create a console program that prompts for the degree of the polynomial (1 to 8) and the number of points, validates the input, generates noisy points of a given polynomial, and fits them with a polynomial by the least squares method: it computes the matrix of the normal equations (the sums
3. Advanced level. Create an lsq console application that reads points from a CSV file (columns x, y), builds an approximation by a polynomial of degree --degree or by a sum of functions from the option --basis sin,cos,exp, computes the normal equations in parallel, prints the coefficients, the error, and the time for different thread counts, and writes a table of residuals to CSV. Option --help; an ill-conditioned system produces a warning, and file errors use exit code 2.
Variant 17. A pendulum for many initial conditions
1. Initial level. Create a console program that solves the equation of a simple pendulum
2. Basic level. Create a console program that prompts for the damping coefficient, the integration step, and the number of initial velocities, validates the input, and for each velocity integrates the equation of a damped pendulum until it stops, counting the full revolutions. The program compares the block and dynamic distributions of tasks and prints the time and speedup.
3. Advanced level. Create a pendulum-map console application that, for a damped pendulum (--gamma, --size, --step, --schedule block|cyclic|dynamic, --threads, and --help. The program writes the map to PGM and a table of thread times (min/max/mean) to CSV. A step that produces a noticeable energy error without damping (checked with
Variant 18. The predator–prey model
1. Initial level. Create a console program that solves the Lotka–Volterra system
2. Basic level. Create a console program that prompts for the ranges of the parameters + and -) and the time.
3. Advanced level. Create a lotka console application that solves the Lotka–Volterra predator–prey model (--a, --b, --c, --d, determines the period and amplitude of the oscillations of each trajectory, writes the results to CSV, compares static and dynamic distributions of tasks, and prints a time table. Option --help; negative parameters use exit code 1.
Variant 19. Projectile motion with air resistance
1. Initial level. Create a console program that, for launch angles from 1° to 89° in steps of 1°, integrates in parallel the motion of a body with quadratic air resistance (Runge–Kutta 4,
2. Basic level. Create a console program that prompts for the initial velocity, the drag coefficient, and the distance to the target, validates the input, and, by a parallel search over 100,000 angles, finds the angles at which the body hits the target to within 0.1 m. The program prints the angles found, the flight time, and the computation time.
3. Advanced level. Create a ballistics console application that, with the options --v0, --drag, --target, --wind, --resolution, and --help, builds a range table for a grid (angle, velocity) in parallel, finds the minimum velocity to hit the target for each angle, writes the table to CSV, and prints the time of the sequential and parallel versions. An unreachable target produces a message in the error stream and exit code 2.
Variant 20. The spread of an epidemic (SIR)
1. Initial level. Create a console program that solves the SIR model (
2. Basic level. Create a console program that prompts for the ranges of
3. Advanced level. Create a sir console application that performs a parametric computation of the SEIR model on a parameter grid from the options, with dynamic load balancing (a counter or Parallel.For), writes the peak and the duration for each parameter pair to CSV, and prints the time of each distribution and the 10 worst scenarios. Option --help; parameters outside
Variant 21. The 1D heat equation
1. Initial level. Create a console program that solves the heat equation Parallel.For over the nodes at each step, and prints the temperature at the middle of the rod and the time.
2. Basic level. Create a console program that prompts for the number of nodes, steps, and threads, checks the stability condition Barrier after each step. The program prints the time and compares the result with the sequential version.
3. Advanced level. Create a heat1d console application that solves the heat equation with boundary conditions from the options and compares three approaches: a new Parallel.For at each step, separate threads with a Barrier, and separate threads that synchronize once every --help; an unstable step uses exit code 1.
Variant 22. Computing π with series
1. Initial level. Create a console program that computes Partitioner.Create ranges and local sums), and prints the value, the error, and the time.
2. Basic level. Create a console program that prompts for the number of terms and the number of threads, validates the input, and computes
3. Advanced level. Create a pi-series console application that computes --series) with --terms terms and investigates the effect of the summation order on the error (--order forward|backward|pairwise, as well as Kahan summation) and the speedup for --threads. The program prints and writes to CSV a “series – order – value – error – time – --help; more than
Variant 23. Fibonacci numbers and DAGs
1. Initial level. Create a console program that computes Parallel.Invoke for the two calls down to depth 10, counts the number of calls (work) and the recursion depth (span), and prints them, the parallelism, and the time.
2. Basic level. Create a console program that prompts for Parallel.Invoke down to the threshold, and prints the work
3. Advanced level. Create a dag console application that reads a task graph from a file (each line is “name duration dependencies”), computes the work, the span, and the critical path, simulates a greedy scheduler for --procs 1,2,4,8) and prints a text Gantt chart, and also executes the graph with real TPL tasks using Task.Delay. Cycles in the graph produce a message in the error stream and exit code 2.
Variant 24. Reduction trees and PRAM
1. Initial level. Create a console program that simulates an EREW PRAM for the sum of 16 numbers: at each step, it prints which processors read and write which cells, and checks that no cell is read by two processors simultaneously.
2. Basic level. Create a console program that prompts for the number of values Parallel.For at each step) finding the sum and the maximum by a tree in
3. Advanced level. Create a pram console application that simulates programs for the EREW, CREW, and CRCW PRAM (sum, maximum in --model, --n, --trace, and --help. The program counts the steps and operations, detects violations of the model’s access rules, and prints them to the error stream; violations produce exit code 3.
Variant 25. BSP supersteps
1. Initial level. Create a console program that, on 4 separate threads with a Barrier, performs 5 BSP supersteps: each thread adds the value received from its left neighbor to its own value and sends the result to its right neighbor; the program prints the state after each superstep.
2. Basic level. Create a console program that prompts for the number of processors Barrier. The program prints
3. Advanced level. Create a bsp console application that provides “processor” and “message” classes for BSP programs on threads (Send, Sync, received messages), counts --p, --n, --g, --l, --help; the program compares the prediction
Variant 26. Load balancing
1. Initial level. Create a console program that tests the numbers from 1 to 20,000,000 for primality by trial division with a block distribution on 8 threads and with a dynamic Interlocked.Increment counter with chunks of 1000 numbers, printing the number of primes and the time of both approaches.
2. Basic level. Create a console program that prompts for the number of tasks and the distribution law of their durations (uniform, increasing, random), validates the input, and executes the computational tasks with the block, cyclic, and dynamic distributions. The program prints a “distribution – time –
3. Advanced level. Create a balance console application that compares the block and cyclic distributions, a counter with --chunk chunks, master–worker with a channel (System.Threading.Channels), and Parallel.For for tasks from a file (the duration or parameter of each task), writes the time of each thread to CSV, and prints a summary table. Option --help; an empty file uses exit code 2.
Variant 27. A grid scheduler (simulation)
1. Initial level. Create a console program that simulates 3 organizations (clusters with 16, 32, and 8 cores) and 200 jobs with a random number of cores and duration, assigns the jobs greedily to the resource with the shortest wait, and prints the completion time of all jobs.
2. Basic level. Create a console program that reads a description of the resources of three organizations and a list of jobs with requirements (cores, memory, virtual organization), validates the data, and simulates a grid broker: a job goes only to resources of its own VO. The program prints the schedule, the load of each resource, and the average waiting time.
3. Advanced level. Create a gridsim console application that simulates a grid with resources, virtual organizations, and access policies from a JSON file, compares broker strategies (--policy random|least-queue|best-fit), and runs the simulation in parallel for several generator seeds. The program prints a “strategy – average wait – load” table and accepts --help; invalid JSON uses exit code 2.
Variant 28. Volunteer computing (simulation)
1. Initial level. Create a console program that simulates a server with 1000 work units (testing numbers from a range for primality) and 8 client threads that take units from a ConcurrentQueue, compute them, and return the results; the program prints the number of primes and the contribution of each client.
2. Basic level. Create a console program that prompts for the number of clients, the probability of an erroneous result, and the quorum (2 or 3), validates the input, and simulates a volunteer computing server: each work unit is issued to several clients, and a result is accepted when a quorum of answers agrees. The program prints the number of reissues and detected errors.
3. Advanced level. Create a volunteer console application that simulates a server and clients with failures (disappearance, slowness, wrong results), deadlines, and reissuing of work units, with the options --clients, --units, --failure, --quorum, --deadline, and --help. The program prints the completion time and the share of redundant computation, and writes an event log to a file. Invalid probabilities use exit code 1.
Variant 29. Speedup prediction
1. Initial level. Create a console program that multiplies
2. Basic level. Create a console program that prompts for the matrix size and a list of thread counts, validates the input, measures the model parameters (the time of one multiply–add operation, the time of an empty Parallel.For), and for matrix multiplication with stripes prints a table of predicted and measured speedup and efficiency.
3. Advanced level. Create a predict console application that, for matrix multiplication (stripes, the checkerboard scheme, Cannon), measures the model parameters (an operation, copying a block, a barrier, memory bandwidth), builds a prediction for sizes --sizes and threads --threads, compares it with the measurements, computes the Karp–Flatt metric, and writes the table to CSV. Option --help; a prediction discrepancy of more than 50% is flagged with a warning.
Variant 30. Isoefficiency
1. Initial level. Create a console program that computes the sum of an array of
2. Basic level. Create a console program that prompts for a target efficiency (0.3 to 0.9), validates the input, and for
3. Advanced level. Create an isoefficiency console application that experimentally determines the isoefficiency function for three algorithms (sum, matrix–vector multiplication with stripes, matrix multiplication) by a binary search on the problem size, writes the points --target, --threads, --help.
Procedure
- Study the theory and worked examples.
- For your variant, perform an analysis using the PCAM methodology: identify the primitive tasks, the communication between them, the agglomeration method, and the distribution among threads (static or dynamic); estimate the work and span of the algorithm.
- Create a .NET 10 console project in JetBrains Rider; implement a sequential version, a parallel version, and a check of the result against a reference (with a tolerance for floating-point numbers; for numerical methods, against the exact solution or an error estimate by Runge’s rule).
- Build an execution time model, measure its parameters (the time of one operation, of synchronization, memory bandwidth), and compute the predicted speedup.
- Measure the time in the Release configuration (warmup, median of at least 5 runs) for 1, 2, 4, 8, and 16 threads, write the table to CSV, and plot the predicted and measured speedup in Excel or LibreOffice Calc; explain the discrepancies.
- Demonstrate the program, explain the code, the model, and the measurement results, and answer the review questions.