scieee AI-readable full text Open interactive document viewer

Parallel error-correcting output codes classification in volume visualization

Amorós Huguet, Oscar

Abstract

In volume visualization, the definition of the regions of interest is inherently an iterative trial-and-error process finding out the best parameters to classify and render the final image. Generally, the user requires a lot of expertise to analyze and edit these parameters through multi-dimensional transfer functions. In this thesis, we present a framework of methods to label on-demand multiple regions of interest. The methods selected are a combination of 1vs1 Adaboost binary classifiers and an ECOC framework to combine binary results to generate a multi-class result. On a first step, Adaboost is used to train a set of 1vs1 binary classifiers, with a labeled subset of points on the target volume. On a second step, an ECOC framework is used to combine the Adaboost classifiers and classify the rest of the volume, assigning a label to each point among multiple possible labels. The labels have to be introduced by an expert on the target volume, and this labels have to be a small subset of all the points on the volume we want to classify. That way, we require a small e↵ort to the expert. But this requires an interactive process where the classification results are obtained in real or near real-time. That why on this master thesis we implemented the classification step in OpenCL, to exploit the parallelism in modern GPU. We provide experimental results for both accuracy on classification and execution time speedup, comparing GPU to single and multi-core CPU. Along with this work we will present some work derived from the use of OpenCL for the experiments, that we shared in OpenSource through Google code, and some abstraction on the parallelization process for any algorithm. Also, we will comment on future work and present some conclusions as the final sections of this document.

Full text

Master'in'Artificial'Intelligence'(UPC4URV4UB)' ' ' ' ' ' ' Master'of'Science'Thesis' PARALLEL'ERROR4CORRECTING' OUTPUT'CODES'CLASSIFICATION'IN'VOLUME' VISUALIZATION:'parallelism'for'IA'and'IA'for' parallelism' ! ! ! Oscar!Amoros!Huguet! ! ! ! Advisor/s:!Sergio!Escalera,!Anna!Puig! Dr./Drs.!on!behalf!of!the!Advisor/s:!Sergio!Escalera,!Anna!Puig! ! ! ! ! ! UNIVERSITAT DE BARCELONA, UNIVERSITAT POLITECNICA DE CATALUNYA, UNIVERSITAT ROVIRA I VIRGILI Abstract Facultat de Matemtiques UB Departament de Matemtica Aplicada i Anlisi Master in Artificial Intelligence by Oscar Amoros Huguet In volume visualization, the definition of the regions of interest is inherently an iterative trial-and-error process finding out the best parameters to classify and render the final image. Generally, the user requires a lot of expertise to analyze and edit these parameters through multi-dimensional transfer functions. In this thesis, we present a framework of methods to label on-demand multiple regions of interest. The methods selected are a combination of 1vs1 Adaboost binary classifiers and an ECOC framework to combine binary results to generate a multi-class result. On a first step, Adaboost is used to train a set of 1vs1 binary classifiers, with a labeled subset of points on the target volume. On a second step, an ECOC framework is used to combine the Adaboost classifiers and classify the rest of the volume, assigning a label to each point among multiple possible labels. The labels have to be introduced by an expert on the target volume, and this labels have to be a small subset of all the points on the volume we want to classify. That way, we require a small e↵ort to the expert. But this requires an interactive process where the classification results are obtained in real or near real-time. That why on this master thesis we implemented the classification step in OpenCL, to exploit the parallelism in modern GPU. We provide experimental results for both accuracy on classification and execution time speedup, comparing GPU to single and multi-core CPU. Along with this work we will present some work derived from the use of OpenCL for the experiments, that we shared in OpenSource through Google code, and some abstraction on the parallelization process for any algorithm. Also, we will comment on future work and present some conclusions as the final sections of this document. Chapter 1 Introduction In this chapter we present a summary of the goals and contributions of the thesis. 1.1 Goals The main and primary goal of this thesis has been to explore the interaction of AI and parallelism. How can AI algorithms be parallelized, and how much do they benefit from that, as well as have a look on what can some AI technologies add to the design of parallel computing systems. Our main goal in this thesis is to have a working proof of concept of a classification framework for medical volume dataset, that has to be interactive and semi automatic. To accomplish this, we want to implement a multi classification functionality, use standard visualization tools, and achieve accuracy and interactivity constraints. For matching the interactivity constraint we use parallelism. Other goals have been appearing during the development of the thesis, like the creation of AIMparallel, a methodology for easing and guiding the parallelization process of an algorithm and SimpleOpenCL, a framework we created, devoted to reduce the amount of code needed in order to create a parallel OpenCL program. As a second main goal, to explore AI techniques that could help on solve some problems on parallel computing designs, we found Multi Agent Systems is a source of a lot of features desirable for parallel computing systems of the future. So we propose a system based on specifically Self Organizing Multi Agent Systems. This project requires knowledge from a wide variety of fields. Computer Vision, Machine learning, Computer Science (Parallelism), Visualization and Multi Agent Systems. 2 Chapter 1. Introduction 3 1.2 Contributions summary In this thesis we show two proposals. The first and main one is a classification problem, and it’s implementation using parallelism. The second one is based on the experience and learning process of the first proposal. On this second proposal we show a draft of a parallel computing system based on Self Organizing Multi Agent Systems, with some basic experimentation. On the first proposal we used parallelism to implement IA techniques, and on the second one we use IA technologies to define a parallel computing system. For the classification problem we propose a general framework of supervised statistical classification methods to label on-demand multiple regions of interest (see Fig. 3.1). This provides an interactive classification/segmentation generic framework that could be used in several real applications, and it can be used with any existing classification/segmentation state-of-the-art method. The framework is composed by a pre-learning stage and an on-demand testing stage included in the renderer. The learning step gets a subset of pre-classified samples to train a set of Adaboost classifiers, which are codified as TFs, and combined in an ECOC design. Each classifier encodes a set of relevant properties in a 1D texture. We deal with several properties, such as density, gradient, space location, etc. of the original data without increasing the dimensionality of the classifier. Next, the testing stage multi-classifies and labels a subset of volume classes based on user interaction. The label mapping defines clusters of the selected classes, and then it assigns optical propeties and importance values to the final output classes to be visualizated. The labels computed in the testing step in the GPU memory can be used in several volume visualization approaches: to skip non-selected regions, to help computing importance values to di↵erent context structures, or to select the focus of interest for automatic view selections, just to mention a few. The label mapping reduces the edition of the TFs by only assigning the optical properties of a label. In addition, the labels, as a TF, can be applied directly to the voxels values, or alternatively to the sampling points derived from the interpolation of the nearby voxels. Up to now, the complexity of the learning process and the testing step of a large amount of data do not allow their integration into an interactive classification stage of the user-interface volume pipeline. In this sense, our proposal improves the TF specification process by combining a pre-processing learning step and a rendering integrated GPU-based testing method. In summary, on the classification problem we bring four contributions: First, the definition of a general framework for multi-classification of volumes based on the ECOC approach; Second, the use and parallelization of Adaboost as a case study of this general framework; Third, the computation of an on-demand adaptive classification to a subset of features of interest; Finally, the proposal of a GPGPU OpenCL implementation of the testing stage of the multi-classifier integrated into the final rendering. This work Chapter 1. Introduction 4 serves as a proof of concept for future embedding of the training step in the visualization pipeline. In this sense, online learning will be performed on-demand in the rendering. Results on diferent volume data sets of the current prototype show that this novel framework exploits GPU capabilities at the same time that achieves high classification accuracy. The parallel computing system mainly proposes a design change on parallel computing systems, based on the evolution of the technology, that allows to have extra hardware executing Agent programs for the benefit of the whole system. This benefit comes from the optimization of the network use and from the decentralization of the scheduling. Many of this benefits are already pursued on other projects for parallel computing languages and frameworks, but they continue to use traditional programming paradigms for the implementation of the system. The rest of the thesis is organized as follows: Next chapter overviews the parallelism state of the art and presents our AIMparallel methodology. Chapter 3 presents the classification problem, it’s definition, parallel implementation, experiments and results. Chapter 4 explains the SOMAS based parallel computing system proposal with a basic first definition, a basic simulator and some small experiments with it. Finally chapter 5 gives some conclusions on all the work done. Chapter 2 Parallelization 2.1 Introduction On this chapter we are going to introduce the problem of parallelization and more specifically parallelism on the GPU. This chapter introduces concepts necessary for the main contribution, the classification problem, and que parallel system proposal. We begin with an state of the art and ends with a parallelization methodology and nomenclature that we propose as part of this thesis. 2.2 State of the art 2.2.1 Introduction Parallelization technologies have been widely used for applications where the amount of data and/or calculations is very high. For having results in an acceptable time on this problems, several computers are required to be computing di↵erent parts of the same problem at the same time. Many languages and very specific networking and computer technologies have been used to tackle scientific or statistical problems for both public and private science and industry along last decades. Vector units first (instruction level parallelism) and Shared Memory Multiprocessors later introduced parallelism in certain degree into workstations, allowing for a wider audience to create parallel programs, or for increasing the processor densities of clusters. This audience broadening turned into a tendency, and many languages have been adopted as standards like OpenMP (for shared memory multiprocessor systems) and MPI (for clusters). Nevertheless, many technical problems arise almost at the same time: •An increased cost and difficulty of shrinking processors. 5 Chapter 2. Parallelization 6 •An increased cost and difficulty of keeping power consumption levels with the increase of transistor number, added to an increased demand of power efficiency for mobile devices. •An increased cost and difficulty of keeping the data interfaces (from networks to memory interfaces and o↵-chip wiring) to keep the data transfer performance on pair to the processors processing capabilities. For reducing this problems at a hardware design level, the easiest solution is to increase parallelism in several architecture levels, plus increasing power modularity on the processors, leading to many parts of the processors being turned on and o↵depending on usage for saving power, and matching thermal requirements. This increase on parallelism, at the processor and ALU level has many problems: •Parallelism is not a need by it self in many applications, but an added complexity in order to fully use new systems. Programmers tend to skip it or even don’t know how to use it. •Vector units usually need proprietary compilers to be used, and is complex. •At multi-CPU level, cache memories intended to mitigate the memory interface performance problem became a problem. The more CPU’s the more complex and big becomes the caches and memory coherency ends up consuming most of the power and chip surface. •Parallel programming models like OpenMP or MPI are known by a small community of programmers, and businesses try to avoid their need as much as possible. A proof of this is the success of specific frameworks or languages like those based on Map-reduce [JD04], Scala [dSOG10], etc... They are specific for certain tasks or needs, but they are easier to use since they are very high level. GPU (graphics processing units) have been very specific processors that had much more freedom to evolve than general-purpose processors like CPU, which have to manage an operating system with all the complex functionalities it implies. Additionally, GPU’s are added to systems with a piece of software (a driver) that makes the systems to know how to communicate with them. Also, some GPU programming standards appeared, like OpenGL, that abstracted architectures and o↵ered a single graphics programming model for all GPU’s. All this modularity and specific functionality allowed GPU designers to create almost any architecture, that better matched the graphics computing needs. These needs are mainly programmable data parallelism for allowing the programmer to create their own visual e↵ects, a big memory bandwidth and some very common functionalities that can be tackled with super fast fixed function units. As a result, Chapter 2. Parallelization 7 GPU ended being a relatively cheap and very parallel and fast architecture, that once adapted with the help of some new languages (CUDA and OpenCL), evolved into a more general purpose parallel processors (GPGPU). Nevertheless, GPU’s are still not true general purpose, they are very good for some tasks, good for some others, and bad for all serial codes or task parallelism (like operating systems). CPU’s are the opposite, they can provide a very limited amount of parallelism compared to GPU’s with a very less efficient power consumption per core, but they are much more efficient on computing serial tasks and operating systems. This makes CPU’s and GPU’s a pair of very complementary architectures, not to mention that they are present together in almost all computer systems, including mobile devices. But CPU’s and GPU’s are not the only architectures around. In general, architectures can be classified by it’s level of specificity or generality on the task they can perform. ASIC (application-specific integrated circuit) circuits designed to a single task are the most efficient solutions, but they are not adaptable, since they are not programmable, they will always perform the same task. FPGA’s (Field Programmable Gate Array) are a bit more flexible, since they are intended to be programmable circuits, but programming a circuit is much more complex than programing on a compiled high level language, for a general purpose processor. GPU’s include ASIC functionalities and semi general purpose highly parallel units. Some CPU’s are starting to include some ASIC units for video processing too, like Intel Quick Sync. Nevertheless, mostly on mobile devices, there are more specific purpose units like video processors, and a lot of DSP that are mainly ASIC’s. Programming GPU’s for general purpose can be done mainly with CUDA or OpenCL languages. They are mainly the same, and their performance too, but CUDA only works for NVIDIA GPU and OpenCL works in any GPU, CPU and is designed to work on any existent and future accelerator (floating point operations accelerator) technology like FPGA’s and ASIC’s. The advantages of CUDA are the availability of some NVIDIA GPU features that might not be supported in OpenCL (since NVIDIA is not creating OpenCL extensions for supporting them) and the more programmer friendly options that CUDA has on the CPU side of the code. As CUDA has been the first computing oriented GPU language to appear, it gained broad adoption on the scientific community and there are many papers on the literature implementing varied algorithms from many domains in CUDA [GLD⇤08,HGLS07,NL07]. Nevertheless, this algorithm implementations are almost identical when programmed in OpenCL, and additionally, having OpenCL code allows to test a wider range of hardware, with less coding e↵ort than using proprietary languages for each hardware. In fact it is possible to use exactly the same code for di↵erent vendors. Given the data parallelism of the algorithms and data we are using, the natural choice is GPU’s. Additionally, the data being processed is already on the GPU for visualization Chapter 2. Parallelization 8 so we are not creating any unnecessary data transfer. For code portability and being able to work with di↵erent architectures we chose OpenCL instead of CUDA. On the next sections we will review some important aspects of the GPU architecture and the GPU programming model. 2.2.2 GPU architecture review GPU’s are mainly a set of big vector processors, sharing a common memory space and each one with a big control unit. This vector processors or compute units (OpenCL nomenclature) have a very varying amount of ALU’s for integer and floating point operations, depending on the model and the vendor (from 2 ALU’s in a super scalar pipelined fashion on Intel GPU’s to 192 ALU’s on NVIDIA GPU’s). On this section we will divide the explanation of GPU architecture in to memory hierarchy, execution internals, and programming model. 2.2.2.1 Memory hierarchy The main memory of this GPU’s usually is a set of GDDR5 banks, in case of discrete PCIe GPU’s. More recently, some GPU’s share the same CPU DDR3 memory, where the operating system splits it into two di↵erent memory spaces, saving costs, but reducing performance. The newest technologies already available, allow the system to either simulate a single memory space for GPU and CPU, regardless of the real memory being used (NVIDIA CUDA 6), or to actually allow the GPU to coherently use the same memory space as the CPU through driver and hardware support (some AMD APU’s). This memory is called global or device memory, according to OpenCL and CUDA nomenclatures respectively. From now on we will only use OpenCL nomenclature for clarity. Refer to Appendix A on this document for doubts about OpenCL nomenclature. Additionally to this global memory, compute units usually have access to a coherent cache that allows to reduce the memory latencies generated when accessing global memory, that until today is always o↵-chip memory. Accessing o↵-chip memory implies signal amplification and sometimes translation. All this process is time and power consuming. Compute units might have to wait up to 600 computing cycles in order to have a single global memory transfer. For that reason, additionally to this cache memory, there is another memory space private to each compute unit, that is small but very fast, who’s latency is usually 2 computing cycles. This memory is called local memory, and the programmer can explicitly create pointers to this memory space. Local memory is more complicated than that though. When a programmer declares a variable that resides into local memory, there will exist as a di↵erent copy of the Chapter 2. Parallelization 15 of the algorithm partition. From the system side, sWPO is a measure of how much parallelism can the system a↵ord, either proportionally to the number of cores, or through resources that allow the system to exploit having more active threads than cores. This time, the relationship between aWPO and sWPO is not that clear. Up to a certain point it is beneficial to increase the number of threads, but given a limit (that can depend on the amount of resources used by each thread), increasing thread count can penalize performance. This behavior could be drawn on a 2D graph where yis the performance, and xis the number of threads. This is a function, and that function depends mainly on the system resources. Finding this function and taking into account the resources used per thread is a tedious work for the programmer. A more intuitive way of handling this, that is broadly used, is to read some recommendation about the number of threads that use to be good for each system. Still, we can give some useful clues to the programmer by defining sWPO as a number that reduces aWPO according to the system resources. This time then sWPO =1 SR where SR is a value that represents the system amount of computing resources (number of cores or vendor recommended number of threads) and aWPO =NT where NT represents the number of threads used. Then WPO follows WPO =(1 aW P O⇥sW P O if NT < SR aWPO ⇥sWPO if NT >=SR This formulation can be used to decide which hardware to use or which algorithm partition or parallelization techniques to use. Then extra-tuning can be done finding the right value of SR for the algorithm by testing the code and di↵erent NT values. •Finally, the Thread Management Overhead (TMO) is related to the cycles lost when creating, destroying and scheduling threads. Again, we have algorithm and system TMO (aTMO and sTMO). Using a big number of threads, and creating a destroying a lot of them both create aTMO. Depending on the system implementation of the thread, sTMO will be higher or lower. This time, the relationship of both aTMO and sTMO is direct TMO =aTMO ⇥sTMO. Nevertheless sTMO can vary on some languages since scheduling policies can be di↵erent and selected by the programmer. With this overheads and the methodology to use them, we can select where to put our e↵ort to improve performance when parallelizing a code for an specific system, but also, we can recycle the high level analysis for considering implementations in other architectures with some work already done. Once the programmer has chosen what to improve, then he has to focus on the specific architecture, and all those characteristics that a↵ect to the most relevant overheads found. Chapter 2. Parallelization 16 Also, this three overheads could be used by vendors to provide very useful information about the specifics of the performance of their systems, helping customers to find the perfect fit for their needs, a not very trivial question. Figure 2.4: Two step methodology for analyzing parallelization options for a given algorithm and a given parallel architecture, using the three pre-defined parallelization overheads. 2.3.3 Low level overheads mapping In this section we will describe the influence of each of the three overheads on specific architectures. This step is mandatory and implies the study of the architectures being used. This could be simplified if vendors could provide some standardized numerical values for each of the three overheads, that allow to more easily compare parallelism characteristics of di↵erent systems. 2.3.3.1 GPU overheads mapping On this section we will comment on the three system overheads one by one, and add some discussion at the end. •sTCO: The use of the GPU memory hierarchy is the most sensitive aspect for obtaining a good GPU performance [KH10]. The communication between work items (threads) is done through this memory hierarchy. Therefor, on GPU’s, sT CO is caused by big memory access latencies, and it is the programmers duty to avoid it as much as possible by properly and explicitly using the memory hierarchy. Nevertheless, latencies and bandwidth are much higher than for instance distributed systems. Despite that, once the parallelization option is selected, if a programmer wants to optimice a code for GPU he can approximate the number of cycles lost, Chapter 2. Parallelization 17 Ncl, when introducing a memory access to a specific memory of the memory hierarchy. This value will be a worst case, since it doesn’t take into account caches or latency hiding as in Equation 2.1. Ncl =Mao ⇥Na⇥Cf(2.1) Mao is an average of the cycles lost per memory access; Nais the number of work items that perform the memory access; and Cfis the coalescing factor defined as 1 nW I ,wherenWI is the maximum number of work items that can perform a memory access operation at the same time (coalesced), for that memory access. •sWPO: on GPU’s sWPO is very big since they have a lot of cores to be used, and the total amount of computing power depends on having a lot of threads working. In fact, SR > numberofcores, since for exploiting all the cores for the maximum number of cycles on a program execution, it is necessary to have much more threads than GPU cores. It is important to note that GPU threads are very di↵erent to CPU threads, since there is no OS running on the GPU, no processes or threads as data structures that identify streams of code. The threads exposed on the programming model are translated into SIMD data positions. •sTMO: on GPU’s threads don’t exists as data estructures, so there is no real thread management. The conseqences of uncoalesced reads and thread divergence could be considered sTMO, but they are conceptually related to both WPO and TCO. The real sTMO is the situation where the code for each thread is very big, and some of the instructions need to be on Global Memory (See Section 6.2.3). Of course, reading instructions from global memory instead of register banks is slower. Another consequence of big GPU threads is the reduction on the number of work items active on each GPU multiprocessor. This reduces memory latency hiding. Also, new technologies like NVIDIA dynamic parallelism allow to create and destroy more threads, action that has a penalty on performance. Another way to change the number of threads on a GPU program is to write di↵erente kernels with di↵erent NDRange sizes. The only way to communicate from one kernel to the other is to store the data on global memory, something slower than keeping the data on faster memories. So we know now when sTMO increases on GPU’s. We have now mapped the GPU architecture main characteristics to three concepts that we can apply to any other parallel architecture, so the generic analysis becomes useful. We will show that it is useful to categorize the performance problems, and have abstract and common terms to refer to them across di↵erent architectures to ease the parallelization analysis and discussion. Chapter 2. Parallelization 18 2.3.3.2 Overheads mapping for CPU’s with OpenMP As standard CPUs have a limited amount of cores (from 2 to 16 per chip), one of the main overheads is the WPO. For this reason, we have to reduce the number of threads to close to the number of cores, sometimes more and sometimes a bit less, depending on the runtime management and DMA’s. Also, even there are fewer cores there can be WPO because of work unbalance. So we have to analyze the code behavior to determine which OpenMP for loop parallelization scheduling is better in order to avoid WPO and don’t generate too much TMO. In the case of TCO, we have to think of data locality. There are no local memories on the CPU, but we can increase the cache performance by increasing the spacial and temporal data locality of the operations in the code, so we will use more times cache blocks before replacing them with di↵erent data. Instead of explicit TCO optimization like in GPU’s we have an implicit optimization. 2.3.3.3 Overheads mapping for CPU’s with GCD GCD [App09] is an API developed by Apple based on C Blocks, that allows the programmer to forget about the computer resources, and focus only on the sequentiality or asynchronicity of each part of the code, regarding the main thread of the program. GCD at the programmer level substitutes the threads with queues, in where we can enqueue Blocks of code that can run asynchronously with the main thread. This queues are data structures much lighter than threads, that are accessed by few system controlled threads. The threads are responsible of searching for Blocks on these queues. This minimizes TMO and WPO by parallelizing the work scheduling for balancing. As the active threads are controlled by the system, the TMO is minimized automatically without the intervention of the programmer. The programmer does not need to analyze which is the perfect number of threads for a system, because the system is managing it. In fact, GCD can be aware of the active threads belonging to other applications, in order to reduce the number of active threads for the application using blocks, in order to reduce the number of context switches, and improving overall system performance. Nevertheless, this last feature is not a↵ecting our tests, since we tested the execution times in systems running the minimum set of idle system processes and daemons and our code. GCD can further reduce the WPO by using two types of queues, a global concurrent queue and an undefined number of FIFO queues. FIFO queues can be used in order to ensure the execution order of Blocks, when there are dependencies between them. That way, a thread can take for execution the first Block in the concurrent queue that still has been taken, and the first block introduced in any of the FIFO queues as long there is no thread executing the previous Block before it. This increases the probability for a thread to find work to do, and the source of work can be any part of the code. Again, Chapter 2. Parallelization 19 we are not taking advantage of this feature in our code, but we can if we integrate it with a visualization interface in an Apple machine. Finally, GCD allows to reduce TMO (consider block enqueueing as TMO), by allowing blocks to enqueue other blocks. That way it is possible to parallelize block enqueueing, so to balance this task across threads, instead of giving the task only to the main thread. The more cores used, the more interesting this option becomes. As a summary we can see, following the GCD specification and our discussion, that the codes (with unbalanced work) that use it do better scale with CPU core increments than free OpenMP implementations. 2.3.4 Conclussions With all this information we can intuitively see which algorithm overheads we should try to minimize, for a specific hardware. An experienced parallel programmer may already mentally do that procedure, but we didn’t find any literature explaining a generic methodology for avoiding redundant and useless work, when programming parallel systems. Chapter 3 Classification problem 3.1 Introduction In volume visualization, the definition of the regions of interest is inherently an iterative trial-and-error process finding out the best parameters to classify and render the final image. Generally, the user requires a lot of expertise to analyze and edit these parameters through multi-dimensional transfer functions. There are paid manual classification services that give good results, but are not available to any one due to the cost of the service. Additionally, the time required for having the volumes classified usually is several weeks. Additionally, classification techniques applied to large volumes are usually computational intensive tasks, that require overnight computation and make the whole user-system interaction slow. So there is not a tool where the users of CT or MRI machines can easily and accurately visualize the results in real time. We want to create a framework that defines the steps to be performed, and on each step or functionality, the methods implemented can be varied and changed. But there are fixed constraints, as the interactivity feature and a minimum of classification accuracy that must be satisfied. Figure 3.1: Overview of the ECOC-based visualization framework. 20 Chapter 3. Classification problem 21 In this work we want to implement supervised multi-classification techniques, that can generate classifiers using a small labeled subset of the volume to be classified. The idea is to create a software that allows to create a tool for the CT/MRI user (a doctor) to be able to interact with the volume generated, by labeling few points that the doctor will be sure about, and the rest will be classified automatically in real time. For the interactivity constraint, we consider parallelism as the conceptual computing tool in which to rely for execution time performance. Given the data-parallelism nature of the data to be processed, we will explore several parallel computing systems (hardware+language) and select classification techniques that can o↵er di↵erent work division granularities to better exploit any possible parallel architecture available to us. 3.2 Visualization Knowledge expressiveness of scientific data is one of the most important visualization goals. The abstraction process the final user should carry out in order to convey relevant information in the underlying data is normally a difficult task. User has to mentally process a large amount of data contained in several hundreds of slices to find features, boundaries between di↵erent structures, regions surrounding pathological areas, semantic structures, and so on. During the last few decades new means of outlining significant features are being developed to gather visual information contained in the data, such as ghost views, Focus+Context approaches [APT08], importance-driven visualizations and automatic viewpoint selections. Some of these methods [VKG05][KSW06] are useful for the exploration of pre-classified data sets as well as non-classified ones. However, most of them [BHW⇤07,KBKG08] require to previously define the structures of interest. In volume rendering literature, many papers addressed classification by directly associating optical and importance properties to the di↵erent data values considering their belonging to a particular structure [PLB⇤01]. Most of them are based on the edition of transfer functions (TF) [BPS97,KD98]. One-dimensional TFs only take into account scalar voxel values, but in some cases they could fail at accurately detecting complex combinations of material boundaries. Multi-dimensional TFs consider vectorial values or combinations of local measures of scalar values (e.g. position, statistical signatures, or derivatives [KD98]). However, the design complexity and the memory requirements increase with the TFs dimensionality. In general, the user coherently assigns similar optical properties to data values corresponding to the same region. Selection of regions or structures is indirectly defined by assigning to zero the opacity since totally transparent samples do not contribute to the final image. Then, the manual TF’s definition even by skilled users becomes complicated. In this sense, many works have focused on developing user friendly interfaces that make this definition more intuitive. Special emphasis has been done in the design of interfaces that deal with the definition of a Chapter 3. Classification problem 22 TF or partially automatize it [TM04,KKH01,MAB⇤97]. Nevertheless, to recognize semantic structures that apply to identify additional semantic information requires more sophisticated techniques. 3.3 Classification techniques Automatic and user-guided segmentation strategies based on image processing are used to obtain classified data sets. Recently, some preliminary works using learning methods have been published based on data driven and on image-driven classification. These classification methods provide users with a high level of information about data distribution and about the final visualization. Supervised methods such as bayesian networks, neural networks [TLM03], decision trees [FPT06] and non-supervised methods [TM04] have been applied in di↵erent user interfaces of volume applications. For instance, in [GMK⇤92], clustering-based supervised and non-supervised learning methods are compared for classifying magnetic resonance data. An integration of interactive visual analysis and machine learning is used in an intelligent interface to explore huge data sets in [FWG09]. Still, the data driven classification problem as a pattern recognition process is an open issue that has been treated from di↵erent points of view: template matching, statistical, syntactic or structural, and neural [JDM00]. For instance, supervised statistical learning deals with the classification task by modeling the conditional probability distribution of the di↵erent pre-labelled data sample features. Di↵erent Machine Learning (ML) approaches have been recently implemented using GPGPU for binary classifications in image processing applications. Clustering strategies and the computation of a k-nearest neighbor similarity classifier is presented in [GDB08]. A Geometrical Support Vector Machine classifier has also been implemented using GPGPU [HWS10]. It extends di↵erent GPGPU implementations for Neural Networks [YSMR10]. Adaboost is also a widely applied classifier. Based on a weak classifier, Adaboost defines an additive model combining simple weak classifiers to define a strong binary classifier with high generalization capability. Given its inherent parallel structure, its high performance, and its simplicity in order to train –Adaboost does not require tuning classifier parameters, Adaboost has a high potential for GPU applications. Most of the previous approaches are binary by definition –they only learn to split from two possible labels1. In order to deal with multi-class labelling, they need to be combined in some way, for example, by means of a voting or a committee process. In this scope, the Error-Correcting Output Codes (ECOC) is widely applied as a general framework in the ML community in order to deal with multi-class categorization problems. The ECOC framework allows to combine any kind of classifiers, improving classification accuracy by correcting errors caused by the bias and the variance of the learning algorithm [DK95]. 1Note that we use the terms classification and labelling indistinctly to refer the assignment of labels to data samples. Chapter 3. Classification problem 23 3.4 Proposal Our automatic volume labeling system bases on the combination of a set of trained binary classifiers. We consider the general ECOC framework to deal with multi-class labeling. As a case study, we use Adaboost to train the sets of binary classifiers. Next, we briefly review these two methodologies. 3.4.1 Error-Correcting Output Codes Given a set of Nclasses (volume structures or regions with certain properties) to be learnt in an ECOC framework, ndi↵erent bi-partitions (groups of classes) are formed, and nbinary problems over the partitions are trained. As a result, a codeword of length n is obtained for each class, where each position (bit) of the code corresponds to a response of a given classifier h(coded by +1 or -1 according to their class set membership, or 0 if a particular class is not considered for a given classifier). Arranging the codewords as rows of a matrix, we define a coding matrix M,whereM2{1,0,+1}N⇥n. Fig. 3.2(a) and (b) show a volume data set example and a coding matrix M, respectively. The matrix is coded using 15 classifiers {h1,...,h 15}trained using a few voxel samples for each class of a 6-class problem {c1,...,c 6}of respective codewords {y1,...,y 6}. The classifiers hare trained by considering the pre-labelled training data samples {(⇢1,l(⇢1)), ..., (⇢k,l(⇢k))}, for a set of kdata samples (voxels in our case), where ⇢is a data sample and l(⇢k)its label. For example, the first classifier h1is trained to discriminate c1against c2, without taking into account the rest of classes. Some standard coding designs are one-versus-all, one-versus-one, and random [ASS02]. Mainly, they di↵er on the definition of the subgroups of classes in the partitions of each binary problem. Due to the huge number of bits involved in the traditional coding strategies, new problem-dependent designs have been proposed [ETP⇤08]. These strategies take into account the distribution of the data in order to define the partitions of classes of the coding matrix M. During the decoding or testing process, applying the nbinary classifiers, a code X is obtained for each data sample ⇢in the test set. This code is compared to the base codewords (yi,i2[1,..,N]) of each class defined in the matrix M, and the data sample is assigned to the class with the closest codeword (e.g. in terms of distance). In fig. 3.2(b), the new code Xis compared to the class codewords {y1,...,y 6}using the Hamming Decoding [ASS02], HD(X, yi)=Pn j=1(1 sign(xj·yj i))/2, where Xjcorresponds to the j-th value of codeword X, and the test sample is classified by class c1with a measure of 0.5. The decoding strategies most widely applied are Hamming and Euclidean [ASS02], though other decoding designs have been proposed [EPR10]. Chapter 3. Classification problem 24 3.4.2 Adaboost classifier In this work, we train the ECOC binary classifiers husing Adaboost classifier. Adaboost is one of the main preferred binary classifiers in the ML community based on the concept of Boosting [FHT98]. Given a set of ktraining samples, we define hi⇠Fi(⇢)=PM m=1 cmfm(⇢), where each fm(⇢) is a classifier producing values ±1 and cmare constants; the corresponding classifier is sign(F(⇢)).The Adaboost procedure trains the classifiers fm(⇢) on weighed versions of the training sample, giving higher weights to cases that are currently misclassified [FHT98]. Then, the classifier is defined to be a linear combination of the classifiers from each stage. The binary Discrete Adaboost algorithm used in this work is shown in Algorithm 3.Ewrepresents expectation over the training data with weights w=(w1,w 2,..,w k), and 1(S)is the indicator of the set S(1 or 0 if Sis or not satisfied). Finally, Algorithm 2shows the testing of the final decision function F(⇢)=PM m=1 cmfm(⇢) using Adaboost with Decision Stump ”weak classifier”. A Decision Stump is a simple directional threshold over a particular feature value. Each Decision Stump fmfits a threshold value Tmand a polarity (directionaly over the threshold) Pmover the selected m-th feature. In testing time, ⇢mcorresponds to the value of the feature selected by fm(⇢) on a test sample ⇢. Note that cmvalue is subtracted from F(⇢) if the classifier fm(⇢) is not satisfied on the test sample. Otherwise, positive values of cmare accumulated. Finally decision on ⇢is obtained by sign(F(⇢)). ALGORITHM 1: Discrete Adaboost training algorithm. 1: Start with weights wi=1/k, i =1,..,k. 2: Repeat for m=1,2,..,(M): (a) Fit the classifier fm(⇢)21,1 using weights wion the training data. (b) Compute errm=Ew[1(l(⇢)6=fm(⇢)],c m= log((1 errm)/errm). (c) Set wi wiexp[cm·1(l(⇢i)6=fm(⇢i)],i=1,2,..,k, and normalize so that Piwi= 1. 3: Output the classifier F(⇢) = sign[PM m=1 cmfm(⇢)]. ALGORITHM 2: Discrete Adaboost testing algorithm. 1: Given a test sample ⇢ 2: F(⇢)=0 3: Repeat for m=1,2,..,M: (a) F(⇢)=F(⇢)+cm(Pm·⇢m<P m·Tm); 4: Output sign(F(⇢)) 3.5 Proposal: General framework for multi-class volume labeling Here, we present our automatic system for multi-class volume labeling. The system performs the following stages: a) All-pairs ECOC multi-class learning, b) ECOC submatrix definition, c) Adaptive decoding, and d) Label mapping. Chapter 3. Classification problem 31 Figure 3.5: T11implementation. On yellow the voxels for which we are calculating the gradients. Infront and behind are stored on private memory, and yellow and blue on local memory. The image corresponds to the data used by a workgroup of 32 ⇥4 work items. As T12option we can then focus on data locality to reduce TCO. The only way to do so is by making threads to process more than one voxel, specifically voxels that share data for calculating the gradients. This reduces the number of threads, therefore it produces WPO but also reduces TMO and TCO. We can find in the literature several methods for reducing TCO in this way like the Semi-stencil algorithm [dlCAPC10] that exploits data locality. In our case, as we are using only one value per neighboring side, and we are not using the central value, we can only do operations for the voxel corresponding to the central value. Thus this technique is not useful. Depending on the architecture we will calibrate the number of threads taking into account this analysis. 3.6.3.2 Task 2 and high level overheads mapping Next, we propose several parallelization options for Task 2 (T2), which performs the binary-classification step. T2 refers to the testing or decoding process, where the corresponding LUTs of the nbinary classifiers are applied to each voxel vxyz (see Section 3.4.1). As we defined in Section 3.5.4, each Lhas three (|⇢|⇥Wc)-sized rows. Let dim(VM)be the total amount of voxels of the model. Thus, the T2 cost is O(dim(VM)⇥n⇥(|⇢|⇥ Wc)). We propose multiple options for parallelizing T2: •First one is called T21and it consists of creating a thread for each voxel vxyz, as shown in Fig. 3.6. Ideally, in a machine with dim(VM) processors, the final cost of this option is O(n⇥(|⇢|⇥Wc)). Among the three values dim(VM) will always Chapter 3. Classification problem 32 be greater than nor (|⇢|⇥Wc). Also, there is no thread to thread communication so we have a balance between parallelism (WPO) and communication (TCO), and also thread management (TMO). Figure 3.6: Parallelization option T21: a thread is created for each voxel vxyz. •T22is a second parallelization option of Task 2. In this option we increase parallelism, as shown in Fig. 3.7. We can create dim(VM)⇥|⇢|⇥Wc) threads. One thread computes a value for each LUT-entry for each voxel (see Fig. 3.7). The theoretical cost of this approach is O(n). However, threads that classify the same voxel vxyz should communicate in order to compute the final sign sign(F(⇢)) for vxyz. This behavior increases the thread communication overhead TCO defined in Section 2.3.2. Moreover, this option also has WPO and TMO because there are di↵erent numbers of threads being used on each step of T2. So the increased parallelism is only e↵ective in some steps of T22. Chapter 3. Classification problem 33 Figure 3.7: Parallelization option T22: one thread computes a single LUT value for each LUT, for a single voxel. Some extra communication among threads should be done in order to compute the final sign(F(⇢)) for each vxyz. •Finally, T23is the last parallelization option we propose for Task 2. It is based on creating n⇥dim(VM) threads. Each thread processes one voxel vxyz with one LUT. Then, the final cost is O(|⇢|⇥Wc). In this solution, we deal with dim(VM) groups of nthreads with a value related to the same voxel vxyz.Thesenthreads can use this own generated values (ideally stored on local memories) to process later T3 in parallel. This option still presents a big TCO because all the threads need the data generated on T1 but it is possible to skip the final reduction step, depending on the configuration of step T3. It has more WPO but less TCO than T22. Chapter 3. Classification problem 34 Figure 3.8: Parallelization option T23: one thread reads a full LUT, and a row of m threads share the same value from the input data. Reading of the coding matrix M is done concurrently. Following the reasoning of the analysis on T12we could try to recycle data, by making each thread to process more than one voxel and storing the LUT values in local memories. This reduces TCO and increases WPO. This can be applied in all three options T21, T22and T23if the architecture o↵ers enough resources. 3.6.3.3 Task 3 and high level overheads mapping Finally, the last analysis is for Task 3 (T3), which performs the Multi-class labeling. T3 computes for each vxyz voxel the lowest distance from its X-code word to each of the Nrows of the coding matrix M. The row corresponding to the minimum distance identifies the final class label. Thus, this process has a total cost of O(dim(VM)⇥ dim(X)⇥N)wheredim(X)=n. As in T2, we describe di↵erent options to parallelize it, T31and T32.T31maintains a cost of O(dim(X)⇥N) by mapping one work item per voxel as in T21. On the other hand, T32uses one work item per voxel, X-code word value. Thus it would have O(N). This second option is ideal to be implemented along T23, since the number of threads through T23and T32is the same, avoiding TMO and reduction operations between options TCO. The combination has a lower WPO as well, but it still has a broadcast operation at the beginning of T23and a reduction step at the end of T32that generate TCO. Chapter 3. Classification problem 35 3.6.4 GPU implementation (high and low level merging) In T1 we have to read repeated data from global memory. To avoid this problem, we implemented T12following the Micikevicius GPU stencil algorithm [Mic09] that moves the repeated readings from global memory to local and private memory. This algorithm uses dimx⇥dimywork items and a for loop for dimz. With this approximation, we work with from 16384 work items (1283-sized voxel dataset) to 160000 work items (4003-sized voxel dataset), that are good amounts of work items for a GPU. In real environments this algorithm will scale to up to 4194304 work items with 20483voxel datasets. If needed we can increase the number of threads used by executing two or more equally distant dimx⇥dimyplanes in dimz. This planes will use the same algorithm for a smaller volume. We could find the balance between increased TCO and reduced WPO that way as a future work. Considering T2, as we have seen on section 2.3.3.1, on GPU’s sTCO is the most relevant overhead, and in T22and T23aTCO is bigger than in T21. We can approximate TCO by calculating the total amount of Ncl in the work item communication operations. This value is huge, thus we selected T21as the best parallelization option. We also implemented T22in order to empirically check our assumptions. In both T12and T21 we used dimx⇥dimywork items in order to take advantage of having the results in private memories from the first task T1. Nevertheless both T22and T23can be good candidates for the newly announced Dynamic Parallelism in the Tesla K20 NVIDIA card and Maxwell cards [NVI12]. T2 generates a testing X code word, for each voxel. The size of each X code word is n (the number of binary classifiers used). In our experiments nvaries from 1 to 36. In the worst case then we will have to store dim(VM)⇥36 4byte elements that easily might not fit into the GPU global memory. We solve this by following the same philosophy as in T12, by processing one dimx⇥dimyplane in T1, reading the results on T2 and storing the code words for only that plane. Once used by T3, the pointer used for the code words is reused for the next plane. That way we only need a pointer of size dimx⇥dimy⇥n⇥4bytes, to process all the voxel world. When considering T3, we also have to consider how T2 stored the data on memory, and in which memory. This will condition how the data can be read from T3 in an efficient manner. If we choose T21or T22, then it is not worth to use T32option since it would mean storing in T2 and reading on T3 from global memory in a non coalesced manner. Instead, T31would maintain coalesced reads to global memory. But if we where to use T23, then T32would be the best. Again, the reduction steps in T32make it the option with more TCO, comparing to T31, but a good choice for testing Dynamic Parallelism [NVI12]. We implemented T31and integrated the three tasks in a single kernel, using dimx⇥dimywork items. Chapter 3. Classification problem 36 Figure 3.9: Data flow for all the three steps: 1) The results of T1 are kept on registers to be read from T2; 2) The results of T2 are stored in global memory; 3) T3 reads the results of T2 and reads the coding matrix from local memory since it will be read throughout all zaxis. Results are finally stored in global memory. As it can be seen in Fig. 3.9, the data-flow between the three tasks using T21and T31 is as follows: 1. The results of T1 are kept on registers to be read from T2. 2. The results of T2 are too big to be stored on registers or local memory so we use global memory. In this case, GPUs with L2 cache reduce the overhead of using this global memory. The LUT values are also stored in global memory because for some values of nthey don’t fit on local memory. 3. T3 reads the results of T2 and reads the coding matrix from local memory since it will be read throughout all zaxis. Results are finally stored in global memory. As a final remark, considering the Host to Device memory transfer overhead, we decided to transfer only the density value of each voxel to the GPU, and on the GPU calculate the rest of the values in T1, like the voxel coordinates, gradients and magnitude. Also, we are only reading from Host the final GPU results and not any intermediate value. Chapter 3. Classification problem 37 3.6.5 OpenMP and GCD CPU implementations A fair CPU-GPU comparison should exploit the parallelism both options o↵er and it should compare similar price point CPUs and GPUs. For this purpose, we have used both OpenMP and GCD for implementing two CPU versions. OpenMP is a well-known API for shared-memory parallel programming in C, C++ and Fortran. On the other hand, we explore GCD since it presents some novel concepts that we think can make it technologically a better option than OpenMP. 3.6.5.1 Implementation decisions for OpenMP For T1, T2 and T3, with OpenMP the limitation is the same, TMO. We have taken the idea of one thread per voxel in a dimx⇥dimyplane in T12+T21+T31and reduced it to several voxels per thread. So we have parallelized the external for loop (see Algorithm 3) by scheduling some ziterations to each thread. The scheduling we have chosen is the OpenMP dynamic scheduling, because the work done for each xiteration depends on an initial comparison. If the density value of the voxel is below a threshold, we will not process this voxel. So we need to dynamically feed the threads. This dynamic scheduling introduces TMO because there is a thread on runtime devoted to work scheduling, but reduces WPO by balancing the work load. 3.6.5.2 Implementation decisions for CPU’s with GCD For GCD we followed the same philosophy as with OpenMP. The di↵erence is that, instead of having to analyze the work balancing and choose one of three scheduling policies provided by OpenMP, we just had to convert the same external for loop, into a GCD function that enqueues each iteration as a block, with an incremental variable corresponding to the variable that represents dimzposition and which the for loop increments. Knowing the GCD specification, work balancing will be automatically done, and we wanted to compare the execution times to the same parallelization strategy with OpenMP on the same system. 3.6.5.3 Other architectures not implemented As we mentioned in Section 3.6.4 the theoretical option T12+T23+T33has a high potential to be the best option for NVIDIA Dynamic Parallelism [NVI12]. With Dynamic Parallelism, a parent grid (the same as an NDRange space of work items) would follow Task 1 as in the GPU implementation (one thread per voxel for one plane). Then, each thread would call a child grid with the proper dimensions to have one thread per LUT (T23). The child grid would produce a test code word value per thread that will be Chapter 3. Classification problem 38 compared to one of the corresponding coding matrix code word values. The child grids will repeat the operation for each row on the coding matrix. The final step would be a reduce-compare operation. Following recent release of Adapteva’s Epiphany documentation [Ada13,Ada], we see that this architecture follows a global memory and local memory space model, similar to the GPU. It is also connected to a CPU with a system memory like in the case of GPU’s. There are two di↵erences with GPU’s though: first each core is completely independent of the others at execution level, and second the global memory space is distributed among cores and accessed through a fast on-chip network. In this case we would feed the data while reading results due to the limited amount of global memory. Each core would be responsible for processing several voxels like on CPU implementations. Thus we could store the coding matrix in local memory and the LUT’s in global memory. Then process all the assigned voxels and finally send the results while receiving the next voxels. 3.7 Simulations and results This section describes the experimental setup and shows the performance evaluation in terms of classification accuracy and execution time. 3.8 Setup Data: We used three data sets, Thorax data set2of size 400⇥400⇥400 represents a MRI phantom human body; Foot and Brain3of sizes 128⇥128⇥128 and 256⇥256⇥159 are CT scans of a human foot and a human brain, respectively. Methods: We use the one-versus-one ECOC design, Discrete Adaboost as the base classifier, and we test it with di↵erent number of decision stumps. For each voxel sample ⇢,we considered eight features: x,y,zcoordinates, the respective gradients, gx,gy,gz,the gradient magnitude, |g|and the density value, v. The system is compared in C++, OpenMP, GCD, and OpenCL codes. Hardware/Software: The details of the di↵erent CPU and GPU hardware configurations used in our simulations are shown in Tables 3.2 and 3.3, respectively. The viewport size is 700⇥650. We used the MoViBio software developed by the GIE Research Group at the UPC university [mov]. Measurements: We compute the mean execution time from 500 code runs. For the accuracy analysis, we performed 50 runs of cross-validation with a 5% stratified samplings. 2http://www.voreen.org 3http://www.slicer.org/archives Chapter 3. Classification problem 39 CPU’s AMD Phenom 2 Intel Core 2 Intel Core 955 Duo P8800 i5 750 Frequency 3.2GHz 2.66GHz 2.66GHz to 3.2GHz Cores 4 2 4 Threads per core 1 1 1 L3 cache 6MB 0MB 8MB SSE level 4A 4.1 4.2 Table 3.2: Di↵erent CPU configurations used for evaluation. GPU’s ATI NVIDIA Processing Elements 720 448 Stream or CUDA cores 144 448 Compute Units 9 14 Max PE per WI 5f / 0d 1f / 1d PE available per CU 80f / 0d 32f / 4d Warp size 64 Work Items 32 Work Items Memory type GDDR 5 GDDR 5 Global Memory size 1GB 1.28GB Local Memory size 32KB 16KB or 48KB Table 3.3: Di↵erent GPUs architectures used for evaluation, where ’d’ and ’f’ stands for double and float, respectively. 3.9 Classification accuracy analysis Figure 3.10: Classification accuracies for the di↵erent data set structures and number of decision stumps in the Adaboost-ECOC framework. (a) (b) (c) Figure 3.11: Comparison of the pre-labelled (left) and the classified data set (right) for (a) the Brain, (b) Foot, and (c) Thorax data sets, respectively. Fig. 3.10 shows the classification accuracy of the framework for the data sets considering di↵erent number of decision stumps M. The accuracies are shown individually for each Chapter 3. Classification problem 40 volume structure. From Fig 3.10 one can see that even for di↵erent complexity of volume structures, most of the categories obtain upon 90% of accuracy. In the case of the Foot data set, accuracy achieves near 100% for all the categories. In Fig. 3.11(b), we show the same section of the full pre-labelled Foot data set for six classes and the obtained classification with our proposal. In Fig. 3.12, we show selections and di↵erent shadings of the visualizations to demonstrate the flexibility of submatrix testing and the label mapping for di↵erent interaction models I. Figure 3.12: Case study of the 6-class foot volume: c1is the background, c2,c3, c4are the bone structures of the palm, ankle and tooth, respectively, and c5and c6are the soft tissue of the palm/ankle and tooth, respectively. Color Plates show the user interaction sets (from left to right) I={{c1},{c2},{c4},{c5},{c6}},I= {{c1},{c2,c 3},{c5},{c6}}, and I={{c1},{c2},{c3},{c4}}, respectively. In case of the Brain data set, we have trained nine classes of di↵erent structures of the brain that shares the same density and gradient values, achieving accuracies between 90% and 100%, where the lowest value is for the class c6, with values near 90%. The highest accuracy corresponds to the class c9. In Fig. 3.11(a), we show two sections of the pre-labelled brain structures together with the results obtained by our multi-classifiers. Note that classification inaccuracies do not present significant artifacts in the rendering. In Fig. 3.13 we also present some illustrative visualizations of this multi-classified data set applying di↵erent user interactions I. Finally, Fig. 3.11(c) shows an example of a full Thorax volume classification for di↵erent structures4. Figure 3.13: Case study of the 9-class Brain volume: the classes corresponds to di↵erent structures of the brain such as hemispheres, optical nerves and cerebellum with di↵erent shading techniques. 4Note that the proposed multi-class GPU-ECOC framework is independent of the classification/segmentation strategy applied. Thus, di↵erent feature sets as well as labeling strategies could be considered, obtaining di↵erences in classification accuracy. Chapter 4. Parallel system proposal 47 the only thing exchanged between Agents are Blocks or Data elements, that we call resources. •A resource has a value Vcomposed of a primary value PV and Rr. Each agent has a private view of Vso he is responsible to calculate Vfor all resources he sees or is aware of. PV is calculated by the amount of computation that the resource allows the agent to do. The instruction blocks have enabled and disabled instructions (to simplify we could enable or disable the full block). An instruction is enabled when the agent has the data used on this instruction. So a data resource may enable a number of instructions, or an instruction block may have more or less instructions activated according to the data that the agent has. The PV for a resource grows with the number of enabled instructions available on the agent due to this specific resource. •An agent has a limit in the number of resources it can own. This limit is a↵ecting V. If the agent is almost full of resources, Vwill decrease, so he will sell cheaper (more) and buy cheaper (less). On the contrary, if the agent has few resources the Vwill be increased, so he will sell more expensive (less) and be able buy more expensive (more). The result is V=PV +Rr where Rr =Resourceratio is a value that quantifies the number of resources available for the agent to execute blocks (memory, cores etc...). •When an agent is performing the buyer role, it sets it’s expected price for the resource by calculating the Vfor that resource according to the previous rules. •When an agent is performing the seller role, it sets it’s expected selling price by calculating the Vfor that resource, plus adding the ”transport fares”. So it is adding the costs (based on transfer time) of sending the resource to the other agent, taking into account the performance costs of sending data or blocks through the network. Setting this extra cost allows to regulate how prioritary it is for the system to do reduce communication, depending on the hardware used for connecting agents. When an agent evaluates a resource, it compares the resource Vhe calculated, with the Vthat a limited amount of neighbors have calculated. The Agent that gives the greatest value is the buyer and takes the resource. 4.3.5 Expected behaviors With this definition, we expect the system to automatically use hierarchical scheduling as we previously mentioned. Also it will perform data affinity scheduling, since it is controlling how much a data element is matching one or another agent. The Blocks are Chapter 4. Parallel system proposal 48 created with a syntax similar to annotations. Additionally, the system can adapt to di↵erent network latencies and bandwidths. We can expect data-flow behaviors, where some agents keep the same blocks of code, but the data moves as an stream through spontaneously pipelined agents. We can also expect blocks of code flowing and moving from agent to agent, if the data owned is used by many blocks in each agent, and only few blocks need the data on other agents at a certain point. As we can see, the intention is to take advantage of the Agent programming spirit to allow many sorts of scheduling that will spontaneously happen as the most efficient scheduling, depending on data and block affinities, agent available resources, and communication costs. 4.4 A hardware proposal for the system Some may argue that all the Agent processing is a huge overhead, and that a system like this can not be efficient. The first clue towards thinking otherwise is the actual existence of multi agent systems for grid computing [SHL⇤06,MB05]. In this systems, the network has a huge cost, so the overhead of the Agent program, is compensated by the efficient communication policies. Additionally to this, the tendency on parallel systems is to increase the number of cores more and more. Some projects even use low power mobile processors, and lots of them, to create supercomputers [mon11]. But the cost of the network increases. The networks have difficulties keeping performance on pair with the amount of data the processors can consume. Moreover, the cores are increasingly cheap. That means, that from a market point of view, it makes sense to devote some hardware to only the Agent program, and some other hardware to do the calculations. An ideal platform for experimenting would be the Adapteva’s parallella board [par13]. This board is a complete systems with CPU, ram, hard disc, and all peripheral connectors expected on a PC. It uses two ARM CortexA9 cores traditionally used on mobile phones, paired with an Epiphany 3 or 4 chip with 16 or 64 very low power cores, specialized on floating point operations. The two ARM cores can be devoted to execute the OS and the Agent program. The blocks then would be Epiphany kernels, and a virtual distributed unified memory system should be also implemented in software using pagination. The Agent should have some tables with information of owned kernels and memory pages, along with a copy of the pages of few neighboring boards. Chapter 4. Parallel system proposal 49 4.5 Experiments and results In this section we present the simulator we created, the experiments performed with it and the results, along with some conclusions. 4.5.1 The simulator We implemented a simple simulator following a simplified version of the definitions. The simulator is written in Python, for faster programming. With this version we are able to create Agents that have the purpose of executing instructions that need data to be executed. Each Agent is performing two tasks, executing Block instructions (including raising data requests), and managing the data requests he has stored. This two actions happen serially on the simulator, but on real systems that could be simultaneous. For simplicity, these two actions are performed in a single time step. The agent will execute the next time step when all the rest of the agents have executed it own time step. The variables we can modify to see experimental results are the following: •Number of agents on the grid. •Number of Blocks. •Number of data elements. •Number of instructions for each Block. •Number of data requests the agent will raise to the grid on a single time step. •Number of instructions the agent will fetch on each time step. Mainly, the question being analyzed on this work, is the e↵ects of all this variables on the number of data requests on the grid. This can be taken as a performance metric, since every data request will have a cost in any system, and will reduce the overall execution performance. We will now explain a bit deeper each class on the simulator, on the next subsections. •Block class: This class represents a simplified GCD Block. We defined a Block as a sequence of instructions without branches or function calls. All the instructions read one data element. For simplicity we haven added write instructions and all the instructions have the same execution cost. Chapter 4. Parallel system proposal 50 We represented the sequence of instructions in a Python List. Each element of the list contains a number that represents the dataID that the instruction would read. So there are no real instructions, but only the information of the data that the instruction would read. The class has a method that simulates the fetch operation of an instruction. It searches for the data element on a data table (another Python List ”dataTable” owned by the agent). If the data is on that table, the instruction is considered to be executed, and is erased from the list ”dataSequence”. If the data element was not on the ”dataTable”, the method returns the dataID so the agent knows that the instruction needs data that is not available at the moment. RequestsManager class This class is a small one, that allows to control both the data ID requested by any block on the Agent, and the number of times it has been requested. The purpose of storing the number of times a data ID has been requested, is implemented on a method called ”popPriorityRequest”. This methond searches for the data ID with the greatest number of requests, erases it from the lists, and returns the data ID, since the agent will put the request on the grid. •Agent class: This class represents an Agent. The Agent class contains a Python List of Block objects, and another List of integers that represent data ID. It has two main methods. The first, ”senseResoruces”, has that name to refer to the concept of an agent process executing in a di↵erent peace of hardware than the one that is executing Block instructions. The Blocks might be executing and at a certain time interval, the Agent senses the state of the blocks and stores the information. What the method really does, is to do what in theory was already done. It executes a number of instructions and stores the data requests if any. The second method is ”manageRequests”. This method uses the requestManager object to get the priority data ID and raise a data request on the grid. The number of instructions executed on the ”senseResources” method and the number of data requests raised to the grid on the ”manageResources” method are set on every call. This is on the purpose of analyzing the e↵ects in the number of data requests by changing these values. There is a this method called by the grid, that informs the agent that someone in the grid is asking for a given data ID. The functionality of the method is simplified to directly return the data ID and erase the data ID from the Agent ”dataTable”. •Grid class: This class represents a grid. This grid is very simplified. It does not represent space, so the agents have no distance between them. All the cost of communication is the same for all the agents. This is one of the first things to improve on next versions, although grid access is analyzed, and can be used to compute an access cost using the Agent ID. Chapter 4. Parallel system proposal 51 This class has several methods. The constructor takes all the data and all the Blocks, and generates two Python Lists with as many Lists as Agents each. Each sublist contains a list of data elements for the first list and a list of Blocks for the second list. Each pair of sublists will be assigned to a di↵erent Agent. The data is spread almost randomly, as well as the Blocks. Future work will include distributing blocks and data, as well as instructions in a block, according to parallelization strategies and algorithms to enrich the analysis. Two methods are made for initialization purposes. They create the agents with a pair of Block and dataTable sublists as arguments, as well as the grid itself and an agent ID. ”finished” method increments a counter to know when all the agents have finished. It also includes methods for reading the number or data requests and for sending the data requests to the proper agent. 4.5.2 The experiments The simulator was written in Python, an interpreted language that compared to other compiled languages like C, is very slow. For this reason, the number of experiments we have don is quiet limited, but show that the simulator works and shows the expected behavior. Also, the information being analyzed is quite collective. The interactions between Agents are limited to data queries, and so the possible situations are quite predictable. Experiment 1 The configuration for the experiment is the following: •Agents = 100 •Blocks = 200 •Data elements = 100000 •Block Size = 100 •Requests = 1 •Instructions = 100 The number of total data requests was 19743 This is the smallest experiment. We did it just to confirm that using less Blocks and Agents will translate into less data requests. Experiment 2 The configuration for the experiment is the following: •Agents = 1000 Chapter 4. Parallel system proposal 52 •Blocks = 3000 •Data elements = 100000 •Block Size = 100 •Requests = 1000 •Instructions = 100 The number of total data requests was 299567 We can see as the number of data requests on the grid has increased due to an increased number of both Agents and Blocks. This experiment has two values that should be suboptimal comparing to the other experiments. When the number of requests sent to the grid on each time step, is bigger than the number of instructions executed, it means that at each step, all the requests generated on the agent will be sent to the grid, erasing the possibility of doing a single grid data request for several internal agent data requests that can be coincidental. Experiment 3 The configuration for the experiment is the following: •Agents = 1000 •Blocks = 3000 •Data elements = 100000 •Block Size = 100 •Requests = 10 •Instructions = 1000 The number of total data requests was 299451 The di↵erence is almost not noticeable on the total number of requests comparing to the previous experiment, but in this one the results are better. We expect a greater di↵erence when the number of blocks is bigger. Now, each Agent has only 3 blocks, so the request grouping can be very big. Experiment 4 The configuration for the experiment is the following: •Agents = 1000 •Blocks = 3000 •Data elements = 100000 Chapter 4. Parallel system proposal 53 •Block Size = 100 •Requests = 100 •Instructions = 1000 The number of total data requests was 299486 The number of requests for this experiment is quite smaller than the experiment 2. This is normal taking into account the way agents manage requests internally. Chapter 5 Conclusions and future work We have seen that Parallelism, as a Computer Science research topic, and as a tool, is deeply connected to AI. First, many AI algorithms share common purposes and applications, but some are more parallelizable than others. This can be an advantage since this parallelization allows to add more complexity for increased accuracy on execution time constrained applications. Second, AI techniques can be applied for decision making when scheduling tasks on a system or when deciding which resources to use for a given task. This could lead to a software substitution of the parallel programmers that does a combination of preprocessing and runtime work, so any code can run parallel. Adaboost and the ECOC framework showed a wide range of granularity, that can be exploited in di↵erent ways. The results we obtained where satisfactory, and there is room for improvement on accuracy and execution time with bigger volumes. On the accuracy side we could use more neighbor data, like generating gradients reading more than two neighbors on each dimension, and reading classification decisions from the neighbors to do a second classification round with this extra data to automatically correct errors. Self Organizing Multi Agent Systems seem promising for grid computing and smaller systems that every time have more cores. The Agent programming is a perfect paradigm for local and distributed scheduling sytems, autonomy, and resilience, a concept that is a growing concern on the design of exa-scale supercomputers, where the provability of a node failure is growing, due to the huge amount of nodes. As a future work we could explore further algorithm improvements for the classification problem, both for accuracy and execution times, and on the parallel system, we could create a full simulator either with standar languages or with Multi Agent System languages like 2APL that can use platforms like JADEX for distributed computing and it’s own java environment interface to interact with other languages like OpenCL, C, etc... 54 Chapter 6 Appendix A (OpenCL summary) 6.1 Introduction High performance computing (HPC) has traditionally been limited to scientific or military codes, since in contrast personal computing was evolving much more a↵ordably with general purpose and serial processors. Parallelism and heterogeneity was very limited to big budget projects. Also, the programming languages, tools and paradigms where limited since there was not a bit number of projects using parallelism. In the last years there has been an expansion of HPC thanks to the adoption of commodity general purpose CPU’s. This CPU’s have included vector processing units but overall they are much cheaper to improve at architecture level, since the architecture used is sold in high volumes. This is what is traditionally called economies of scale, architectures that are a↵ordable to improve because they are sold in volume. Until now, there was just the x86 and ARM architectures fitting on the idea of volume production architectures. ARM was not enough computationally powerful to be used on HPC, although recently research is being done to use it as the base of a Supercomputing system [1]. So most of the HPC systems where (and still are) based on x86 64. Nevertheless, some years ago, another very di↵erent architecture, that was and still is being sold in volume to the mass market, acquired some general purpose capabilities. They are called Graphics Processing Units (GPU), and their purpose was specific for games and visualization. The market for GPU’s is almost as big as CPU’s, since nowadays, the need to visualize data or user interfaces is a given for mass market products. The GPU, has been traditionally a fixed function pipeline processor, but with the introduction of programable shaders, it became possible to create visual e↵ects that run fast on the GPU without fixed function circuitry. Scientists saw that this had potential for matrix computations 55 Appendix A OpenCL summary 56 and started what was called General Purpose GPU. The GPU companies started to offer some programing models to harness the potential of the GPU’s, ideally for any code (NVIDIA CUDA, ATI CAL) but there was no standard. Apple was very interested on it and so created along with the GPU companies OpenCL, that pretends to allow easier GPGPU programming than doing so with shaders. OpenCL is an Apple registered trademark used with Apple’s permit by the Krhonos group. The situation was that for the first time, a mainly specific purpose architecture was available at consumer prices for data intensive and matrix computations, perfect for a lot of scientifical codes. Also, some tasks as simulations for industrial component design and film special e↵ects, or simply scientifical experiments related to particle simulation and others, could be done on a PC with one or more high end GPU’s. That marked the return of the workstation. So, it was then possible that the historical trend of a general purpose CPU absorbing or surpassing all specific technologies could be changed, and instead, have more heterogeneous systems, with two or more di↵erent architectures, each one with it’s strengths and weaknesses. 6.2 OpenCL description OpenCL (Open Computing Language) is an open royalty-free standard for general purpose parallel programming across CPUs, GPUs and other processors, giving software developers portable and efficient access to the power of these heterogeneous processing platforms. OpenCL consists of an API for coordinating parallel computation across heterogeneous processors (OpenCL Host Code), and a cross-platform programming language with a well-specified computation environment (OpenCL Device Code). The concepts behind OpenCL can be grouped in the following list: •Platform Model •Execution Model •Memory Model •Programming Model Next we will explain one by one the concepts behind this items. Appendix B SimpleOpenCL 63 Figure 7.1: SimpleOpenCL programming levels. Figure 7.2: SimpleOpenCL first level function example. SimpleOpenCL second level functions with or without third party libraries, without changing the user code. That’s also the goal of first level functions, to give a reduced and stable set of functions with a stable set of parameters, that will automatically use whichever available low level improvements. The only requirement we put is that all features provided by SimpleOpenCL must be based on what the OpenCL standard provides and standard C, but must not be OS dependent. That means that we want SimpleOpenCL to only require an standard OpenCL installation in order to work. We are not hiding Device code complexity, so we expose the Device memory hierarchy to the programmer in the Host code side. As shown in figure 5, the function sclManageArgsLaunchKernel takes as arguments an sclHard variable (a single device), a sclSoft variable (a single kernel function), the sizes for the NDRange space, a constant string and a variable number of undefined type arguments. The last two arguments, are an string that contains the information of what are the arguments coming next. This is similar to the printf function. We arbitrarily defined which letters mean a type or a number of arguments expected as see on table 7.3.On SimpleOpenCL web page there is a detailed explanation of what is the syntax to specify Appendix B SimpleOpenCL 64 any possible argument. For some arguments OpenCL needs to know the size of the pointer, so when specifying an argument that is a pointer, the function is expecting two arguments, first the size, and then the pointer itself. Figure 7.3: Table showing what characters to use on the string sent as parameter to the sclManageArgsLaunchKernel function. This function takes as arguments standard C pointers, creates the necessary bu↵ers, transfers the necessary data, orders kernel execution, and reads the needed results. This behavior is specified on the string argument. This string argument becomes then a sort of host code programming script, that can be enhanced to be able to o↵er more advanced programming options. 7.4 SimpleOpenCL types One of the things we wanted to simplify is the management of the devices. We wanted to use a single data type to manage all needed to execute any kernel on one device. Also we wanted a function that can return an array of devices available on the system each one encapsulated in this type. The user must only need to initialize a variable of this data type and pass it to a function as a parameter, along with other parameters, and this should be everything needed to execute a kernel. No need to know about platforms, contexts, queues, device types etc etc etc. For that purpose we created the following data types: •sclHard: this is an struct that contains pointers to all the necessary OpenCL objects in order to access a device. The idea is to use this type as the only one required by any first or second level function. The initialization of this data type Appendix B SimpleOpenCL 65 takes into account other devices present on the system. Any of the hardware initialization functions uses (or is going to use) the sclGetAllHardware function that checks if two or more devices are from the same vendor and have the same characteristics in order to create a single context for all of them. This allows the devices to share memory objects. By now, this feature can be useful only from second level functions. •sclSoft: this is also an struct that contains both the program and kernel objects for an OpenCL C source file, and an string with the name of the kernel function being used. The idea is to have an sclSoft variable for each kernel function. Bibliography [Ada] Adapteva:Epiphany SDK Reference Manual: http://adapteva.com/docs/epiphanysdkref.pdf.Tech.rep., Adapateva. [Ada13] Adapteva:Epiphany Architecture Reference: http://adapteva.com/docs/epiphanyarchref.pdf.T ech.rep., Adpateva, 2008 2013. [Alt14] Altera:Altera OpenCL webpage: http://newsroom.altera.com/pressreleases/nr-opencl-v14-0-altera.htm?GSApos =1WT.ossr=1WT.oss = opencl.T ech.rep., Altera, 2014. [App09] Apple:http://developer.apple.com/library/mac/#documentation/Performance/Reference/GCD libdispatch Ref/Reference/reference.html. Tech. rep., Apple, 2009. [APT08] Abellan P., Puig A., Tost D.: Focus+context rendering of structured biomedical data. In EG VCBM 2008 : Eurographics workshop on visual computing for biomedicine (2008), pp. 109–116. [ASS02] Allwein E., Schapire R., Singer Y.: Reducing multiclass to binary: A unifying approach for margin classifiers. JMLR 1 (2002), 113–141. [BG08] Bell N., Garland M.:Efficient Sparse Matrix-Vector Multiplication on CUDA. NVIDIA Technical Report NVR-2008-004, NVIDIA Corporation, Dec. 2008. [BHW⇤07] Burns M., Haidacher M., Wein W., Viola I., Groeller E.: Feature emphasis and contextual cutaways for multimodal medical visualization. In Eurographics / IEEE VGTC Symposium on Visualization 2007 (May 2007), pp. 275–282. [BMD⇤11] Bueno J., Martinell L., Duran A., Farreras M., Martorell X., Badia R., Ayguade E., Labarta J.: Productive cluster programming with ompss. In Euro-Par 2011 Parallel Processing, Jeannot E., Namyst R., Roman J., (Eds.), vol. 6852 of Lecture Notes in Computer Science. Springer Berlin Heidelberg, 2011, pp. 555–566. 66 Appendix B SimpleOpenCL 67 [Bol01] Boland V.:Affinity scheduling of data within multi-processor computer systems, July 31 2001. US Patent 6,269,390. [BPS97] Bajaj C. L., Pascucci V., Schikore D.: The contour spectrum. In IEEE Visualization’97 (1997), pp. 167–174. [BSC] BSC:. //http://pm.bsc.es/ompss-docs/specs/OmpSsSpecification.pdf. [DK95] Dietterich T., Kong E.: Error-correcting output codes corrects bias and variance. In S. Prieditis and S. Russell (1995), of the 21th International Conference on Machine Learning P., (Ed.), pp. 313–321. [dlCAPC10] de la Cruz R., Araya-Polo M., Cela J.: Introducing the semistencil algorithm. In Parallel Processing and Applied Mathematics (2010), vol. 6067, pp. 496–506. [dSOG10] d. S. Oliveira B. C., Gibbons J.: Scala for generic programmers. Journal of Functional Programming 20, 3,4 (2010), 303–352. Revised version of the WGP2008 paper. [EPR10] Escalera S., Pujol O., Radeva P.: On the decoding process in ternary error-correcting output codes. IEEE Transactions on Pattern Analysis and Machine Intelligence 32 (2010), 120–134. [ETP⇤08] Escalera S., Tax D., Pujol O., Radeva P., Duin R.: Subclass problem-dependent design of error-correcting output codes. In IEEE Transactions in Pattern Analysis and Machine Intelligence (2008), vol. 30, pp. 1–14. [FHT98] Friedman J., Hastie T., Tibshirani R.: Additive logistic regression: a statistical view of boosting. Annals of Statistics 28 (1998). [FPT06] Ferr´ eM.,PuigA.,TostD.: Decision trees for accelerating unimodal, hybrid and multimodal rendering models. The Visual Computer 3 (2006), 158–167. [FWG09] Fuchs R., Waser J., Gr¨ oller M. E.: Visual human-machine learning. IEEE TVCG 15, 6 (Oct. 2009), 1327–1334. [GDB08] Garcia V., Debreuve E., Barlaud M.: Fast k nearest neighbor search using gpu. [GLD⇤08] Govindaraju N. K., Lloyd B., Dotsenko Y., Smith B., Manferdelli J.: High performance discrete fourier transforms on graphics processors. In Proceedings of the 2008 ACM/IEEE Conference on Supercomputing (Piscataway, NJ, USA, 2008), SC ’08, IEEE Press, pp. 2:1– 2:12. Appendix B SimpleOpenCL 68 [GMK⇤92] Gerig G., Martin J., Kikinis R., Kubler O., Shenton M., Jolesz F.: Unsupervised tissue type segmentation of 3-d dual-echo mr head data. Image and Vision Computing 10, 6 (1992), 349–36. [HGLS07] He B., Govindaraju N. K., Luo Q., Smith B.:Efficient gather and scatter operations on graphics processors. In Proceedings of the 2007 ACM/IEEE Conference on Supercomputing (New York, NY, USA, 2007), SC ’07, ACM, pp. 46:1–46:12. [HSSY00] Hamscher V., Schwiegelshohn U., Streit A., Yahyapour R.: Evaluation of job-scheduling strategies for grid computing. In Grid Computing — GRID 2000, Buyya R., Baker M., (Eds.), vol. 1971 of Lecture Notes in Computer Science. Springer Berlin Heidelberg, 2000, pp. 191– 202. [HWS10] Herrero S., Williams J., Sanchez A.: Parallel multiclass classification using svms on gpus. In ACM International Conference Proceeding Series, Proceedings of the 3rd Workshop on General-Purpose Computation on Graphics Processing Units (2010), vol. 425, pp. 2–11. [JD04] Jeffrey Dean S. G.: Mapreduce: Simplified data processing on large clusters. OSDI’04: Sixth Symposium on Operating System Design and Implementation, San Francisco, CA, December, 2004. (2004). [JDM00] Jain A. K., Duin R. P., Mao J.: Statistical pattern recognition: A review. IEEE Transactions on Pattern Analysis and Machine Intelligence 22 (2000), 4–37. [KBKG08] Kohlmann P., Bruckner S., Kanitsar A., Gr¨ oller M.:The LiveSync Interaction Metaphor for Smart User-Intended Visualization. Tech. Rep. TR-186-2-08-01, Institute of Computer Graphics and Algorithms, Vienna University of Technology, Favoritenstrasse 9-11/186, A- 1040 Vienna, Austria, Jan. 2008. [KD98] Kindlmann G., Durkin J.: Semi-automatic generation of transfer functions for direct volume rendering. In IEEE Symposium on Volume Visualization (October 1998), IEEE Press, pp. 79–86. [KH10] Kirk D. B., Hwu W.-m. W.:Programming Massively Parallel Processors: A Hands-on Approach, 1st ed. Morgan Kaufmann Publishers Inc., San Francisco, CA, USA, 2010. [KKH01] Kniss J., Kindlmann G., Hansen C.: Interactive volume rendering using multi-dimensional transfer functions and direct manipulation widgets. In Proc. of the conference on Visualization 2001 (2001), IEEE Press., pp. 255–262. Appendix B SimpleOpenCL 69 [KSW06] Kr¨ uger J., Schneider J., Westermann R.: Clearview: An interactive context preserving hotspot visualization technique. IEEE Trans. on Visualization and Computer Graphics (Proc. Visualization / Information Visualization 2006) 12, 5 (sepoct 2006). [MAB⇤97] Marks J., Andalman B., Beardsley P. A., Freeman W., Gibson S., Hodgins J., Kang T., Mirtich B., Pfister H., Ruml W., Ryall K., Seims J., Shieber S.: Design galleries: a general approach to setting parameters for computer graphics and animation. Computer Graphics 31, Annual Conference Series (1997), 389–400. [MB05] Manvi S. S., Birje M. N.: An agent-based resource allocation model for grid computing. In Services Computing, 2005 IEEE International Conference on (July 2005), vol. 1, pp. 311–314 vol.1. [Mic09] Micikevicius P.: 3d finite di↵erence computation on gpus using cuda. In Proceedings of 2nd Workshop on General Purpose Processing on Graphics Processing Units (2009), pp. 79–84. [mon11] 2011. http://montblanc-project.eu/home. [mov] //movibio.lsi.upc.edu/website. [NL07] Nyland L. Harris M. P. J.:Fast n-body simulation with CUDA. 2007. [NVI12] NVIDIA: Cuda dynamic parallelism programming guide. [par13] 2013. http://www.parallella.org. [PLB⇤01] Pfister H., Lorensen B., Baja C., Kindlmann G., Shroeder W., Avila L., Raghu K., Machiraju R., Lee J.: The transfer function bake-o↵.IEEE Computer Graphics & Applications 21, 3 (2001), 16–22. [Rob] Roberts M.:. //www.cs.colostate.edu/⇠mroberts/toolbox/c ++/ sparseMatrix/sparsematrixcompression.html. [SHL⇤06] Shi Z., Huang H., Luo J., Lin F., Zhang H.: Agent-based grid computing. Applied Mathematical Modelling 30, 7 (2006), 629 – 640. Parallel and Vector Processing in Science and Engineering Parallel and Vector Processing in Science and Engineering. [TLM03] Tzeng F. Y., Lum E., Ma K. L.: A novel interface for higher dimensional classification of volume data. In Visualization 2003 (2003), IEEE Computer Society Press, pp. 16–23. [TM04] Tzeng F.-Y., Ma K.-L.: A cluster-space visual interface for arbitrary dimensional classification of volume data. In Proceedings of the Joint Eurographics-IEEE TVCG Symposium on Visualization 2004 (May 2004). Appendix B SimpleOpenCL 70 [TTG95] Torrellas J., Tucker A., Gupta A.: Evaluating the performance of cache-affinity scheduling in shared-memory multiprocessors. Journal of Parallel and Distributed Computing 24, 2 (1995), 139 – 151. [VKG05] Viola I., Kanitsar A., Gr¨ oller M. E.: Importance-driven feature enhancement in volume visualization. IEEE Trans. on Visualization and Computer Graphics 11, 4 (2005), 408–418. [YSMR10] Yudanov D., Shaaban M., Melton R., Reznik L.: Gpu-based simulation of spiking neural networks with real-time performance and high accuracy. In WCCI-2010, Special Session Computational Intelligence on Consumer Games and Graphics Hardware CIGPU-2010 (2010). [zii10] Ziilabs official OpenCL webpage: http://www.ziilabs.com/products/software/opencl.php. Tech. rep., Ziilabs, 2010.