The bottleneck was not only computation
An algorithm can remain unchanged while the system around it crosses a resource boundary and becomes a different performance problem.
BLAST compares nucleotide or protein queries with databases of known sequences. In the memory-limited environment studied in 2002, performance was strong while the database could remain in physical memory. Once it grew beyond that boundary, the operating system repeatedly moved pages between memory and disk. CPU time was no longer the complete story; disk waiting and page replacement had entered the critical path.
Do not partition only because processors are available. Partition so that each processor receives a working set its memory can hold.
A memory-aware parallel architecture
The database was divided into partitions sized for the memory available at each processing node. Every node searched its partition concurrently, after which the partial matches were gathered into a complete result. This produced two gains at once: comparison work was distributed, and the working set on each node could remain resident in memory.
Correctness still required complete coverage, meaningful global ranking, balanced work, memory-aware partition sizing and a merge step that did not discard significant matches. Parallelism was useful only if the scientific meaning of the original search survived.
Why speedup could become superlinear
With p processors, linear speedup is approximately p. Superlinear speedup means the measured ratio S(p) = T(1)/T(p) is greater than p. That sounds paradoxical only if we assume the parallel run is merely the serial run divided into equal CPU work.
In the single-node baseline, the database exceeded physical memory and incurred substantial swapping. After partitioning, each node operated on a smaller resident working set. The parallel system therefore removed a cost that existed disproportionately in the baseline. It did not create computation from nothing; it changed the machine's operating regime.
S(p) = T(1) / T(p) > pThis can occur when the swapping eliminated from the baseline is larger than the communication, coordination and merge overhead introduced by parallel execution.
The reported result belongs to the implemented 2002 memory-limited environment. Superlinear speedup is not guaranteed for every database, machine or node count. A reproducible comparison must state memory capacity, database and partition sizes, timing boundary, storage behaviour, communication cost and equivalence of returned results.
The enduring lesson is broader than BLAST: when a system crosses the memory hierarchy, performance engineering must reason about data placement as carefully as it reasons about the algorithm.
MSc research record
- Title: A Parallel Processing System for a BLAST Program
- Author: Warin Wattanapornprom
- Degree: M.Sc. in Computer Science
- Institution: Chulalongkorn University
- Academic year: 2002
- Advisor: Assoc. Prof. Prabhas Chongstitvatana
- Co-advisor: Dr. Natawut Nupairoj
- ISBN: 974-17-1195-6
คอขวดที่แท้จริงไม่ได้อยู่ที่การคำนวณเพียงอย่างเดียว
อัลกอริทึมอาจไม่ได้เปลี่ยน แต่เมื่อระบบข้ามข้อจำกัดของทรัพยากร ปัญหาด้านประสิทธิภาพอาจเปลี่ยนไปเป็นอีกปัญหาหนึ่ง
BLAST ใช้เปรียบเทียบลำดับนิวคลีโอไทด์หรือโปรตีนกับฐานข้อมูลลำดับที่เรารู้จัก ในสภาพแวดล้อมที่มีหน่วยความจำจำกัดซึ่งผมศึกษาในปี 2002 ระบบทำงานได้ดีเมื่อฐานข้อมูลอยู่ในหน่วยความจำได้ทั้งหมด แต่เมื่อฐานข้อมูลมีขนาดใหญ่เกินขอบเขตนั้น ระบบปฏิบัติการต้องย้าย page ระหว่างหน่วยความจำและดิสก์ซ้ำ ๆ เวลาที่ใช้จึงไม่ได้เกิดจากการเปรียบเทียบลำดับเพียงอย่างเดียว การรอดิสก์และการแทนที่ page กลายเป็นส่วนสำคัญของเส้นทางการทำงาน
อย่าแบ่งงานเพียงเพราะเรามีหลายหน่วยประมวลผล แต่ควรแบ่งข้อมูลเพื่อให้แต่ละหน่วยประมวลผลได้รับ working set ที่หน่วยความจำของตนรองรับได้
สถาปัตยกรรมขนานที่ออกแบบจากข้อจำกัดของหน่วยความจำ
ฐานข้อมูลถูกแบ่งเป็นส่วนย่อยตามขนาดหน่วยความจำที่ใช้ได้จริงของแต่ละโหนด ทุกโหนดค้นหาส่วนของตนพร้อมกัน แล้วจึงรวบรวมผลลัพธ์ย่อยกลับเป็นผลลัพธ์สมบูรณ์ วิธีนี้สร้างประโยชน์สองชั้นพร้อมกัน คือกระจายงานเปรียบเทียบไปยังหลายหน่วยประมวลผล และทำให้ working set ของแต่ละโหนดมีโอกาสคงอยู่ในหน่วยความจำ
ความถูกต้องยังต้องอาศัยการค้นหาครบทุกส่วน การรักษาความหมายของลำดับผลลัพธ์ การกระจายภาระงานที่สมดุล การกำหนดขนาด partition จากหน่วยความจำจริง และการรวมผลที่ไม่ทำให้ match สำคัญหายไป ความขนานมีคุณค่าก็ต่อเมื่อความหมายทางวิทยาศาสตร์ของการค้นหาเดิมยังคงอยู่
เหตุใด speedup จึงสูงกว่าเชิงเส้นได้
เมื่อใช้หน่วยประมวลผล p ตัว linear speedup มีค่าประมาณ p ส่วน superlinear speedup คือกรณีที่อัตราส่วนที่วัดได้ S(p) = T(1)/T(p) มีค่ามากกว่า p สิ่งนี้จะดูขัดกับสัญชาตญาณก็ต่อเมื่อเราคิดว่าการทำงานแบบขนานเป็นเพียงการนำงานเดิมมาแบ่งเป็นส่วน CPU เท่า ๆ กัน
ในการทดลองฐาน โหนดเดียวต้องค้นหาฐานข้อมูลที่ใหญ่กว่าหน่วยความจำจริง จึงเสียเวลาให้กับ swapping อย่างมาก หลังการแบ่งฐานข้อมูล แต่ละโหนดทำงานกับข้อมูลส่วนที่เล็กลงและสามารถคงอยู่ในหน่วยความจำ ระบบขนานจึงไม่ได้เพียงแบ่งต้นทุนเดิม แต่ตัดต้นทุนก้อนหนึ่งซึ่งเกิดกับระบบฐานออกไปด้วย
S(p) = T(1) / T(p) > pผลเช่นนี้เกิดขึ้นได้เมื่อเวลาของ swapping ที่หายไปจากระบบฐาน มากกว่าต้นทุนการสื่อสาร การประสานงาน และการรวมผลที่ระบบขนานเพิ่มเข้ามา
ผลที่รายงานเป็นของระบบที่สร้างและทดลองในสภาพแวดล้อมหน่วยความจำจำกัดเมื่อปี 2002 ไม่ได้หมายความว่า Parallel BLAST ทุกระบบจะได้ superlinear speedup การเปรียบเทียบที่ตรวจสอบได้ควรระบุขนาดหน่วยความจำ ฐานข้อมูล partition ขอบเขตการจับเวลา พฤติกรรมของ storage ต้นทุนการสื่อสาร และความเทียบเท่าของผลลัพธ์
บทเรียนที่ยังใช้ได้กว้างกว่า BLAST คือ เมื่อระบบเคลื่อนข้ามลำดับชั้นของหน่วยความจำ เราต้องให้ความสำคัญกับตำแหน่งของข้อมูลไม่น้อยไปกว่าตัวอัลกอริทึม
ข้อมูลผลงานระดับปริญญาโท
- ชื่อเรื่อง: A Parallel Processing System for a BLAST Program
- ผู้วิจัย: Warin Wattanapornprom
- ระดับการศึกษา: วิทยาศาสตรมหาบัณฑิต สาขาวิทยาการคอมพิวเตอร์
- สถาบัน: จุฬาลงกรณ์มหาวิทยาลัย
- ปีการศึกษา: 2002
- อาจารย์ที่ปรึกษา: รศ. ดร. ประภาส จงสถิตย์วัฒนา
- อาจารย์ที่ปรึกษาร่วม: ดร. ณัฐวุฒิ หนูไพโรจน์
- ISBN: 974-17-1195-6