OpenMP

OpenMP
원저자OpenMP 아키텍처 리뷰 보드[1]
개발자OpenMP 아키텍처 리뷰 보드[2]
안정화 버전
6.0 / 2024년 11월(1년 전)(2024-11)
프로그래밍 언어C, C++, 포트란
운영 체제크로스 플랫폼
플랫폼크로스 플랫폼
종류API
라이선스다양함[3]
웹사이트openmp.org

OpenMP(Open Multi-Processing, 오픈MP)는 공유 메모리 다중 처리 프로그래밍 API로, C, C++, 포트란 언어와, 유닉스마이크로소프트 윈도우 플랫폼을 비롯한 여러 플랫폼을 지원한다.

병렬 프로그래밍의 하이브리드 모델로 작성된 응용 프로그램은 OpenMP와 메시지 전달 인터페이스 (MPI)를 둘 다 사용하거나, 더 투명성 있는 방식으로 비공유 메모리 시스템을 위한 OpenMP 확장을 사용하여 컴퓨터 클러스터 상에서 구동할 수 있다.

역사

OpenMP 아키텍처 리뷰 보드(ARB)는 최초의 API 규격인 포트란 1.0용 OpenMP를 1997년 10월에 출판하였다. C/C++용 OpenMP는 1998년 10월에 공개하였는데, 2000년 11월에 포트란 버전으로 2.0이 나온 다음 2002년 3월에 C/C++ 규격으로 2.0 버전이 출시되었다. 2005년 5월에 발표된 버전 2.5부터는 C/C++/포트란 규격이 통합되었다. 2008년 5월에 버전 3.0, 2013년 7월에 버전 4.0, 2015년 11월에 버전 4.5, 2018년 11월에 버전 5.0이 발표되었다.[4]

2019년 기준으로, 버전 2.5 이하를 레거시 사양으로 취급하고 있다.

주요 요소

OpenMP의 구조.

예제 프로그램

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

 int main (int argc, char *argv[]) {
   int th_id, nthreads;
   #pragma omp parallel private(th_id)
   {
     th_id = omp_get_thread_num();
     printf("Hello World : 스레드 %d\n", th_id);
     #pragma omp barrier
     if ( th_id == 0 ) {
       nthreads = omp_get_num_threads();
       printf("모두 %d 개의 스레드가 있습니다\n",nthreads);
     }
   }
   return EXIT_SUCCESS;
 }
#include <omp.h>
#include <iostream>
#include <sstream>
int main (int argc, char *argv[]) {
 int th_id, nthreads;
#pragma omp parallel private(th_id)
 {
  th_id = omp_get_thread_num();
  std::ostringstream ss;
  ss << "Hello World : 스레드 " << th_id << std::endl;
  std::cout << ss.str();
#pragma omp barrier
#pragma omp master
  {
   nthreads = omp_get_num_threads();
   std::cout << "모두 " << nthreads << "개의 스레드가 있습니다" << std::endl;
  }
 }
 return 0;
}
      PROGRAM HELLO
      INTEGER ID, NTHRDS
      INTEGER OMP_GET_THREAD_NUM, OMP_GET_NUM_THREADS
C$OMP PARALLEL PRIVATE(ID)
      ID = OMP_GET_THREAD_NUM()
      PRINT *, 'HELLO WORLD : 스레드', ID
C$OMP BARRIER
      IF ( ID .EQ. 0 ) THEN
        NTHRDS = OMP_GET_NUM_THREADS()
        PRINT *, '모두', NTHRDS, '개의 스레드가 있습니다'
      END IF
C$OMP END PARALLEL
      END
 program hello90
 use omp_lib
 integer:: id, nthreads
   !$omp parallel private(id)
   id = omp_get_thread_num()
   write (*,*) 'Hello World : 스레드', id
   !$omp barrier
   if ( id == 0 ) then
     nthreads = omp_get_num_threads()
     write (*,*) '모두', nthreads, '개의 스레드가 있습니다'
   end if
   !$omp end parallel
 end program

같이 보기

각주

  1. http://openmp.org/wp/about-openmp/ 보관됨 2013-08-09 - 웨이백 머신 About the OpenMP ARB and OpenMP.org
  2. http://openmp.org/wp/about-openmp/ 보관됨 2013-08-09 - 웨이백 머신 About the OpenMP ARB and OpenMP.org
  3. http://openmp.org/wp/openmp-compilers/ OpenMP Compilers
  4. OpenMP 버전별 사양

외부 링크

  • (영어) OpenMP - 공식 웹사이트

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.