<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ben van Werkhoven on Medium]]></title>
        <description><![CDATA[Stories by Ben van Werkhoven on Medium]]></description>
        <link>https://medium.com/@benvanwerkhoven?source=rss-dd7190d774a4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*7n1RQvquOio2ZLEnzWCw-g.jpeg</url>
            <title>Stories by Ben van Werkhoven on Medium</title>
            <link>https://medium.com/@benvanwerkhoven?source=rss-dd7190d774a4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 22:50:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@benvanwerkhoven/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Versioned documentation using only GitHub actions and GitHub pages]]></title>
            <link>https://medium.com/escience-center/versioned-documentation-using-only-github-actions-and-github-pages-1825296e31aa?source=rss-dd7190d774a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/1825296e31aa</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[kernel-tuner]]></category>
            <category><![CDATA[research-software]]></category>
            <category><![CDATA[gpu]]></category>
            <category><![CDATA[versioned-documentation]]></category>
            <dc:creator><![CDATA[Ben van Werkhoven]]></dc:creator>
            <pubDate>Thu, 20 Oct 2022 09:00:05 GMT</pubDate>
            <atom:updated>2022-10-20T09:00:05.766Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<p>Today, I tried something new. Something that I wanted to have for quite a while for one of the main software projects that I’m working on. And that is: versioned documentation. With that, I mean to have multiple different versions of the documentation that reflect the different released versions of the software. Let me start with explaining the current setup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WX6X6-C4K_C8Mrc4tyQJKA.png" /></figure><p>Currently, we have a GitHub action that generates updated Sphinx doc documentation pages whenever something is committed, or preferably, merged into the main branch of the repository. The generated HTML pages are pushed to the root directory of the gh-pages branch of the repository, which is then served by GitHub as a website hosting the documentation for our software. This in itself works really great. So far, so good.</p><p>Now the problem is basically that we don’t make new releases of the software all that often. So the version that is installed using the package manager can actually lag quite a bit behind on the latest developments in the main branch. This is especially nerve wrecking if you realize right before you are about to give an instructor-led tutorial on your software, that there is a rather large mismatch between the version of the software users will install and the documentation pages hosted online.</p><blockquote>Anyone reading this may think: “why aren’t you just using readthedocs, which has features to do all of this automatically for you?” A fair question! If you are already using readthedocs for your project, but would like to try a more self-contained solution without compromising on versioning, please read on! My own reason for not using readthedocs is basically that I don’t want to rely on another service by another third-party. Especially, if one of the service providers that I’m already relying upon (in this case GitHub) has everything that we need to avoid relying on yet another service by another party. On the other hand, I sometimes worry about becoming too reliant on GitHub, but that’s for another blogpost.</blockquote><p>In this case, we use the the Python package index (PyPI) and users may simply install the software using “pip install <a href="https://github.com/KernelTuner/kernel_tuner">kernel_tuner</a>”. When developments continue for a few months without a release, the documentation pages hosted on GitHub pages will reflect those recent developments, which may include new features or changes that are not present in the version that users receive when they “pip install” the latest version.</p><p>So the main question that I’ll try to answer in this article is: How can we use just GitHub to create versioned documentation pages?</p><p>I solved this in a few simple steps:</p><ol><li>Keep the current GitHub action for generating new documentation after changes on the main branch, but host these in the /latest/ directory.</li><li>Create a new GitHub action that triggers when we create a new release to generate documentation pages for that specific release, use a symlink stable to point to the latest released version.</li><li>Retroactively generate documentation for all previously released versions.</li><li>Redirect the main repository URL to the documentation in /stable/</li></ol><p>1 The first change that we’ll make is to keep the current setup of generating the documentation whenever something changes on the main branch, but instead of pushing the generated HTML pages to the root directory of our gh-pages branch, we’ll instead push it into the ‘latest’ directory.</p><p>We need to modify <a href="https://github.com/KernelTuner/kernel_tuner/blob/51f353535ce2bc682cf40944eb8b52a46b0dd71d/.github/workflows/docs.yml">our current GitHub action</a>, which is based on the<a href="https://github.com/sphinx-notes/pages"> sphinx-notes/pages</a> action. Specifically, I was using the action sphinx-notes/pages@master, but to my surprise the master version is behind the newer versions of this action. I’m now using sphinx-notes/pages@v2, because it supports the target_path option, which we can use to make sure our documentation pages are stored in the /latest/ directory rather than the root directory of our gh-pages branch.</p><p>2 Step 2 is the most elaborate part of this post. I was looking into GitHub actions that would trigger when someone creates a new release of the software. When searching for this online, I mostly ran into questions on Stackoverflow from people who did not manage to get their GitHub actions to <a href="https://stackoverflow.com/questions/69063452/github-actions-on-release-created-workflow-trigger-not-working">trigger properly when new releases were created</a>. Not a very good sign when you are just starting to look into how to get something done.</p><p>The main issue is apparently that actions that trigger on the creation of a new release do not necessarily trigger for creating a <em>draft</em> release, and the ‘creation’ trigger of the release can be skipped entirely when an external tool is used to create the GitHub release. There were some suggested solutions to these problems, but most of these seemed overly complicated, and also not really related to the underlying issue. Luckily, <a href="https://stackoverflow.com/a/61066906">someone answered on another question about this issue</a> to use on:release:published instead of on:release:created to avoid all of the issues related to triggering workflows on new software releases.</p><p>With this knowledge, we can easily modify the basic usage of the sphinx-notes/pages action to use the trigger on:release:published instead of on:push:branches:-master. However, we still need to ensure that the generated documentation is stored in a directory specific for that version. So we need extract the version number from GitHub so that we can use it inside the action. Luckily, <a href="https://stackoverflow.com/questions/69063452/github-actions-on-release-created-workflow-trigger-not-working">someone in one of the stackoverflow discussions</a> provided a line for this in their code:</p><pre>- name: Set env<br>  run: echo &quot;RELEASE_VERSION=${GITHUB_REF#refs/*/}&quot; &gt;&gt; $GITHUB_ENV</pre><p>After this, we can use $RELEASE_VERSION inside our workflow as a variable that contains the version number of the release currently being published. This means we can further modify our action to use $RELEASE_VERSION as the target_path for our sphinx-nodes/pages action to ensure that the generated HTML documentation pages are stored in a directory named after our version. I first tried to use:</p><pre>- name: Build and Commit <br>  uses: sphinx-notes/pages@v2<br>  with: <br>    documentation_path: doc/source <br>    target_path: $RELEASE_VERSION</pre><p>But for reasons that are obscure to me, this didn’t work. A directory was created with the name “$RELEASE_VERSION”. The variable was not evaluated, but basically treated literally as a fancy string starting with a dollar sign and someone shouting RELEASE_VERSION in full caps. After referring back to the <a href="https://stackoverflow.com/questions/69063452/github-actions-on-release-created-workflow-trigger-not-working">same stackoverflow issue</a>, I noticed there was another way to use the variable, which lead me to try:</p><pre>- name: Build and Commit<br>  uses: sphinx-notes/pages@v2<br>  with:<br>    documentation_path: doc/source<br>    target_path: ${{ env.RELEASE_VERSION }}</pre><p>And this worked like a charm! Now finally, I wanted to have the URL /stable/ to point to the most recently released version. For this, I’ll be using a symlink. So after the “Build and Commit” step, but before the “Push changes” step, I’m introducing another step in the workflow:</p><pre>- name: Redirect stable to new release<br>  run: |<br>    echo &quot;Redirecting stable to newly released version&quot; <br>    ln -sf $RELEASE_VERSION stable<br>    git add stable<br>    git commit -m &quot;redirect stable to new version $RELEASE_VERSION&quot;</pre><p>This set of commands removes the old ‘stable’ symlink, if there is any, and creates a new link named stable that points to the value of $RELEASE_VERSION. We then add the file to the git repo, which is already configured to commit as a ‘GitHub actions user’ and is already set on the gh-pages branch thanks to the previous ‘Build and Commit’ step in our workflow. The resulting GitHub action workflow file can be found here:</p><p><a href="https://github.com/KernelTuner/kernel_tuner/blob/master/.github/workflows/docs-on-release.yml">https://github.com/KernelTuner/kernel_tuner/blob/master/.github/workflows/docs-on-release.yml</a></p><p>This ensures that versioned documentation will be automatically created for us for all new releases. However, we already had a couple of releases over the last six years. To retroactively generate documentation pages for those, we move to step 3.</p><p>3 Going through all of the previous releases, generating documentation for those, and pushing them to the right directory on the gh-pages branch, first appeared to me as a daunting, mind-numbing, “oh-this-is-going-to-be-a-lot-of-manual-labour” task.</p><p>Fortunately, the actual commands used to generate the documentation pages never changed since the first version. This actually means that once we know how to do it for one version, automating the procedure for all previous versions with a simple bash script is trivial:</p><pre>versions=`git tag -l`</pre><pre>for version in $versions; do</pre><pre>  git checkout tags/$version<br>  cd doc<br>  rm -rf build<br>  make html<br>  cd ..<br>  git checkout gh-pages<br>  mkdir $version<br>  cp -r doc/build/html/* $version/<br>  git add $version<br>  git commit -m &quot;generate documentation for version $version&quot;</pre><pre>done</pre><p>First, we can use git to query all released versions, which correspond to ‘tags’ in git. The command git tag -l generates a list of all released versions of our repo. This allows us to iterate over all versions of our software, using a simple for loop in bash.</p><p>In this loop, we “git checkout” the specific tag. This brings our local git repository in the dreaded “detached HEAD” state. Fortunately for us this doesn’t matter this time, since we are only going to read from this state. Usually when I end up with my HEAD detached, I try to undo whatever I was doing and get the hell out of there as fast as possible. But trust me, for what we are doing here: it’s OK.</p><p>Using the version of the repository at this specific tag, we can generate the HTML documentation as it was when this version was released. Note that our git repository is configured to not track files in the “doc/build” directory, so we are not changing anything in our “detached HEAD” state and we can safely leave this state again without git starting to complain and not allowing you to leave this limbo state. Then, we checkout the gh-pages branch and copy the recently build HTML pages to a directory named for this version. Finally, we commit the changes to the gh-pages branch and proceed to the next tag in the list provided by git. Rinse and repeat, for all released versions of our software.</p><p>4 Step 4 is really simple. I wanted our main repository URL to redirect to the /stable/ URL. The idea behind this is that most users will likely install the software using PyPI and therefore the default location for the documentation should correspond with the latest version present in PyPI.</p><p>After cleaning up the old HTML files in the root of the gh-pages branch, I created an index.html file with the following contents:</p><pre>&lt;html&gt;<br> &lt;head&gt;<br>  &lt;meta http-equiv=&quot;refresh&quot; content=&quot;0; url=stable/&quot; /&gt;<br> &lt;/head&gt;<br>&lt;/html&gt;</pre><p>And that’s all! We now have versioned documentation pages for all of our released versions, including all previous releases. A <a href="https://kerneltuner.github.io/kernel_tuner/stable/">/stable/</a> that points to the documentation of most recently released version of the software. A <a href="https://kerneltuner.github.io/kernel_tuner/latest/">/latest/</a> that contains the documentation corresponding to the latest developments in the main branch. And an automated workflow that generates versioned documentation whenever we create a new version and updates the location pointed to by /stable/. And all of this using only GitHub actions and GitHub pages.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1825296e31aa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/escience-center/versioned-documentation-using-only-github-actions-and-github-pages-1825296e31aa">Versioned documentation using only GitHub actions and GitHub pages</a> was originally published in <a href="https://medium.com/escience-center">Netherlands eScience Center</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kernel Tuner tutorial at Supercomputing 2021]]></title>
            <link>https://medium.com/escience-center/kernel-tuner-tutorial-at-supercomputing-2021-d97444d6961a?source=rss-dd7190d774a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/d97444d6961a</guid>
            <category><![CDATA[gpu]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[conference]]></category>
            <category><![CDATA[supercomputing]]></category>
            <category><![CDATA[kernel-tuner]]></category>
            <dc:creator><![CDATA[Ben van Werkhoven]]></dc:creator>
            <pubDate>Thu, 25 Nov 2021 15:20:48 GMT</pubDate>
            <atom:updated>2021-11-25T15:20:48.212Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<p><a href="https://www.esciencecenter.nl/team/dr-ben-van-werkhoven/">Ben van Werkhoven</a>, <a href="https://www.esciencecenter.nl/team/dr-alessio-sclocco/">Alessio Sclocco</a>, <a href="https://www.esciencecenter.nl/team/stijn-heldens-msc/">Stijn Heldens</a>, <a href="https://www.esciencecenter.nl/team/floris-jan-willemsen/">Floris-Jan Willemsen</a> (<a href="https://www.esciencecenter.nl/">Netherlands eScience Center</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*msfW7zq3-awfNStVOT-xBQ.jpeg" /><figcaption>A view of St. Louis from the Gateway Arch. Photo by Floris-Jan Willemsen.</figcaption></figure><p>November 2021 — Together with my colleagues, Alessio Sclocco, Stijn Heldens, and Floris-Jan Willemsen, we travelled to the latest edition of the <a href="https://sc21.supercomputing.org/">Supercomputing conference</a>, SC21, in St. Louis, USA, to give a tutorial.</p><p>The goal of the tutorial was to teach Supercomputing attendees how to use <a href="https://github.com/benvanwerkhoven/kernel_tuner">Kernel Tuner</a>, a tool that is being developed at the Netherlands eScience Center to assist in the development of highly-optimized applications for Graphics Processing Units (or GPUs). These GPUs form the primary source of compute power in many of today’s supercomputers. However, optimizing applications to run efficiently on GPUs can be challenging, and that’s where Kernel Tuner comes into play.</p><p>The tutorial was divided into four sections, each consisting of a short presentation followed by a hands-on session, in which the attendees get to practice using the tool on some of the example codes that we provided.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ModR0KTUHXWxS-IlCs0f_A.jpeg" /><figcaption>Dr. Ben van Werkhoven presenting at the Kernel Tuner tutorial at SC21. Photo by Floris-Jan Willemsen.</figcaption></figure><p>The first session explained the problem that Kernel Tuner is aiming to solve, namely the problem that creating GPU applications with optimal performance is a bit like trying to find a needle in a haystack. This is because the developer has a great number of choices to make when creating a GPU application. These choices won’t affect the outcome of the program, but they can have a dramatic impact on the time it takes to perform the computations. All implementation choices combined create a huge program design space of potential implementations that all compute the same thing, but in different ways. Using several examples, I explained that while using auto-tuning to optimize GPU applications may be a complex process, it can also be really rewarding when you find those few configurations that outperform all others by a large margin.</p><p>For the hands-on sessions, we made use of <a href="https://colab.research.google.com/?utm_source=scs-index">Google Colab</a>, which allows anyone with a Google account to run Jupyter notebooks on Google’s cloud services. There are several providers of similar services, but the great thing about Colab is that you can get a virtual machine with a GPU, which is exactly what we need to get started with tuning GPU kernels. Colab turned out to be a great choice for the tutorial, because it can be accessed from a browser without the need for participants to install any software locally, nor do they have to be able to access their own GPU server from the conference network. Because Kernel Tuner is a Python-based tool, the participants could use it right away inside the Jupyter notebook environment and get started on the exercises.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IPaVLwyMntpH4XpMhNToRw.jpeg" /><figcaption>Dr. Alessio Sclocco wrapping up the first hands-on session of the tutorial. Photo by Floris-Jan Willemsen.</figcaption></figure><p>During the hands-on sessions, the attendees read about the exercises in the notebook at hand and attempt to solve small example problems. All four of us, including Stijn and Floris-Jan, were busy with answering questions from the attendees regarding the hands-on exercises.</p><p>The second session focused on how to start using Kernel Tuner to optimize existing GPU functions, or kernels, and how to correctly supply Kernel Tuner with the set of possible values for application parameters such as the number of threads per block and the number of thread blocks. Alessio introduced the concept of user-defined metrics that allow the user to instruct Kernel Tuner to calculate certain metrics that are relevant for the application, while it is being benchmarked on the GPU.</p><p>The third and fourth sessions introduced more complex concepts and features of the tool, including how to verify the output of all program variants during tuning and how to integrate auto-tuned GPU kernels into larger applications.</p><p>The response from the audience was really great. The room was as full as the COVID-19 measures would allow. The conference organizers even had to arrange for extra tables to allow all attendees to actively participate. During the lectures and hands-on sessions, we received many in-depth questions about the inner workings of Kernel Tuner and GPU code optimization techniques. We are very grateful for the opportunity to present our work at the Supercomputing conference and we look forward to organizing more tutorials on Kernel Tuner in the coming years.</p><p>The rest of the week, we enjoyed the Supercomputing conference where Floris-Jan Willemsen also presented his paper titled “Bayesian Optimization for auto-tuning GPU kernels” at the <a href="https://www.dcs.warwick.ac.uk/pmbs/pmbs/PMBS/Welcome.html">Performance Modeling, Benchmarking and Simulation of High Performance Computer Systems (PMBS)</a> workshop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GVZ3jeEm-_QWClVazkrQ2g.jpeg" /><figcaption>A view of St. Louis and the Gateway Arch from across the Mississippi river. Photo by Floris-Jan Willemsen.</figcaption></figure><p>In case this blogpost has made you curious about the Kernel Tuner tutorial, we have some great news for you since all the tutorial materials, including the notebooks for the hands-on sessions, <a href="https://github.com/benvanwerkhoven/kernel_tuner_tutorial">are freely available online here</a>.</p><p>To find out more about Kernel Tuner, please see the <a href="https://github.com/benvanwerkhoven/kernel_tuner">Kernel Tuner GitHub repository</a>.</p><p>Funding acknowledgements: The Kernel Tuner tutorial has been made possible by the CORTEX and ESiWACE2 projects. The CORTEX project has received funding from the Dutch Research Council (NWO) in the framework of the NWA-ORC Call (file number NWA.1160.18.316). ESiWACE2 has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 823988.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d97444d6961a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/escience-center/kernel-tuner-tutorial-at-supercomputing-2021-d97444d6961a">Kernel Tuner tutorial at Supercomputing 2021</a> was originally published in <a href="https://medium.com/escience-center">Netherlands eScience Center</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[FAIR Software at the 2019 eScience Symposium]]></title>
            <link>https://medium.com/escience-center/fair-software-at-the-2019-escience-symposium-6117f310aa34?source=rss-dd7190d774a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/6117f310aa34</guid>
            <category><![CDATA[science]]></category>
            <dc:creator><![CDATA[Ben van Werkhoven]]></dc:creator>
            <pubDate>Fri, 29 Nov 2019 10:09:45 GMT</pubDate>
            <atom:updated>2019-12-02T08:00:39.547Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<p>Ben van Werkhoven (Netherlands eScience Center, NL-RSE)<br>James Meakin (Radboud UMC, NL-RSE)<br>Anna-Lena Lamprecht (Utrecht University)<br>Stephan Druskat (DLR, Humboldt Universität zu Berlin)<br>Pablo Rodriguez-Sanchez (Netherlands eScience Center)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KNrkhSFnFt2qKmjn" /></figure><p>FAIR data has been on everybody’s lips for a while. Many think that FAIR software will become “the next big thing” in eScience. Reasons enough to devote a session at the National eScience Symposium to the discussion of FAIR and its meaning for research software.</p><p>James Meakin from Radboud UMC and NL-RSE started by introducing the topic for the session. The FAIR Guiding Principles were defined in 2016 for scientific data management and stewardship (https://doi.org/10.1038/sdata.2016.18), aiming to improve the Findability, Accessibility, Interoperability, and Reusability of research data. Given that software is key to modern science, research software should also be FAIR. How can the FAIR principles be applied to software? What should they be? What challenges exist? How do we get there?</p><p>The session featured three talks and a panel discussion, with the session’s speakers as panel members. We used the <a href="https://www.mentimeter.com/">mentimeter</a> Q&amp;A feature to allow the audience to submit and vote on questions and discussion points for the panel discussion at the end of the session.</p><h3>Anna-Lena Lamprecht: Towards FAIR principles for Research Software</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*REZ4g5M-sEKZr3xF" /></figure><p>Anna-Lena Lamprecht, assistant professor of Software Technology at Utrecht University, presented the main findings from the paper “Towards FAIR principles for research software” (<a href="https://doi.org/10.3233/DS-190026">https://doi.org/10.3233/DS-190026</a>) that she recently published together with several co-authors from the European eScience community: Software and data share some properties, but they are not the same and hence a differentiated interpretation of the FAIR principles is required. For example, one point of ongoing discussion is whether the FAIR principles, which do not demand data to be open, should require software to be open source. Another much-debated relationship has been the one between FAIR and software quality, naturally of great concern in the RSE community. Here it helps to distinguish between form and function of software. FAIR can help to ensure quality of the form of software, but the quality of the functionality of the software goes beyond what FAIR intends to cover.</p><p>After these general considerations, Anna-Lena continued with the proposal for FAIR Guiding Principles for software, taking the FAIR data principles as a starting point. Many of the proposed changes are effectively a rephrasing by replacing “(meta)data” with “software and its associated metadata”. Other changes extend or reinterpret the FAIR data principles because software, in contrast to data, is of composite nature, needs to deal with dependencies and evolve along with the changing eScience ecosystems, and hence often comes in different versions.</p><p>Perhaps the biggest change from the FAIR data principles is in the following principle (a reinterpretation and extension of the original interoperability principle I2):</p><p>“Software use and produce data in types and formats that are formally described using controlled vocabularies that follow the FAIR principles.”</p><p>This is remarkable because it requires FAIR software to only work with FAIR data, whereas FAIR data does not require to have been produced by only FAIR software.</p><p>Anna-Lena’s slides are available at: <a href="https://www.slideshare.net/annalenalamprecht/towards-fair-principles-for-research-software/">https://www.slideshare.net/annalenalamprecht/towards-fair-principles-for-research-software/</a></p><h3>Stephan Druskat: Dare to be mair than just FAIR!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2ROnq10znFWiaBRD" /></figure><p>Stephan Druskat is an RSE working in linguistics, and researching software sustainability with a focus on software citation. With his talk titled “Dare to be mair than just FAIR!” Stephan challenged us to think beyond only the FAIR principles.</p><p>Of course, making digital objects FAIR is a great step in the right direction for research. FAIR enables easier, better, and open science. The momentum that FAIR has gained also allows us to bring other subjects to the attention of policy makers, including research software engineering, and increase the visibility of software sustainability concerns.</p><p>However, FAIR does not imply openness, FAIR does not ensure credit is given where credit is due, and FAIR does not give any guarantees with regard to quality. Stephan suggests that we should perhaps consider “FAIR PLAY” as the application of FAIR principles to software where useful, augmented with rigorously good practice for research software: open sourcing it per default, licensing it respectively, attributing contributions to it for credit, and asserting adequate quality. FAIR PLAY is essentially the good things of FAIR combined with the good things of RSEing.</p><p>An important part of giving proper attribution is to make your software citable and to cite others when you build upon their work. Stephan and others have developed the Citation File Format (<a href="https://citation-file-format.github.io/">https://citation-file-format.github.io/</a>), a metadata format for both humans and machines. While these citation files can be read and manually written, there is also an entire toolbox available to support creation, validation, and conversion of CFF files, and automation is on the horizon, with build plugins and automated updates.</p><p>Stephan’s slides are available at:<br><a href="https://sdruskat.net/2019-11-21-nl-escience-symposium/">https://sdruskat.net/2019-11-21-nl-escience-symposium/</a></p><h3>Pablo Rodríguez-Sánchez: How software development shaped the way I write science</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BxkU-e26uJcd1oex" /></figure><p>Pablo Rodríguez-Sánchez is working as an RSE at the Netherlands eScience Center. His talk was about how software development shaped the way he writes about his research.</p><p>With a great example of communication between Johannes Kepler and Galileo Galilei, Pablo confronted the audience with the fact that, despite great advances in the means of information and communication technology, some parts of scientific communication have not improved over the last four hundred years.</p><p>Pablo defines a scientific paper as a trustworthy and useful piece of encapsulated knowledge, and argues that there are actually many parallels between scientific papers and software. Both should adhere to the properties: consistency, reproducibility, being properly written, having references/dependencies, written by a team, and evolving over time. Instead of only using software development tools to write his paper, Pablo, inspired in what <a href="https://www.carlboettiger.info/2012/05/06/research-workflow.html">other researchers</a> did before, takes it one step further and writes software packages whose output is the paper.</p><p>Using a combination of markdown and knitr, Pablo writes his papers as software packages in a way that all of the content of the paper, graphs and all can be fully reproduced by others who run the software.</p><p>Pablo’s slides are available at:<br><a href="https://pabrod.github.io/NLeSC_symp19-en.html#NLeSC_symp19">https://pabrod.github.io/NLeSC_symp19-en.html#NLeSC_symp19</a></p><h3>Panel Discussion</h3><p>Following the tree talks our speakers gathered on one side of the table for the panel discussion. While Ben was chairing the discussion, James was analyzing the questions that were submitted to mentimeter. The discussion involved questions such as:</p><ul><li>What does metadata mean in the context of software?</li><li>How to make software dependencies FAIR as well?</li><li>Should FAIR Software imply open source?</li><li>Does FAIR/Open Software conflict with the university’s striving for spin-offs/patents/commercialization?</li><li>The discussions are all quite abstract, what can we do concretely?</li></ul><p>Anna-Lena, Stephan, Pablo and also several attendees of the session shared their insights, experiences, perspectives and some speculations, making it a lively and inspiring session.</p><p>With regard to the question what to do concretely, Pablo mentioned “that the main bottleneck for FAIR software is, still, much more basic: many researchers who would like to share their code with FAIRness just don’t know how to begin.” In an effort to provide some concrete pointers on where to begin with making software FAIR, the Netherlands eScience Center and DANS developed <a href="http://fair-software.nl/">fair-software.nl</a>, which was officially launched later that day at the symposium.</p><p>If you would like to join the discussion on FAIR Software, the session’s organizers and the speakers of this session will be using the #fair-software on the <a href="http://ukrse.slack.com/">RSE slack server</a> to continue the discussion on FAIR Software.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6117f310aa34" width="1" height="1" alt=""><hr><p><a href="https://medium.com/escience-center/fair-software-at-the-2019-escience-symposium-6117f310aa34">FAIR Software at the 2019 eScience Symposium</a> was originally published in <a href="https://medium.com/escience-center">Netherlands eScience Center</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Writing Testable GPU Code]]></title>
            <link>https://medium.com/escience-center/writing-testable-gpu-code-23bbda3a5d62?source=rss-dd7190d774a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/23bbda3a5d62</guid>
            <category><![CDATA[gpu]]></category>
            <category><![CDATA[unit-testing]]></category>
            <category><![CDATA[escience]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[opencl]]></category>
            <dc:creator><![CDATA[Ben van Werkhoven]]></dc:creator>
            <pubDate>Mon, 18 Dec 2017 07:57:13 GMT</pubDate>
            <atom:updated>2017-12-18T07:57:13.830Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<p>Anyone involved in software development has probably heard someone say “testable code is better code”. While I was a bit skeptical at first, I now have to admit that I agree. One of the reasons it may have taken me a bit longer to get convinced is that I mostly write GPU code, in languages such as CUDA and OpenCL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OtfM8fdvOaIT3OlaUfZBjw.jpeg" /></figure><p>First of all, you don’t see a lot of GPU code that is thoroughly tested. And while, there are many articles and blogs on how to write good unit tests or how to apply unit testing effectively, none of them focus specifically on testing GPU code. Today, I write unit tests for every bit of GPU code that I write. And since there aren’t that many resources on testing GPU code, I’ll explain how I managed to make testing part of my GPU coding practice.</p><p>Just to be clear, this post is about unit testing GPU code and not about automated testing, formal verification, or model-checking code. While testing comes with its own limitations — in the words of Edsger Dijkstra: <em>“Testing shows the presence, not the absence of bugs”</em> — testing is easier to apply and is very beneficial to the quality of your code.</p><p>Writing tests for every part of your code forces you to keep functions short, simple, and focused on one thing. It will also force you to think longer on what you are coding. The resulting code is not only well-tested, but also structured differently, because the code is written with testability in mind.</p><h4>Unit Testing GPU Code</h4><p>Many excellent articles on effective unit testing and how to write good unit tests exist, but most of them focus on problems in object-oriented programming. Let’s take a look at some of the advice and see how it applies to unit testing GPU code.</p><p>In general, articles on unit testing seem to agree that good unit tests have the following properties (<a href="https://www.toptal.com/qa/how-to-write-testable-code-and-why-it-matters">source</a>):</p><ul><li>Easy to write — you often write multiple tests for a single unit</li><li>Readable — easy to understand what is being tested</li><li>Reliable — should only fail if there is a bug in the code</li><li>Fast — test are run frequently so should complete fast</li><li>Truly unit, not integration — not reliable on external factors</li></ul><p><strong><em>Easy to write.</em></strong> If you have to write host code for every bit of GPU code that you want to test, writing tests can be cumbersome. Fortunately, we will introduce a method that will greatly simplify writing tests for GPU code in the next section of this post.</p><p><strong><em>Readable.</em></strong> It can be a bit difficult to understand the purpose of a test when testing GPU code, because what is being tested is basically encoded into the data that is passed to the GPU code.</p><p><strong><em>Reliable.</em></strong> GPU code is in general very dependent on the host code that is supposed to call it. The test may fail if the data structures on the GPU are allocated incorrectly, if there is not enough memory available to hold the test data, or if the GPU kernel is launched with an incorrect number of threads per block.</p><p><strong><em>Fast.</em></strong> It is often possible to test the code with a smaller problem size than expected in a real application. On other hand, keep in mind that what may be a small problem size to work on for the GPU, may be take a long time to compute on the CPU.</p><p><strong><em>Truly unit. </em></strong>The idea of this point is that the tests should not depend on external factors, such as database servers or file systems. This is something that is hard to achieve for testing GPU code on the GPU. Some people may argue that testing GPU code on your GPU could not even be called ‘unit testing’ because of this point. I’d like to leave the terminology discussion for what it is, and focus on how to test GPU code.</p><h4>Testing GPU Code</h4><p>Testing in general involves three steps:<br>1. Decide on some input<br>2. Execute the system under test<br>3. Check the behavior of the system under test</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fosmxReXyy9S3J3J9fdPPA.jpeg" /></figure><p>This may sound very simple, but when we’re talking about GPU code and executing it, things tend to get messy rather quickly. You can see this when we specify everything that needs to happen when our system under test consists of GPU code:</p><p>1. Decide on some input data<br>2. Compile the GPU code (if not compiled already)<br>3. Allocate GPU memory<br>4. Copy input data to the GPU<br>5. Setup thread block and grid dimensions<br>6. Call the kernel<br>7. Copy data back to host memory<br>8. Free GPU memory<br>9. Check the behavior of the system under test</p><p>Now if you have to write the host code for steps 2 through 8 for every kernel that you’d like to test, you’ll quickly learn to avoid writing tests for every bit of GPU code that you write. Basically, what we are missing is a good testing framework that allows GPU programmers to easily call GPU code for testing purposes.</p><p>During the development of <a href="http://github.com/benvanwerkhoven/kernel_tuner">Kernel Tuner</a>, I realized that the simple interface used for tuning GPU kernels could just as easily be used to run GPU kernels. We could support a function that executes a kernel and returns its output, instead of benchmarking the kernel and returning its execution time.</p><p>Let’s take a look at a simple example, where we test a vector addition kernel implemented in CUDA with a short bit of Python code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b1c1c109c9eb9633cb6a19ed15f469ff/href">https://medium.com/media/b1c1c109c9eb9633cb6a19ed15f469ff/href</a></iframe><p>In this example, the kernel code is specified as a string, but it’s also possible to just supply a filename. Note that you can pass either CUDA or OpenCL code, both are supported and the language will be detected automatically. Numpy is used to create some random input data for vectors a and b. We also create an array c with zeros of the same size and data type. A list called args is used to hold the arguments for calling the kernel. The params dictionary is where we specify the thread block dimensions.</p><p>Next, we call the run_kernel function that takes the name of the function we’d like to test, the code (or filename) as a string, the problem size (used to compute the grid dimensions), and finally the arguments list and parameters dictionary.</p><p>Finally, in the example above we use numpy.allclose to compare the GPU output with the same result computed in Python using (a+b). We use Python’s assert statement so that our test can be executed using the <strong>nosetests</strong> or <strong>pytest</strong> frameworks for testing Python code.</p><p>To summarize, we take another look at our list of steps required to test GPU code, using <a href="http://github.com/benvanwerkhoven/kernel_tuner">Kernel Tuner</a> as a framework for testing GPU code, the list becomes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fW4l25XYSf0AjYg27X3HbA.png" /></figure><h4>Testing device functions</h4><p>Now that we have an easy way to test GPU kernels from Python, you may be wondering what about device functions? The way I test device functions is by writing a small wrapper kernel that calls the device function. This allows you to test device functions on the GPU and the wrapper kernel could even take care of creating the necessary context for your device function to execute correctly, such as declaring shared memory and looking up thread and block indices.</p><h4>Designing your test case</h4><p>The hardest part of testing GPU code is designing a good test case. Actually, designing the testcase is all about choosing what data you put into the code. It’s very easy to just generate some random data, but for many codes using only random data is far too unrealistic. You have to keep in mind what assumptions are in the code about valid ranges for input data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n2fyfhTfBwGjbZJa43iptw.jpeg" /></figure><p>I ran into a problem like this myself once, when a kernel executed correctly only when one of its inputs was sorted. Testing only with randomly generated data did not reveal a race condition that I had introduced in the code. The bug only surfaced when I started testing with more realistic data.</p><p>Another thing to keep in mind is that there should be sufficient variance in the output of your code. For example, if your GPU code outputs data in the interval [0,1] and your randomly generated input data causes the output to be all ones, you don’t have a very well designed test case and bugs may go undetected.</p><p>The important thing to remember is that in order to design a good test case for your GPU code you should: first understand what your code is doing with the data you put in, and secondly, for more complex kernels, you should not only compare against the output of a CPU version of your code, but also ensure that the output itself makes sense.</p><h4>Conclusions</h4><p>In general, testing GPU code can be a bit more difficult and a bit more work than testing other sorts of code. However, using testing frameworks specifically designed for testing GPU code, such as <a href="http://github.com/benvanwerkhoven/kernel_tuner">Kernel Tuner</a>, drastically reduces the effort involved in writing tests.</p><p>I hope this post contributes to enabling GPU programmers to make testing an integral part of their code development. And that we may see a lot more GPU code that is developed with testing in mind.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23bbda3a5d62" width="1" height="1" alt=""><hr><p><a href="https://medium.com/escience-center/writing-testable-gpu-code-23bbda3a5d62">Writing Testable GPU Code</a> was originally published in <a href="https://medium.com/escience-center">Netherlands eScience Center</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>