2014-04-14 2 views
2

병렬 처리에 익숙하지 않고 C++로 HPX에 로프를 익히는 것에 익숙합니다.병렬 처리의 지역

hello world from OS-thread 1 on locality 0 
hello world from OS-thread 1 on locality 1 
hello world from OS-thread 0 on locality 0 
hello world from OS-thread 0 on locality 1 

내 질문은, 지역 X에 때 프로그램 출력 이다 : 나는 모든 지역의 모든 OS 스레드에 hello world을 인쇄 할 특정 안녕하세요 단어 예제를 찾고 있어요, 일부 출력은 같을 것이다 정확히 지역적 의미는 무엇입니까? 나는 OS 쓰레드를 이해하고 있지만 어떤 프로그램이 어떤 지역에서 무엇을 의미하는지 잘 모르겠습니다.

일부 코드의 예는 HPX main이지만 내 질문에는 반드시 필요한 것은 아니지만 주제와 관련된 지역을 찾는 전화가 여러 번 포함됩니다.

int hpx_main() 
{ 
    { 
     // Get a list of all available localities. 
     std::vector<hpx::naming::id_type> localities = 
      hpx::find_all_localities(); 

     // Reserve storage space for futures, one for each locality. 
     std::vector<hpx::lcos::future<void> > futures; 
     futures.reserve(localities.size()); 

     BOOST_FOREACH(hpx::naming::id_type const& node, localities) 
     { 
      // Asynchronously start a new task. The task is encapsulated in a 
      // future, which we can query to determine if the task has 
      // completed. 
      typedef hello_world_foreman_action action_type; 
      futures.push_back(hpx::async<action_type>(node)); 
     } 

     // The non-callback version of hpx::lcos::wait takes a single parameter, 
     // a future of vectors to wait on. hpx::lcos::wait only returns when 
     // all of the futures have finished. 
     hpx::lcos::wait(futures); 
    } 

    // Initiate shutdown of the runtime system. 
    return hpx::finalize(); 
} 

답변

4

문서에서 알 수 있듯이 지역 정보를 응용 프로그램을 실행하는 프로세스의 수로 처리 할 수 ​​있습니다.
두 서버가 프로그램을 실행한다고 가정하면 첫 번째 프로그램은 지역 0을 실행하고 두 번째 지역은 1을 실행합니다.
동일한 코드를 실행하는 프로세스가 서버 (지역 0) 및 클라이언트 (지역 1)입니다.

또한 각 프로세스는 os_threads 수로 볼 수있는 여러 스레드를 실행할 수 있습니다. http://stellar.cct.lsu.edu/files/hpx_0.8.1/docs/hpx/tutorial/examples/hello_world.html

과 명령 행 옵션 : http://stellar.cct.lsu.edu/files/hpx_0.8.1/docs/hpx/tutorial/getting_started/unix_pbs.html

내가 가장 좋은 방법은 그것을 이해 생각이 여러 지방을 사용하는 방법에 대한 설명이 http://stellar.cct.lsu.edu/files/hpx_0.8.1/docs/hpx/tutorial/getting_started/commandline.html

입니다

는 예를 따라 --hpx : node 및 --hpx : threads 값으로 재생하는 것입니다.

는 또한 - 나는

내가 도움이되지 확실하지만, 나는 내가 한 희망 ...하는 openmpi 문서는 용어를 이해하기위한 좀 더 나은 생각합니다.

+0

그래서 코드가'hpx :: find_all_localities();'를 호출하면 프로그램에 사용할 수있는 모든 사용 가능한 프로세스를 찾고 있습니까? –

+0

나는 그것을 발견했을 때부터 말하고 싶지 않다. 코드를 실행하는 이미 알려진 프로세스의 ID를 검사한다고 말하고 싶습니다. – evenro