<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>FasTensor | UCSC OSPO</title><link>https://deploy-preview-1007--ucsc-ospo.netlify.app/tag/fastensor/</link><atom:link href="https://deploy-preview-1007--ucsc-ospo.netlify.app/tag/fastensor/index.xml" rel="self" type="application/rss+xml"/><description>FasTensor</description><generator>Wowchemy (https://wowchemy.com)</generator><language>en-us</language><lastBuildDate>Fri, 30 Aug 2024 00:00:00 +0000</lastBuildDate><image><url>https://deploy-preview-1007--ucsc-ospo.netlify.app/media/logo_hub6795c39d7c5d58c9535d13299c9651f_74810_300x300_fit_lanczos_3.png</url><title>FasTensor</title><link>https://deploy-preview-1007--ucsc-ospo.netlify.app/tag/fastensor/</link></image><item><title>Final Report: Stream processing support for FasTensor</title><link>https://deploy-preview-1007--ucsc-ospo.netlify.app/report/osre24/lbl/fastensor/20240830-aditya_narayan/</link><pubDate>Fri, 30 Aug 2024 00:00:00 +0000</pubDate><guid>https://deploy-preview-1007--ucsc-ospo.netlify.app/report/osre24/lbl/fastensor/20240830-aditya_narayan/</guid><description>&lt;h1 id="final-report-stream-processing-support-for-fastensor">Final Report: Stream processing support for FasTensor&lt;/h1>
&lt;h2 id="project-description">Project Description&lt;/h2>
&lt;p>FasTensor is a scientific computing library specialized in performing computations over dense matrices that exhibit spatial locality, a characteristic often found in physical phenomena data. Our GSoC'24 project aimed to enhance FasTensor by enabling it to ingest and process live data streams from sensors and scientific equipment.&lt;/p>
&lt;h2 id="what-is-fastensor">What is FasTensor?&lt;/h2>
&lt;p>Imagine you&amp;rsquo;re working on a physical simulation or solving partial differential equations (PDEs). You&amp;rsquo;ve discretized your PDE, but now you face a new challenge: you need to run your computations fast and parallelize them across massive compute clusters.&lt;/p>
&lt;p>At this point, you find yourself describing a stencil &lt;a href="https://dl.acm.org/doi/abs/10.1145/2686745.2686756" target="_blank" rel="noopener">[1]&lt;/a> operation. But should you really spend your time tinkering with loop orders, data layouts, and countless other side-quests unrelated to your core problem?&lt;/p>
&lt;p>This is where FasTensor comes in: Describe your computation as a stencil, and it takes care of ensuring optimal execution. FasTensor lets you focus on the science, not the implementation details.&lt;/p>
&lt;h2 id="repository-links">Repository Links&lt;/h2>
&lt;ul>
&lt;li>FasTensor: &lt;a href="https://github.com/BinDong314/FasTensor" target="_blank" rel="noopener">https://github.com/BinDong314/FasTensor&lt;/a>&lt;/li>
&lt;li>My fork: &lt;a href="https://github.com/my-name/FasTensor/tree/ftstream" target="_blank" rel="noopener">https://github.com/my-name/FasTensor/tree/ftstream&lt;/a>&lt;/li>
&lt;/ul>
&lt;h3 id="prs">PR(s)&lt;/h3>
&lt;ol>
&lt;li>&lt;a href="https://github.com/BinDong314/FasTensor/pull/1" target="_blank" rel="noopener">Stream processing support for FasTensor completed.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/BinDong314/FasTensor/pull/2" target="_blank" rel="noopener">Merge ftstream into the FasTensor repo&lt;/a>&lt;/li>
&lt;/ol>
&lt;h2 id="work-done-this-summer">Work done this summer&lt;/h2>
&lt;h3 id="develop-streaming-simulator-ftstream">Develop Streaming simulator: FTStream&lt;/h3>
&lt;p>I was first entasked by Dr. Bin to develop a stream simulator for testing the streaming capability of FasTensor. For testing purposes, a stream is characterized by file size, count, and arrival interval. FTStream can generate streams of various sizes and intervals, up to the theoretical limits of disk and filesystem. We&amp;rsquo;re talking speeds up to 2.5 GiB/s on a non-parallel NVMe!&lt;/p>
&lt;p>Writing this tool was an adventure in throughput testing and exploring APIs. I wrote multiple drivers, each for a different whim and hijinks of systems in the HPC world. Here&amp;rsquo;s a brief journey through the APIs we explored:&lt;/p>
&lt;ol>
&lt;li>
&lt;p>&lt;strong>HDF5 APIs:&lt;/strong> Pretty fast in flush-to-disk operation, but the API design strongly binds to file handles, which inhibits high throughput duplication.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>HDF5 VFL and VOL:&lt;/strong> We dabbled in these dark arts, but there be dragons! Keeping a long-term view of maintenance, we dropped the idea.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>POSIX O_DIRECT:&lt;/strong> This involved getting your buffers aligned right and handling remainders correctly. A step up, but not quite at the theoretical limits.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Linux AIO:&lt;/strong> Streaming is latency sensitive domain, to reach the theoretical limits, every syscall saved matters. Linux AIO allowed us syscall batching with &lt;code>io_submit()&lt;/code>. It took a few testing sessions to get the correct combo of queue depth, buffer size, and alignment right.&lt;/p>
&lt;/li>
&lt;/ol>
&lt;p>We settled on O_DIRECT + Linux AIO. Feel free to modify &lt;code>ftstream/fastflush.h&lt;/code> to suit your needs.&lt;/p>
&lt;img src="https://raw.githubusercontent.com/aditya-narayan5/GSoC24-Final_Report/f486087ae3e6ef1f1077c885e9352c9440848724/images/ftstream.png" width=75% height=75%>
&lt;h3 id="stream-support">Stream Support&lt;/h3>
&lt;p>FasTensor has just one simple paradigm: you give it a data source, an output data store, and your transform, and it handles all the behind-the-scenes grunt work of computing over big datasets so you can focus on your research.&lt;/p>
&lt;p>We aimed to achieve the same for streaming: Drop in the STREAM keyword, append a pattern identifying your stream, and use your usual transform.&lt;/p>
&lt;img src="https://raw.githubusercontent.com/aditya-narayan5/GSoC24-Final_Report/f486087ae3e6ef1f1077c885e9352c9440848724/images/example_code.png" width=75% height=100%>
Voila! Now your previous FasTensor code supports live data streams.
&lt;img src="https://raw.githubusercontent.com/aditya-narayan5/GSoC24-Final_Report/da34fab7a857b0223332d84a0aa1c8cdf0811761/images/fastensor_streaming_demo.gif" width=75% height=75%>
&lt;h4 id="technical-tidbits">Technical tidbits:&lt;/h4>
&lt;ul>
&lt;li>Implements a manager-worker pattern to allow us flexibility in the future to implement different stream semantics such as windowing, CPU-memory based load balancing&lt;/li>
&lt;li>Supports streams of indefinite size&lt;/li>
&lt;/ul>
&lt;h2 id="challenges">Challenges&lt;/h2>
&lt;p>HPC has its fair share of challenges. Things you take for granted might not be available there, and it takes a while to adjust to paradigms of scale and parallelization.&lt;/p>
&lt;p>For example, when developing FTStream, we found O_DIRECT is available on some parallel file systems like GPFS but not supported on Lustre/CFS. We developed a separate MPIO driver for FTStream that will be upstreamed once thoroughly tested on Lustre.&lt;/p>
&lt;h2 id="future-work">Future Work&lt;/h2>
&lt;ul>
&lt;li>Implement windowing and explore more advanced stream semantics.&lt;/li>
&lt;li>Implement support for for defining workload policies&lt;/li>
&lt;li>Optimize interleaving IO and Compute.&lt;/li>
&lt;/ul>
&lt;h2 id="references">References&lt;/h2>
&lt;p>[1] Anshu Dubey. 2014. Stencils in Scientific Computations. In Proceedings of the Second Workshop on Optimizing Stencil Computations (WOSC &amp;lsquo;14). Association for Computing Machinery, New York, NY, USA, 57.
&lt;a href="https://doi.org/10.1145/2686745.2686756" target="_blank" rel="noopener">https://doi.org/10.1145/2686745.2686756&lt;/a>&lt;/p>
&lt;h2 id="acknowledgement">Acknowledgement&lt;/h2>
&lt;p>I struck gold when it comes to mentors.&lt;/p>
&lt;p>Dr. &lt;a href="https://deploy-preview-1007--ucsc-ospo.netlify.app/author/bin-dong/">Bin Dong&lt;/a> was really kind and supportive throughout the journey. From the very first steps of giving a tour around the codebase to giving me a lot of freedom to experiment, refactor, and refine.&lt;/p>
&lt;p>Dr. &lt;a href="https://deploy-preview-1007--ucsc-ospo.netlify.app/author/john-wu/">John Wu&lt;/a> was encouraging and nurturing of budding talent. We had great research presentations every Monday apart from usual mentor interactions, where different research groups presented their talks and students were invited to present their progress.&lt;/p>
&lt;p>I&amp;rsquo;ve come across Quantum computing many times in the news, but I never thought I&amp;rsquo;d get a frontline preview from the researchers working at the bleeding edge at the Lawrence Berkeley National Laboratory (LBL).&lt;/p>
&lt;p>This GSoC experience, made possible by Google and UC OSPO, has been invaluable for my growth as a developer and researcher.&lt;/p>
&lt;p>For people interested in HPC, ML, Systems, or Reproducibility, I encourage you all to apply to UC OSPO. It&amp;rsquo;s been an incredible journey, and I&amp;rsquo;m grateful for every moment of it!&lt;/p></description></item><item><title>Streaming into the Future: Adding Real-Time Processing to FasTensor</title><link>https://deploy-preview-1007--ucsc-ospo.netlify.app/report/osre24/lbl/fastensor/20240730-aditya_narayan/</link><pubDate>Tue, 30 Jul 2024 00:00:00 +0000</pubDate><guid>https://deploy-preview-1007--ucsc-ospo.netlify.app/report/osre24/lbl/fastensor/20240730-aditya_narayan/</guid><description>&lt;p>Hey there, HPC enthusiasts and fellow coders! I&amp;rsquo;m excited to share my progress on this summer&amp;rsquo;s Google Summer of Code project under UC OSPO&amp;rsquo;s FasTensor.
Here&amp;rsquo;s a glimpse into how we&amp;rsquo;re pushing the boundaries of real-time data processing.&lt;/p>
&lt;h2 id="the-big-picture-fastensor-and-hpc-challenges">The Big Picture: FasTensor and HPC Challenges&lt;/h2>
&lt;p>First, a quick refresher: FasTensor is our go-to tool for handling dense arrays in scientific computing. It tackles three major HPC challenges:&lt;/p>
&lt;ul>
&lt;li>
&lt;p>Optimizing computations&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Distributing data efficiently&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Balancing workloads across computing cores&lt;/p>
&lt;/li>
&lt;/ul>
&lt;p>FasTensor excels at these tasks, especially when dealing with data that has structural locality - a common feature in scientific computing. Here, the Stencil computations come in handy, capturing data locality for operations like solving partial differential equations in physical simulations.&lt;/p>
&lt;h3 id="the-mission-bringing-fastensor-into-real-time">The Mission: Bringing FasTensor into Real-Time&lt;/h3>
&lt;p>While FasTensor is great at processing existing data, the next frontier is handling live data streams from scientific instruments and sensors. That&amp;rsquo;s where my GSoC project comes in: adding stream processing capabilities to FasTensor.&lt;/p>
&lt;h2 id="progress-highlights">Progress Highlights:&lt;/h2>
&lt;h3 id="building-a-stream-simulator">Building a Stream Simulator&lt;/h3>
&lt;p>We&amp;rsquo;ve created FTstream, a nifty tool that simulates data streams. It can generate streams of various sizes and intervals, pushing the limits of what your disk can handle. We&amp;rsquo;re talking speeds up to 2.5 GiB/s on a non-parallel NVMe! This tool is crucial because many scientific instruments, from particle accelerators to radio telescopes, generate massive amounts of data at incredible speeds and we need to able to simulate that. For context, that&amp;rsquo;s faster than a 10MP RGB camera shooting at 35 frames per second that generates data at ~1 GiB/s.
&lt;figure >
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img alt="FTStream: a stream simulator" srcset="
/report/osre24/lbl/fastensor/20240730-aditya_narayan/ftstream_hu742d341e5ed79c96d79ca4fdb4fe00ee_107361_e1ff5502d16324d112780cafc587c0bb.webp 400w,
/report/osre24/lbl/fastensor/20240730-aditya_narayan/ftstream_hu742d341e5ed79c96d79ca4fdb4fe00ee_107361_9ecceb72d631078c6b5109deaefeb0f5.webp 760w,
/report/osre24/lbl/fastensor/20240730-aditya_narayan/ftstream_hu742d341e5ed79c96d79ca4fdb4fe00ee_107361_1200x1200_fit_q75_h2_lanczos_3.webp 1200w"
src="https://deploy-preview-1007--ucsc-ospo.netlify.app/report/osre24/lbl/fastensor/20240730-aditya_narayan/ftstream_hu742d341e5ed79c96d79ca4fdb4fe00ee_107361_e1ff5502d16324d112780cafc587c0bb.webp"
width="760"
height="410"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/p>
&lt;h3 id="optimizing-io-strategies">Optimizing I/O Strategies&lt;/h3>
&lt;p>We&amp;rsquo;ve been experimenting with various I/O approaches to optimize high-speed data stream handling.&lt;/p>
&lt;h3 id="exploring-streaming-semantics">Exploring Streaming Semantics&lt;/h3>
&lt;p>We&amp;rsquo;re investigating various ways to express and execute stream transformations, to ensure that FasTensor can handle a wide range of streaming computations.&lt;/p>
&lt;h3 id="developing-io-drivers">Developing I/O Drivers&lt;/h3>
&lt;p>We&amp;rsquo;ve developed two new I/O drivers based on LinuxAIO and MPI IO to ingest incoming data smoothly and maintain stream consistency.&lt;/p>
&lt;h2 id="whats-next">What&amp;rsquo;s Next?&lt;/h2>
&lt;h3 id="putting-it-all-together">Putting It All Together&lt;/h3>
&lt;p>We&amp;rsquo;re in the final stretch of integrating all these components into a seamless stream processing system.&lt;/p>
&lt;h3 id="rigorous-testing">Rigorous Testing&lt;/h3>
&lt;p>We&amp;rsquo;ll push our stream processing to its limits, simulating diverse data flows to ensure rock-solid performance in any scientific setting.&lt;/p>
&lt;h3 id="hpc-environment-validation">HPC Environment Validation&lt;/h3>
&lt;p>The ultimate test will be running our new streaming capabilities in real HPC environments, checking how they perform with different I/O setups and computing paradigms.&lt;/p>
&lt;h2 id="wrapping-up">Wrapping Up&lt;/h2>
&lt;p>This summer has been a whirlwind of coding, testing, and learning. We&amp;rsquo;re making significant strides in bringing real-time processing capabilities to FasTensor, which could open up exciting new possibilities in scientific computing and data analysis.
Stay tuned for more updates as we finalize this feature. If you&amp;rsquo;re interested in the nitty-gritty technical details or want to check out the code, feel free to reach out or check our project repository.
Happy coding, and may your computations be ever faster!&lt;/p></description></item><item><title>Stream Processing support for FasTensor</title><link>https://deploy-preview-1007--ucsc-ospo.netlify.app/report/osre24/lbl/fastensor/20240613-aditya_narayan/</link><pubDate>Thu, 13 Jun 2024 00:00:00 +0000</pubDate><guid>https://deploy-preview-1007--ucsc-ospo.netlify.app/report/osre24/lbl/fastensor/20240613-aditya_narayan/</guid><description>&lt;p>Hi, I&amp;rsquo;m Aditya Narayan,👋&lt;/p>
&lt;p>I&amp;rsquo;m a frequent visitor to the town square of theoretical CS, operations (Ops), and robust high-performance systems. Sometimes I indulge myself with insights on &lt;a href="https://www.science.org/doi/10.1126/science.aam9868" target="_blank" rel="noopener">Computing and Biology&lt;/a>, and other times I enjoy the accounts of minefield experiences in the &lt;a href="https://www.youtube.com/watch?v=tDacjrSCeq4" target="_blank" rel="noopener">systems world&lt;/a>. Luckily, this summer, OSRE offered an opportunity that happened to be at the perfect intersection of my interests.&lt;/p>
&lt;p>This summer, I will be working on a scientific computing library called FasTensor that offers a parallel computing structure called Stencil, widely popular in the scientific computing world to solve PDEs for Physical Simulations and Convolutions on Signals, among its many uses.
I am excited to introduce my mentors, Dr. &lt;a href="https://deploy-preview-1007--ucsc-ospo.netlify.app/author/bin-dong/">Bin Dong&lt;/a> and Dr. &lt;a href="https://deploy-preview-1007--ucsc-ospo.netlify.app/author/john-wu/">John Wu&lt;/a> of the &lt;a href="https://crd.lbl.gov/divisions/scidata/sdm/" target="_blank" rel="noopener">Scientific Data Management Group&lt;/a> at Lawrence Berkeley National Laboratory (LBNL). They bring invaluable expertise to the project.&lt;/p>
&lt;p>They recognized the need for a tensor processing library that provided dedicated support for big datasets with inherent structural locality, often found in the scientific computing world, which was lacking in popular open-source MapReduce or Key-Value based frameworks.&lt;/p>
&lt;p>More often than not, the operations performed on these datasets are composed of computations involving neighboring elements. This motivated the development of the FasTensor library.&lt;/p>
&lt;p>I will be working on providing a Stream Processing interface that enables online data processing of large-scale datasets as they arrive from Data Producers. The project focuses on offering rich interfaces for managing and composing streams, supporting common scientific data formats like HDF5, and integrating fault tolerance and reliability mechanisms.&lt;/p>
&lt;p>I am thrilled to work on the FasTensor project because I believe it has the potential to make a significant impact by enabling researchers to implement a rich set of computations on their big datasets in an easy and intuitive manner.&lt;/p>
&lt;p>After all, FasTensor has just one simple paradigm: A -&amp;gt; Transform(F(x), B),&lt;/p>
&lt;p>and it handles all the behind-the-scenes grunt work of handling big datasets so you can focus on your research.&lt;/p>
&lt;p>Stay tuned for updates and feel free to &lt;a href="https://github.com/BinDong314/FasTensor" target="_blank" rel="noopener">collaborate&lt;/a>!&lt;/p></description></item></channel></rss>