-
C언어] ❤️OpenMP를 사용해서 내 컴퓨터의 가능한 Threads숫자 알아보기코딩Coding/C++__C언어 2022. 6. 29. 00:17728x90
https://www.geeksforgeeks.org/openmp-introduction-with-installation-guide/amp/
getthread_parallel.c#include <omp.h> #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int nthreads, tid; #pragma omp parallel private(nthreads, tid) { tid = omp_get_thread_num(); printf("Welcome to GFG from thread = %d \n", tid); if (tid == 0) { nthreads = omp_get_num_threads(); printf("Number of threads = %d \n", nthreads); } } }
gcc -o gfg -fopenmp getthread_parallel.c ls README.md getthread_parallel.c omp.cpp omp_helloworld.c fibo.c gfg omp_fibo_parallel.cpp threads.cpp ./gfg Welcome to GFG from thread = 2 Welcome to GFG from thread = 4 Welcome to GFG from thread = 1 Welcome to GFG from thread = 0 Number of threads = 8 Welcome to GFG from thread = 6 Welcome to GFG from thread = 5 Welcome to GFG from thread = 3 Welcome to GFG from thread = 7
다른 글 보기
Rust연습❤️
내 컴퓨터에 병렬 실행 가능한 코어수 알아보기
available_parallelism -
https://economiceco.tistory.com/m/14302
반응형'코딩Coding > C++__C언어' 카테고리의 다른 글
C언어 표준함수에 대해 잘 정리됨❤️ (0) 2022.06.29 C++❤️SDL2개발 환경 세팅 (0) 2022.06.29 Learn C++❤️in 31 hours 👍⭐️& c++20 Tutorial (0) 2022.06.29 openmpi❤️_설명서 (0) 2022.06.29 C++❤️)OpenMP - examples(g++ -fopenmp hello.cpp -o hello (0) 2022.06.28 C언어❤️) clock()함수로 프로그램 수행 시간 구하기 (0) 2022.06.28 Parallel programming in C++ ❤️with OpenMP (Visual Studio tutorial) (0) 2022.06.28 OpenMP Parallel Programming Full Course: 5 Hours (0) 2022.06.28