Skip to content

CEN310 Parallel Programming

Week-14 (Quiz-2)

Spring Semester, 2024-2025


Quiz-2 Information

Date and Time

  • Date: May 16, 2025
  • Time: 09:00-12:00 (3 hours)
  • Location: Regular classroom

Format

  • Written examination
  • Mix of theoretical and practical questions
  • Both closed and open-ended questions

Topics Covered

1. GPU Programming

  • CUDA Architecture
  • Memory Hierarchy
  • Thread Organization
  • Performance Optimization

2. Advanced Parallel Patterns

  • Pipeline Processing
  • Task Parallelism
  • Data Parallelism
  • Hybrid Approaches

3. Real-world Applications

  • Scientific Computing
  • Data Processing
  • Matrix Operations
  • N-body Simulations

Sample Questions

Theoretical Questions

  1. Explain CUDA memory hierarchy and its impact on performance.
  2. Compare different parallel patterns and their use cases.
  3. Describe optimization strategies for GPU programs.

Practical Problems

// Question 1: What is the output of this CUDA program?
__global__ void kernel(int* data) {
    int idx = threadIdx.x;
    __shared__ int shared_data[256];

    shared_data[idx] = data[idx];
    __syncthreads();

    if(idx < 128) {
        shared_data[idx] += shared_data[idx + 128];
    }
    __syncthreads();

    if(idx == 0) {
        data[0] = shared_data[0];
    }
}

int main() {
    int* data;
    // ... initialization code ...
    kernel<<<1, 256>>>(data);
    // ... cleanup code ...
}

Preparation Guidelines

1. Review Materials

  • Lecture slides and notes
  • Lab exercises
  • Sample codes
  • Practice problems

2. Focus Areas

  • CUDA Programming
  • Memory Management
  • Performance Optimization
  • Real-world Applications

3. Practice Exercises

  • Write and analyze CUDA programs
  • Implement parallel patterns
  • Optimize existing code
  • Measure performance

Quiz Rules

  1. Materials Allowed
  2. No books or notes
  3. No electronic devices
  4. Clean paper for scratch work

  5. Time Management

  6. Read all questions carefully
  7. Plan your time for each section
  8. Leave time for review

  9. Answering Questions

  10. Show all your work
  11. Explain your reasoning
  12. Write clearly and organize your answers

Grading Criteria

Distribution

  • Theoretical Questions: 40%
  • Practical Problems: 60%

Evaluation

  • Understanding of concepts
  • Problem-solving approach
  • Code analysis and writing
  • Performance considerations
  • Clear explanations

Additional Resources

Review Materials

Sample Code Repository

  • Course GitHub repository
  • Example implementations
  • Performance benchmarks

Contact Information

For any questions about the quiz:


Good Luck!