File: openmp.cc

package info (click to toggle)
testsweeper 2025.05.28-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 500 kB
  • sloc: cpp: 2,036; python: 1,296; makefile: 5
file content (21 lines) | stat: -rw-r--r-- 574 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright (c) 2017-2023, University of Tennessee. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause
// This program is free software: you can redistribute it and/or modify it under
// the terms of the BSD 3-Clause license. See the accompanying LICENSE file.

#include <omp.h>
#include <stdio.h>

int main()
{
    int nthreads = 1;
    int tid = 0;
    #pragma omp parallel
    {
        nthreads = omp_get_max_threads();
        tid = omp_get_thread_num();
        printf( "tid %d, nthreads %d\n", tid, nthreads );
    }
    printf( "ok\n" );
    return 0;
}