We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
failed when num_threads > 5
// Copyright (c) 2018 Tianyi Zhang // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include <stdio.h> #include <omp.h> int x = 0, y = 0, Global = 0; #pragma omp threadprivate(x, y) float get_int() { Global += 1; return Global; } void use_int(int f, int t) { printf("Value = %d, thread = %d\n", f, t); } int main() { printf("call CopyPrivate from a single thread\n"); #pragma omp single copyprivate(x, y) { x = get_int(); y = get_int(); } use_int(x, omp_get_thread_num()); use_int(y, omp_get_thread_num()); printf("call CopyPrivate from a parallel region\n"); #pragma omp parallel { #pragma omp single copyprivate(x, y) { x = get_int(); y = get_int(); } use_int(x, omp_get_thread_num()); use_int(y, omp_get_thread_num()); } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
failed when num_threads > 5
The text was updated successfully, but these errors were encountered: