Re: C++ OpenMP 多CPU同時處理可能的問題

看板Programming作者 (陳揚和)時間15年前 (2010/05/20 11:15), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串5/7 (看更多)
I just test the method to let every CPU go through the whole array but in charge of different part of coutners. It is actully even slower than use one CPU. Still thanks dryman's reply even it is not correct. ※ 引述《sorryChen (陳揚和)》之銘言: : 感謝回覆 可是我沒有看懂耶 外面64個迴圈不用OpenMp然後裡面才用?? : 然後裡面才用 可以在指點一下嗎? : 有人建議我說 說不定一個CPU負責 一部分的counter 可能會比叫快 : 這樣雖然每個CPU都要把整個array讀一次 : 但是可能就不用只需要cache 一部分counter 到cache.. : ※ 引述《sorryChen (陳揚和)》之銘言: : : 我有一個很大的array大概是 3G 個數(其實是Human Genome) : : 我想要用多個CPU同時bucket這些數到 64 million個 bucket : : 一個簡單的sudo code 大概是這樣 : : int array[3G]; : : int counters[64M]; : : for( int i = 0; i < 3G; i++) { : : counter[array[i] % 64M] ++; : : } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 128.125.87.33

05/20 11:37, , 1F
真的是獻醜了:P
05/20 11:37, 1F
※ 編輯: sorryChen 來自: 128.125.87.33 (05/21 04:58)
文章代碼(AID): #1BzAbLuk (Programming)
討論串 (同標題文章)
文章代碼(AID): #1BzAbLuk (Programming)