  Current and upcoming radio telescopes are being designed with increasing
sensitivity to detect new and mysterious radio sources of astrophysical origin.
While this increased sensitivity improves the likelihood of discoveries, it
also makes these instruments more susceptible to the deleterious effects of
Radio Frequency Interference (RFI). The challenge posed by RFI is exacerbated
by the high data-rates achieved by modern radio telescopes, which require
real-time processing to keep up with the data. Furthermore, the high data-rates
do not allow for permanent storage of observations at high resolution. Offline
RFI mitigation is therefore not possible anymore. The real-time requirement
makes RFI mitigation even more challenging because, on one side, the techniques
used for mitigation need to be fast and simple, and on the other side they also
need to be robust enough to cope with just a partial view of the data.
  The Apertif Radio Transient System (ARTS) is the real-time, time-domain,
transient detection instrument of the Westerbork Synthesis Radio Telescope
(WSRT), processing 73 Gb of data per second. Even with a deep learning
classifier, the ARTS pipeline requires state-of-the-art real-time RFI
mitigation to reduce the number of false-positive detections. Our solution to
this challenge is RFIm, a high-performance, open-source, tuned, and extensible
RFI mitigation library. The goal of this library is to provide users with RFI
mitigation routines that are designed to run in real-time on many-core
accelerators, such as Graphics Processing Units, and that can be highly-tuned
to achieve code and performance portability to different hardware platforms and
scientific use-cases. Results on the ARTS show that we can achieve real-time
RFI mitigation, with a minimal impact on the total execution time of the search
pipeline, and considerably reduce the number of false-positives.
