SlideShare a Scribd company logo
Distributed Multi-Threading
       in GNU Prolog
      Nuno Morgadinho, Salvador Abreu
          {nm, spa}@di.uevora.pt




             Departamento de Informática


                     Évora 2007
Introduction



          •   Distributed - one or more computers
              communicating over a network

          •   Multi-Threading - more than one thread of
              execution

          •   Thread - a flow of execution



Slide 2                                                   ICLP ’07 CICLOPS
Introduction



          •   Obtain results faster for problems where
              performance is critical

          •   The problem can be divided into smaller tasks
              which can be carried out simultaneously

          •   Parallelism



Slide 3                                                  ICLP ’07 CICLOPS
What We Present




          •   PM2 - a distributed multi-threading
              programming environment

          •   GNU Prolog - efficient native Prolog compiler

          •   Combination of both




Slide 4                                               ICLP ’07 CICLOPS
GNU Prolog and PM2: Why?




          •   GNU Prolog produces stand-alone executables

          •   The size of the executables is relatively small

          •   Doesn’t work with machine independent saved-
              states




Slide 5                                                   ICLP ’07 CICLOPS
Implementation



          •   Established a model for connecting PM2 and
              GNU Prolog

          •   The approach doesn’t involve modifications to
              GNU Prolog neither to PM2

          •   Compatibility with GNU Prolog libraries is
              retained



Slide 6                                                ICLP ’07 CICLOPS
Approach




          •   Tabard - new program that manages distributed
              instances of GNU Prolog engines

          •   pm2prolog - new library that allows the
              development of distributed multithreaded
              Prolog applications




Slide 7                                                  ICLP ’07 CICLOPS
Functionality


          •   Allow to execute computations remotely

          •   Manage the engines responsible for the
              computations

          •   Manage the communication involved between
              the several machines

          •   Based on distributed memory and explicit
              message-passing


Slide 8                                                ICLP ’07 CICLOPS
Example
          :- initialization(init).
          :- include('pm2prolog').

          % thread with rank 0
          init:-
            pm2_is_master, !,
            pm2_max_rank(MaxRank),
            start_prolog_workers(MaxRank),
            test_prolog_workers(MaxRank),
            read_test(MaxRank),
            stop_prolog_workers.

          % thread != 0
          init:-
            worker_code.

Slide 9                                      ICLP ’07 CICLOPS
Before Running




           •   Configuration that specifies the list of machines

           •   Each machine is mapped to one or more
               processing nodes or virtual processors (VPs)




Slide 10                                                      ICLP ’07 CICLOPS
Execution Model




           •   Binary is copied to all machines

           •   In VP0 (master) a gprolog engine is created

           •   In the other VPs (workers) a pthread in C is
               created and stands awaiting messages




Slide 11                                                 ICLP ’07 CICLOPS
Execution Model



           •   In the master, now in the Prolog thread, a
               predicate is called to send a message to every
               worker

           •   The workers receive the message, initiate a
               gprolog engine and the thread stands awaiting
               more messages to come



Slide 12                                                 ICLP ’07 CICLOPS
Execution Model




           •   In the master, work is distributed throughout
               the workers through message-passing

           •   The workers receive tasks which they execute
               locally. As soon as they finish, they send their
               results back to the master




Slide 13                                                 ICLP ’07 CICLOPS
Execution Model


           •   The master assembles the work results by
               reading as many messages as the number of
               previously sent messages

           •   The master redistributes work again or orders
               the workers to finish their execution

           •   The workers terminate

           •   The master reiniciates the workers or
               terminates itself

Slide 14                                               ICLP ’07 CICLOPS
Inside a Virtual Processor
             UNLOCK                Message Queue

           LOCK
                    WRITE                                 READ
                                                           WRITE



                                       ...
           C Thread Listener
                                                 Prolog Thread


            write_message_queue()               thread_send_message/2

                  Start_Prolog()                thread_get_message/2

                  Stop_Prolog()                      pm2_self/1

                      ...                              ...


                            RECEIVE                SEND

                                       SOCKET


Slide 15                                                                ICLP ’07 CICLOPS
•   Several VPs per physical machine is possible
                               Node 1              Node 2


                                                VP 2
                              VP 0                           Prolog
                                                              Proc


                                       Prolog
                                        Proc
                                                   Node 3
                              VP 1

                                                VP 2
                                       Prolog                Prolog
                                        Proc                  Proc


                                 ...
                                                       ...




Slide 16                                                              ICLP ’07 CICLOPS
ISO Support




           •   ISO/IEC Draft Technical Report 13211-5:2007,
               Prolog Multi-Threading Support

           •   Extensions to take into consideration remote
               threads




Slide 17                                               ICLP ’07 CICLOPS
PM2-Prolog Remote Threads




           •   thread_create/2
           •   vid(Rank, ThreadID)

                •   Rank - VP identifier

                •   ThreadID - identifier of the thread inside




Slide 18                                                  ICLP ’07 CICLOPS
Experimental Evaluation


                                100


                                 75


                                 50


                                 25


                                  0
                                       2004    2005    2006    2007




             Results obtained with 7x Intel(R) Pentium(R) 4 2.80 Mhz each, Hyperthreading
           enabled, 512 Mbytes each, Linux 2.4.19 kernel, 100 Mbits TCP/IP Ethernet network
Slide 19                                                                        ICLP ’07 CICLOPS
Conclusions



           •   We presented a distributed multi-threading
               GNU Prolog system on top of PM2

           •   First results show that it can obtain substantial
               speedups, even for real-world

           •   Proved the approach to be technically possible
               and can be of use to other implementers



Slide 20                                                   ICLP ’07 CICLOPS
Further Work


           •   Improving our proposal

           •   Extend the API with introspection and
               monitoring predicates

           •   Experiment with more programs and bigger
               configurations

           •   Build our own applications using this
               technology


Slide 21                                               ICLP ’07 CICLOPS

More Related Content

What's hot

Implement Checkpointing for Android (ELCE2012)
Implement Checkpointing for Android (ELCE2012)Implement Checkpointing for Android (ELCE2012)
Implement Checkpointing for Android (ELCE2012)
National Cheng Kung University
 
[Harvard CS264] 05 - Advanced-level CUDA Programming
[Harvard CS264] 05 - Advanced-level CUDA Programming[Harvard CS264] 05 - Advanced-level CUDA Programming
[Harvard CS264] 05 - Advanced-level CUDA Programming
npinto
 
Software Profiling: Understanding Java Performance and how to profile in Java
Software Profiling: Understanding Java Performance and how to profile in JavaSoftware Profiling: Understanding Java Performance and how to profile in Java
Software Profiling: Understanding Java Performance and how to profile in Java
Isuru Perera
 
Java in flames
Java in flamesJava in flames
Java in flames
Isuru Perera
 
Software Profiling: Java Performance, Profiling and Flamegraphs
Software Profiling: Java Performance, Profiling and FlamegraphsSoftware Profiling: Java Performance, Profiling and Flamegraphs
Software Profiling: Java Performance, Profiling and Flamegraphs
Isuru Perera
 
Java Performance & Profiling
Java Performance & ProfilingJava Performance & Profiling
Java Performance & Profiling
Isuru Perera
 
OpenStack and OpenFlow Demos
OpenStack and OpenFlow DemosOpenStack and OpenFlow Demos
OpenStack and OpenFlow Demos
Brent Salisbury
 
Implement Checkpointing for Android
Implement Checkpointing for AndroidImplement Checkpointing for Android
Implement Checkpointing for Android
National Cheng Kung University
 
Guides To Analyzing WebKit Performance
Guides To Analyzing WebKit PerformanceGuides To Analyzing WebKit Performance
Guides To Analyzing WebKit Performance
National Cheng Kung University
 
XT Best Practices
XT Best PracticesXT Best Practices
XT Best Practices
Jeff Larkin
 
Build Programming Language Runtime with LLVM
Build Programming Language Runtime with LLVMBuild Programming Language Runtime with LLVM
Build Programming Language Runtime with LLVM
National Cheng Kung University
 
Introduction to Android by Demian Neidetcher
Introduction to Android by Demian NeidetcherIntroduction to Android by Demian Neidetcher
Introduction to Android by Demian Neidetcher
Matthew McCullough
 
Memory, IPC and L4Re
Memory, IPC and L4ReMemory, IPC and L4Re
Memory, IPC and L4Re
Vasily Sartakov
 
Testing CAN network with help of CANToolz
Testing CAN network with help of CANToolzTesting CAN network with help of CANToolz
Testing CAN network with help of CANToolz
Alexey Sintsov
 
Introduction to FreeRTOS
Introduction to FreeRTOSIntroduction to FreeRTOS
Introduction to FreeRTOS
ICS
 
Qt Application Programming with C++ - Part 2
Qt Application Programming with C++ - Part 2Qt Application Programming with C++ - Part 2
Qt Application Programming with C++ - Part 2
Emertxe Information Technologies Pvt Ltd
 
Advanced Components on Top of L4Re
Advanced Components on Top of L4ReAdvanced Components on Top of L4Re
Advanced Components on Top of L4Re
Vasily Sartakov
 
SCALE 2011 Deploying OpenStack with Chef
SCALE 2011 Deploying OpenStack with ChefSCALE 2011 Deploying OpenStack with Chef
SCALE 2011 Deploying OpenStack with Chef
Matt Ray
 
Android Optimization: Myth and Reality
Android Optimization: Myth and RealityAndroid Optimization: Myth and Reality
Android Optimization: Myth and Reality
National Cheng Kung University
 
Introduction and Deep Dive Into Containerd
Introduction and Deep Dive Into ContainerdIntroduction and Deep Dive Into Containerd
Introduction and Deep Dive Into Containerd
Kohei Tokunaga
 

What's hot (20)

Implement Checkpointing for Android (ELCE2012)
Implement Checkpointing for Android (ELCE2012)Implement Checkpointing for Android (ELCE2012)
Implement Checkpointing for Android (ELCE2012)
 
[Harvard CS264] 05 - Advanced-level CUDA Programming
[Harvard CS264] 05 - Advanced-level CUDA Programming[Harvard CS264] 05 - Advanced-level CUDA Programming
[Harvard CS264] 05 - Advanced-level CUDA Programming
 
Software Profiling: Understanding Java Performance and how to profile in Java
Software Profiling: Understanding Java Performance and how to profile in JavaSoftware Profiling: Understanding Java Performance and how to profile in Java
Software Profiling: Understanding Java Performance and how to profile in Java
 
Java in flames
Java in flamesJava in flames
Java in flames
 
Software Profiling: Java Performance, Profiling and Flamegraphs
Software Profiling: Java Performance, Profiling and FlamegraphsSoftware Profiling: Java Performance, Profiling and Flamegraphs
Software Profiling: Java Performance, Profiling and Flamegraphs
 
Java Performance & Profiling
Java Performance & ProfilingJava Performance & Profiling
Java Performance & Profiling
 
OpenStack and OpenFlow Demos
OpenStack and OpenFlow DemosOpenStack and OpenFlow Demos
OpenStack and OpenFlow Demos
 
Implement Checkpointing for Android
Implement Checkpointing for AndroidImplement Checkpointing for Android
Implement Checkpointing for Android
 
Guides To Analyzing WebKit Performance
Guides To Analyzing WebKit PerformanceGuides To Analyzing WebKit Performance
Guides To Analyzing WebKit Performance
 
XT Best Practices
XT Best PracticesXT Best Practices
XT Best Practices
 
Build Programming Language Runtime with LLVM
Build Programming Language Runtime with LLVMBuild Programming Language Runtime with LLVM
Build Programming Language Runtime with LLVM
 
Introduction to Android by Demian Neidetcher
Introduction to Android by Demian NeidetcherIntroduction to Android by Demian Neidetcher
Introduction to Android by Demian Neidetcher
 
Memory, IPC and L4Re
Memory, IPC and L4ReMemory, IPC and L4Re
Memory, IPC and L4Re
 
Testing CAN network with help of CANToolz
Testing CAN network with help of CANToolzTesting CAN network with help of CANToolz
Testing CAN network with help of CANToolz
 
Introduction to FreeRTOS
Introduction to FreeRTOSIntroduction to FreeRTOS
Introduction to FreeRTOS
 
Qt Application Programming with C++ - Part 2
Qt Application Programming with C++ - Part 2Qt Application Programming with C++ - Part 2
Qt Application Programming with C++ - Part 2
 
Advanced Components on Top of L4Re
Advanced Components on Top of L4ReAdvanced Components on Top of L4Re
Advanced Components on Top of L4Re
 
SCALE 2011 Deploying OpenStack with Chef
SCALE 2011 Deploying OpenStack with ChefSCALE 2011 Deploying OpenStack with Chef
SCALE 2011 Deploying OpenStack with Chef
 
Android Optimization: Myth and Reality
Android Optimization: Myth and RealityAndroid Optimization: Myth and Reality
Android Optimization: Myth and Reality
 
Introduction and Deep Dive Into Containerd
Introduction and Deep Dive Into ContainerdIntroduction and Deep Dive Into Containerd
Introduction and Deep Dive Into Containerd
 

Similar to Distributed Multi-Threading in GNU-Prolog

Large customers want postgresql too !!
Large customers want postgresql too !!Large customers want postgresql too !!
Large customers want postgresql too !!
rosensteel
 
DPDK Integration: A Product's Journey - Roger B. Melton
DPDK Integration: A Product's Journey - Roger B. MeltonDPDK Integration: A Product's Journey - Roger B. Melton
DPDK Integration: A Product's Journey - Roger B. Melton
harryvanhaaren
 
Implementation of Soft-core processor on FPGA (Final Presentation)
Implementation of Soft-core processor on FPGA (Final Presentation)Implementation of Soft-core processor on FPGA (Final Presentation)
Implementation of Soft-core processor on FPGA (Final Presentation)
Deepak Kumar
 
Introduction to netlink in linux kernel (english)
Introduction to netlink in linux kernel (english)Introduction to netlink in linux kernel (english)
Introduction to netlink in linux kernel (english)
Sneeker Yeh
 
Lect06
Lect06Lect06
Lect06
Vin Voro
 
Kernel Recipes 2018 - Live (Kernel) Patching: status quo and status futurus -...
Kernel Recipes 2018 - Live (Kernel) Patching: status quo and status futurus -...Kernel Recipes 2018 - Live (Kernel) Patching: status quo and status futurus -...
Kernel Recipes 2018 - Live (Kernel) Patching: status quo and status futurus -...
Anne Nicolas
 
Applying the paradigms of core.async in Clojure and ClojureScript
Applying the paradigms of core.async in Clojure and ClojureScriptApplying the paradigms of core.async in Clojure and ClojureScript
Applying the paradigms of core.async in Clojure and ClojureScript
Julian Gamble
 
The pocl Kernel Compiler
The pocl Kernel CompilerThe pocl Kernel Compiler
The pocl Kernel Compiler
Clay (Chih-Hao) Chang
 
epoll() - The I/O Hero
epoll() - The I/O Heroepoll() - The I/O Hero
epoll() - The I/O Hero
Mohsin Hijazee
 
開放運算&GPU技術研究班
開放運算&GPU技術研究班開放運算&GPU技術研究班
開放運算&GPU技術研究班
Paul Chao
 
Lock free programming- pro tips
Lock free programming- pro tipsLock free programming- pro tips
Lock free programming- pro tips
Jean-Philippe BEMPEL
 
Kernel bug hunting
Kernel bug huntingKernel bug hunting
Kernel bug hunting
Andrea Righi
 
"Efficient Implementation of Convolutional Neural Networks using OpenCL on FP...
"Efficient Implementation of Convolutional Neural Networks using OpenCL on FP..."Efficient Implementation of Convolutional Neural Networks using OpenCL on FP...
"Efficient Implementation of Convolutional Neural Networks using OpenCL on FP...
Edge AI and Vision Alliance
 
Performance Optimization of SPH Algorithms for Multi/Many-Core Architectures
Performance Optimization of SPH Algorithms for Multi/Many-Core ArchitecturesPerformance Optimization of SPH Algorithms for Multi/Many-Core Architectures
Performance Optimization of SPH Algorithms for Multi/Many-Core Architectures
Dr. Fabio Baruffa
 
Introducing Container Technology to TSUBAME3.0 Supercomputer
Introducing Container Technology to TSUBAME3.0 SupercomputerIntroducing Container Technology to TSUBAME3.0 Supercomputer
Introducing Container Technology to TSUBAME3.0 Supercomputer
Akihiro Nomura
 
Architecture of TPU, GPU and CPU
Architecture of TPU, GPU and CPUArchitecture of TPU, GPU and CPU
Architecture of TPU, GPU and CPU
GlobalLogic Ukraine
 
PyCon India 2011: Python Threads: Dive into GIL!
PyCon India 2011: Python Threads: Dive into GIL!PyCon India 2011: Python Threads: Dive into GIL!
PyCon India 2011: Python Threads: Dive into GIL!
Chetan Giridhar
 
LCU14 310- Cisco ODP v2
LCU14 310- Cisco ODP v2LCU14 310- Cisco ODP v2
LCU14 310- Cisco ODP v2
Linaro
 
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, AzulBetter Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
HostedbyConfluent
 
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, AzulBetter Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
HostedbyConfluent
 

Similar to Distributed Multi-Threading in GNU-Prolog (20)

Large customers want postgresql too !!
Large customers want postgresql too !!Large customers want postgresql too !!
Large customers want postgresql too !!
 
DPDK Integration: A Product's Journey - Roger B. Melton
DPDK Integration: A Product's Journey - Roger B. MeltonDPDK Integration: A Product's Journey - Roger B. Melton
DPDK Integration: A Product's Journey - Roger B. Melton
 
Implementation of Soft-core processor on FPGA (Final Presentation)
Implementation of Soft-core processor on FPGA (Final Presentation)Implementation of Soft-core processor on FPGA (Final Presentation)
Implementation of Soft-core processor on FPGA (Final Presentation)
 
Introduction to netlink in linux kernel (english)
Introduction to netlink in linux kernel (english)Introduction to netlink in linux kernel (english)
Introduction to netlink in linux kernel (english)
 
Lect06
Lect06Lect06
Lect06
 
Kernel Recipes 2018 - Live (Kernel) Patching: status quo and status futurus -...
Kernel Recipes 2018 - Live (Kernel) Patching: status quo and status futurus -...Kernel Recipes 2018 - Live (Kernel) Patching: status quo and status futurus -...
Kernel Recipes 2018 - Live (Kernel) Patching: status quo and status futurus -...
 
Applying the paradigms of core.async in Clojure and ClojureScript
Applying the paradigms of core.async in Clojure and ClojureScriptApplying the paradigms of core.async in Clojure and ClojureScript
Applying the paradigms of core.async in Clojure and ClojureScript
 
The pocl Kernel Compiler
The pocl Kernel CompilerThe pocl Kernel Compiler
The pocl Kernel Compiler
 
epoll() - The I/O Hero
epoll() - The I/O Heroepoll() - The I/O Hero
epoll() - The I/O Hero
 
開放運算&GPU技術研究班
開放運算&GPU技術研究班開放運算&GPU技術研究班
開放運算&GPU技術研究班
 
Lock free programming- pro tips
Lock free programming- pro tipsLock free programming- pro tips
Lock free programming- pro tips
 
Kernel bug hunting
Kernel bug huntingKernel bug hunting
Kernel bug hunting
 
"Efficient Implementation of Convolutional Neural Networks using OpenCL on FP...
"Efficient Implementation of Convolutional Neural Networks using OpenCL on FP..."Efficient Implementation of Convolutional Neural Networks using OpenCL on FP...
"Efficient Implementation of Convolutional Neural Networks using OpenCL on FP...
 
Performance Optimization of SPH Algorithms for Multi/Many-Core Architectures
Performance Optimization of SPH Algorithms for Multi/Many-Core ArchitecturesPerformance Optimization of SPH Algorithms for Multi/Many-Core Architectures
Performance Optimization of SPH Algorithms for Multi/Many-Core Architectures
 
Introducing Container Technology to TSUBAME3.0 Supercomputer
Introducing Container Technology to TSUBAME3.0 SupercomputerIntroducing Container Technology to TSUBAME3.0 Supercomputer
Introducing Container Technology to TSUBAME3.0 Supercomputer
 
Architecture of TPU, GPU and CPU
Architecture of TPU, GPU and CPUArchitecture of TPU, GPU and CPU
Architecture of TPU, GPU and CPU
 
PyCon India 2011: Python Threads: Dive into GIL!
PyCon India 2011: Python Threads: Dive into GIL!PyCon India 2011: Python Threads: Dive into GIL!
PyCon India 2011: Python Threads: Dive into GIL!
 
LCU14 310- Cisco ODP v2
LCU14 310- Cisco ODP v2LCU14 310- Cisco ODP v2
LCU14 310- Cisco ODP v2
 
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, AzulBetter Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
 
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, AzulBetter Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
 

More from Nuno Morgadinho

Democracy in PM (and operations)
Democracy in PM (and operations)Democracy in PM (and operations)
Democracy in PM (and operations)
Nuno Morgadinho
 
Está na altura de renovar o site da sua empresa?
Está na altura de renovar o site da sua empresa?Está na altura de renovar o site da sua empresa?
Está na altura de renovar o site da sua empresa?
Nuno Morgadinho
 
Os maiores desafios ao criar ou remodelar um website
Os maiores desafios ao criar ou remodelar um websiteOs maiores desafios ao criar ou remodelar um website
Os maiores desafios ao criar ou remodelar um website
Nuno Morgadinho
 
O Preço De Projetos WordPress
O Preço De Projetos WordPressO Preço De Projetos WordPress
O Preço De Projetos WordPress
Nuno Morgadinho
 
Gutenberg (WidgiLabs Training Sessions)
Gutenberg  (WidgiLabs Training Sessions)Gutenberg  (WidgiLabs Training Sessions)
Gutenberg (WidgiLabs Training Sessions)
Nuno Morgadinho
 
WidgiLabs in 3 minutes
WidgiLabs in 3 minutesWidgiLabs in 3 minutes
WidgiLabs in 3 minutes
Nuno Morgadinho
 
Entrepreneurship as Couple
Entrepreneurship as CoupleEntrepreneurship as Couple
Entrepreneurship as Couple
Nuno Morgadinho
 
iOS & Arduino
iOS & ArduinoiOS & Arduino
iOS & Arduino
Nuno Morgadinho
 
Sistemas de Controlo de Versões
Sistemas de Controlo de VersõesSistemas de Controlo de Versões
Sistemas de Controlo de Versões
Nuno Morgadinho
 
De curioso a poeta – a comunidade e a cultura WordPress
De curioso a poeta – a comunidade e a cultura WordPressDe curioso a poeta – a comunidade e a cultura WordPress
De curioso a poeta – a comunidade e a cultura WordPress
Nuno Morgadinho
 

More from Nuno Morgadinho (10)

Democracy in PM (and operations)
Democracy in PM (and operations)Democracy in PM (and operations)
Democracy in PM (and operations)
 
Está na altura de renovar o site da sua empresa?
Está na altura de renovar o site da sua empresa?Está na altura de renovar o site da sua empresa?
Está na altura de renovar o site da sua empresa?
 
Os maiores desafios ao criar ou remodelar um website
Os maiores desafios ao criar ou remodelar um websiteOs maiores desafios ao criar ou remodelar um website
Os maiores desafios ao criar ou remodelar um website
 
O Preço De Projetos WordPress
O Preço De Projetos WordPressO Preço De Projetos WordPress
O Preço De Projetos WordPress
 
Gutenberg (WidgiLabs Training Sessions)
Gutenberg  (WidgiLabs Training Sessions)Gutenberg  (WidgiLabs Training Sessions)
Gutenberg (WidgiLabs Training Sessions)
 
WidgiLabs in 3 minutes
WidgiLabs in 3 minutesWidgiLabs in 3 minutes
WidgiLabs in 3 minutes
 
Entrepreneurship as Couple
Entrepreneurship as CoupleEntrepreneurship as Couple
Entrepreneurship as Couple
 
iOS & Arduino
iOS & ArduinoiOS & Arduino
iOS & Arduino
 
Sistemas de Controlo de Versões
Sistemas de Controlo de VersõesSistemas de Controlo de Versões
Sistemas de Controlo de Versões
 
De curioso a poeta – a comunidade e a cultura WordPress
De curioso a poeta – a comunidade e a cultura WordPressDe curioso a poeta – a comunidade e a cultura WordPress
De curioso a poeta – a comunidade e a cultura WordPress
 

Recently uploaded

(CISOPlatform Summit & SACON 2024) Cyber Insurance & Risk Quantification.pdf
(CISOPlatform Summit & SACON 2024) Cyber Insurance & Risk Quantification.pdf(CISOPlatform Summit & SACON 2024) Cyber Insurance & Risk Quantification.pdf
(CISOPlatform Summit & SACON 2024) Cyber Insurance & Risk Quantification.pdf
Priyanka Aash
 
Vertex AI Agent Builder - GDG Alicante - Julio 2024
Vertex AI Agent Builder - GDG Alicante - Julio 2024Vertex AI Agent Builder - GDG Alicante - Julio 2024
Vertex AI Agent Builder - GDG Alicante - Julio 2024
Nicolás Lopéz
 
(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...
(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...
(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...
Priyanka Aash
 
Types of Weaving loom machine & it's technology
Types of Weaving loom machine & it's technologyTypes of Weaving loom machine & it's technology
Types of Weaving loom machine & it's technology
ldtexsolbl
 
Data Integration Basics: Merging & Joining Data
Data Integration Basics: Merging & Joining DataData Integration Basics: Merging & Joining Data
Data Integration Basics: Merging & Joining Data
Safe Software
 
Google I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged SlidesGoogle I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged Slides
Google Developer Group - Harare
 
Computer HARDWARE presenattion by CWD students class 10
Computer HARDWARE presenattion by CWD students class 10Computer HARDWARE presenattion by CWD students class 10
Computer HARDWARE presenattion by CWD students class 10
ankush9927
 
"Mastering Graphic Design: Essential Tips and Tricks for Beginners and Profes...
"Mastering Graphic Design: Essential Tips and Tricks for Beginners and Profes..."Mastering Graphic Design: Essential Tips and Tricks for Beginners and Profes...
"Mastering Graphic Design: Essential Tips and Tricks for Beginners and Profes...
Anant Gupta
 
What's new in android: jetpack compose 2024
What's new in android: jetpack compose 2024What's new in android: jetpack compose 2024
What's new in android: jetpack compose 2024
Toru Wonyoung Choi
 
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
shanihomely
 
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdfBT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
Neo4j
 
Patch Tuesday de julio
Patch Tuesday de julioPatch Tuesday de julio
Patch Tuesday de julio
Ivanti
 
Opencast Summit 2024 — Opencast @ University of Münster
Opencast Summit 2024 — Opencast @ University of MünsterOpencast Summit 2024 — Opencast @ University of Münster
Opencast Summit 2024 — Opencast @ University of Münster
Matthias Neugebauer
 
Best Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdfBest Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdf
Tatiana Al-Chueyr
 
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
bhumivarma35300
 
Vulnerability Management: A Comprehensive Overview
Vulnerability Management: A Comprehensive OverviewVulnerability Management: A Comprehensive Overview
Vulnerability Management: A Comprehensive Overview
Steven Carlson
 
Evolution of iPaaS - simplify IT workloads to provide a unified view of data...
Evolution of iPaaS - simplify IT workloads to provide a unified view of  data...Evolution of iPaaS - simplify IT workloads to provide a unified view of  data...
Evolution of iPaaS - simplify IT workloads to provide a unified view of data...
Torry Harris
 
(CISOPlatform Summit & SACON 2024) Gen AI & Deepfake In Overall Security.pdf
(CISOPlatform Summit & SACON 2024) Gen AI & Deepfake In Overall Security.pdf(CISOPlatform Summit & SACON 2024) Gen AI & Deepfake In Overall Security.pdf
(CISOPlatform Summit & SACON 2024) Gen AI & Deepfake In Overall Security.pdf
Priyanka Aash
 
Mastering OnlyFans Clone App Development: Key Strategies for Success
Mastering OnlyFans Clone App Development: Key Strategies for SuccessMastering OnlyFans Clone App Development: Key Strategies for Success
Mastering OnlyFans Clone App Development: Key Strategies for Success
David Wilson
 
EuroPython 2024 - Streamlining Testing in a Large Python Codebase
EuroPython 2024 - Streamlining Testing in a Large Python CodebaseEuroPython 2024 - Streamlining Testing in a Large Python Codebase
EuroPython 2024 - Streamlining Testing in a Large Python Codebase
Jimmy Lai
 

Recently uploaded (20)

(CISOPlatform Summit & SACON 2024) Cyber Insurance & Risk Quantification.pdf
(CISOPlatform Summit & SACON 2024) Cyber Insurance & Risk Quantification.pdf(CISOPlatform Summit & SACON 2024) Cyber Insurance & Risk Quantification.pdf
(CISOPlatform Summit & SACON 2024) Cyber Insurance & Risk Quantification.pdf
 
Vertex AI Agent Builder - GDG Alicante - Julio 2024
Vertex AI Agent Builder - GDG Alicante - Julio 2024Vertex AI Agent Builder - GDG Alicante - Julio 2024
Vertex AI Agent Builder - GDG Alicante - Julio 2024
 
(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...
(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...
(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...
 
Types of Weaving loom machine & it's technology
Types of Weaving loom machine & it's technologyTypes of Weaving loom machine & it's technology
Types of Weaving loom machine & it's technology
 
Data Integration Basics: Merging & Joining Data
Data Integration Basics: Merging & Joining DataData Integration Basics: Merging & Joining Data
Data Integration Basics: Merging & Joining Data
 
Google I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged SlidesGoogle I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged Slides
 
Computer HARDWARE presenattion by CWD students class 10
Computer HARDWARE presenattion by CWD students class 10Computer HARDWARE presenattion by CWD students class 10
Computer HARDWARE presenattion by CWD students class 10
 
"Mastering Graphic Design: Essential Tips and Tricks for Beginners and Profes...
"Mastering Graphic Design: Essential Tips and Tricks for Beginners and Profes..."Mastering Graphic Design: Essential Tips and Tricks for Beginners and Profes...
"Mastering Graphic Design: Essential Tips and Tricks for Beginners and Profes...
 
What's new in android: jetpack compose 2024
What's new in android: jetpack compose 2024What's new in android: jetpack compose 2024
What's new in android: jetpack compose 2024
 
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
 
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdfBT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
 
Patch Tuesday de julio
Patch Tuesday de julioPatch Tuesday de julio
Patch Tuesday de julio
 
Opencast Summit 2024 — Opencast @ University of Münster
Opencast Summit 2024 — Opencast @ University of MünsterOpencast Summit 2024 — Opencast @ University of Münster
Opencast Summit 2024 — Opencast @ University of Münster
 
Best Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdfBest Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdf
 
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
 
Vulnerability Management: A Comprehensive Overview
Vulnerability Management: A Comprehensive OverviewVulnerability Management: A Comprehensive Overview
Vulnerability Management: A Comprehensive Overview
 
Evolution of iPaaS - simplify IT workloads to provide a unified view of data...
Evolution of iPaaS - simplify IT workloads to provide a unified view of  data...Evolution of iPaaS - simplify IT workloads to provide a unified view of  data...
Evolution of iPaaS - simplify IT workloads to provide a unified view of data...
 
(CISOPlatform Summit & SACON 2024) Gen AI & Deepfake In Overall Security.pdf
(CISOPlatform Summit & SACON 2024) Gen AI & Deepfake In Overall Security.pdf(CISOPlatform Summit & SACON 2024) Gen AI & Deepfake In Overall Security.pdf
(CISOPlatform Summit & SACON 2024) Gen AI & Deepfake In Overall Security.pdf
 
Mastering OnlyFans Clone App Development: Key Strategies for Success
Mastering OnlyFans Clone App Development: Key Strategies for SuccessMastering OnlyFans Clone App Development: Key Strategies for Success
Mastering OnlyFans Clone App Development: Key Strategies for Success
 
EuroPython 2024 - Streamlining Testing in a Large Python Codebase
EuroPython 2024 - Streamlining Testing in a Large Python CodebaseEuroPython 2024 - Streamlining Testing in a Large Python Codebase
EuroPython 2024 - Streamlining Testing in a Large Python Codebase
 

Distributed Multi-Threading in GNU-Prolog

  • 1. Distributed Multi-Threading in GNU Prolog Nuno Morgadinho, Salvador Abreu {nm, spa}@di.uevora.pt Departamento de Informática Évora 2007
  • 2. Introduction • Distributed - one or more computers communicating over a network • Multi-Threading - more than one thread of execution • Thread - a flow of execution Slide 2 ICLP ’07 CICLOPS
  • 3. Introduction • Obtain results faster for problems where performance is critical • The problem can be divided into smaller tasks which can be carried out simultaneously • Parallelism Slide 3 ICLP ’07 CICLOPS
  • 4. What We Present • PM2 - a distributed multi-threading programming environment • GNU Prolog - efficient native Prolog compiler • Combination of both Slide 4 ICLP ’07 CICLOPS
  • 5. GNU Prolog and PM2: Why? • GNU Prolog produces stand-alone executables • The size of the executables is relatively small • Doesn’t work with machine independent saved- states Slide 5 ICLP ’07 CICLOPS
  • 6. Implementation • Established a model for connecting PM2 and GNU Prolog • The approach doesn’t involve modifications to GNU Prolog neither to PM2 • Compatibility with GNU Prolog libraries is retained Slide 6 ICLP ’07 CICLOPS
  • 7. Approach • Tabard - new program that manages distributed instances of GNU Prolog engines • pm2prolog - new library that allows the development of distributed multithreaded Prolog applications Slide 7 ICLP ’07 CICLOPS
  • 8. Functionality • Allow to execute computations remotely • Manage the engines responsible for the computations • Manage the communication involved between the several machines • Based on distributed memory and explicit message-passing Slide 8 ICLP ’07 CICLOPS
  • 9. Example :- initialization(init). :- include('pm2prolog'). % thread with rank 0 init:- pm2_is_master, !, pm2_max_rank(MaxRank), start_prolog_workers(MaxRank), test_prolog_workers(MaxRank), read_test(MaxRank), stop_prolog_workers. % thread != 0 init:- worker_code. Slide 9 ICLP ’07 CICLOPS
  • 10. Before Running • Configuration that specifies the list of machines • Each machine is mapped to one or more processing nodes or virtual processors (VPs) Slide 10 ICLP ’07 CICLOPS
  • 11. Execution Model • Binary is copied to all machines • In VP0 (master) a gprolog engine is created • In the other VPs (workers) a pthread in C is created and stands awaiting messages Slide 11 ICLP ’07 CICLOPS
  • 12. Execution Model • In the master, now in the Prolog thread, a predicate is called to send a message to every worker • The workers receive the message, initiate a gprolog engine and the thread stands awaiting more messages to come Slide 12 ICLP ’07 CICLOPS
  • 13. Execution Model • In the master, work is distributed throughout the workers through message-passing • The workers receive tasks which they execute locally. As soon as they finish, they send their results back to the master Slide 13 ICLP ’07 CICLOPS
  • 14. Execution Model • The master assembles the work results by reading as many messages as the number of previously sent messages • The master redistributes work again or orders the workers to finish their execution • The workers terminate • The master reiniciates the workers or terminates itself Slide 14 ICLP ’07 CICLOPS
  • 15. Inside a Virtual Processor UNLOCK Message Queue LOCK WRITE READ WRITE ... C Thread Listener Prolog Thread write_message_queue() thread_send_message/2 Start_Prolog() thread_get_message/2 Stop_Prolog() pm2_self/1 ... ... RECEIVE SEND SOCKET Slide 15 ICLP ’07 CICLOPS
  • 16. Several VPs per physical machine is possible Node 1 Node 2 VP 2 VP 0 Prolog Proc Prolog Proc Node 3 VP 1 VP 2 Prolog Prolog Proc Proc ... ... Slide 16 ICLP ’07 CICLOPS
  • 17. ISO Support • ISO/IEC Draft Technical Report 13211-5:2007, Prolog Multi-Threading Support • Extensions to take into consideration remote threads Slide 17 ICLP ’07 CICLOPS
  • 18. PM2-Prolog Remote Threads • thread_create/2 • vid(Rank, ThreadID) • Rank - VP identifier • ThreadID - identifier of the thread inside Slide 18 ICLP ’07 CICLOPS
  • 19. Experimental Evaluation 100 75 50 25 0 2004 2005 2006 2007 Results obtained with 7x Intel(R) Pentium(R) 4 2.80 Mhz each, Hyperthreading enabled, 512 Mbytes each, Linux 2.4.19 kernel, 100 Mbits TCP/IP Ethernet network Slide 19 ICLP ’07 CICLOPS
  • 20. Conclusions • We presented a distributed multi-threading GNU Prolog system on top of PM2 • First results show that it can obtain substantial speedups, even for real-world • Proved the approach to be technically possible and can be of use to other implementers Slide 20 ICLP ’07 CICLOPS
  • 21. Further Work • Improving our proposal • Extend the API with introspection and monitoring predicates • Experiment with more programs and bigger configurations • Build our own applications using this technology Slide 21 ICLP ’07 CICLOPS