Thông tin

Tác giả Erik-Jan Lingen, Matthias Möller
Hạn chót Không có hạn chót
Giới hạn nộp bài Không có giới hạn

Đăng nhập

[OpenMP] Solution 10 : Binary Search

This material is part of the course Practical Introduction to Parallel Programming and meant for educational purposes only.


Task

Implement a program that uses tasks to execute a binary search algorithm in parallel. Use the sequential implementation below as the basis of your program. Print the number of the thread that has found the value in the tree.

Hints

The binary tree is not sorted; a value can be located in the left or right sub-tree of a node. You must search both sub-trees.

Do not forget to indicate which variables are private and which are shared.

Can you verify that the search operation is executed in parallel?

What happens if you vary the maximum number of threads through the environment variable OMP_NUM_THREADS?


Câu hỏi 1: Binary Search
Câu hỏi 2: OpenMP environment variables

Specify the OpenMP environment variables that should be used for running your program (export OMP_NUM_THREADS=1 ...). Use semicolons to separate multiple variables

Câu hỏi 3: Command Line Argument

Specify the command line arguments that should be passed to your program when it is run. Arguments must be given in quotes and separated by commas. Leave this filed empty if you do not want to specify command line arguments.

Example: "1","int","arg=2" is interpreted as three arguments 1, int, and arg=2.