<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Muhammad Zubair Bin Akbar</title>
    <description>The latest articles on DEV Community by Muhammad Zubair Bin Akbar (@zubairakbar).</description>
    <link>https://dev.to/zubairakbar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3874077%2F58ef1a6a-88ea-4af9-925d-f9a18ea98939.jpeg</url>
      <title>DEV Community: Muhammad Zubair Bin Akbar</title>
      <link>https://dev.to/zubairakbar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zubairakbar"/>
    <language>en</language>
    <item>
      <title>InfiniBand Troubleshooting Explained: Using ibqueryerrors to Identify Network Problems</title>
      <dc:creator>Muhammad Zubair Bin Akbar</dc:creator>
      <pubDate>Sun, 22 Nov 2026 16:09:49 +0000</pubDate>
      <link>https://dev.to/zubairakbar/infiniband-troubleshooting-explained-using-ibqueryerrors-to-identify-network-problems-1hp</link>
      <guid>https://dev.to/zubairakbar/infiniband-troubleshooting-explained-using-ibqueryerrors-to-identify-network-problems-1hp</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Imagine submitting an MPI job to an HPC cluster. It starts normally, but something does not feel right.&lt;/p&gt;

&lt;p&gt;A job that usually finishes in 20 minutes is now taking 45 minutes. Some MPI ranks appear to be waiting for others. Another job occasionally fails with communication errors. You check CPU and memory utilisation, but nothing looks unusual.&lt;/p&gt;

&lt;p&gt;Could the problem be the InfiniBand network?&lt;/p&gt;

&lt;p&gt;InfiniBand is designed to provide high bandwidth and low latency communication between compute nodes. It is widely used in HPC environments because applications such as MPI depend on fast communication between nodes.&lt;/p&gt;

&lt;p&gt;However, even a high performance network can experience problems. A damaged cable, a faulty transceiver, a problematic switch port or other physical and network issues can affect communication.&lt;/p&gt;

&lt;p&gt;The difficult part is that these problems are not always obvious. A node might remain online, network interfaces might show an active link, and jobs might still run. Yet performance can be significantly affected.&lt;/p&gt;

&lt;p&gt;This is where InfiniBand diagnostic tools become useful.&lt;/p&gt;

&lt;p&gt;In this article, we will look at one particularly useful tool called &lt;code&gt;ibqueryerrors&lt;/code&gt;. We will understand what it does, what different errors mean, what symptoms users might experience and how an HPC administrator can investigate potential network problems.&lt;/p&gt;

&lt;h2&gt;
  
  
  First, what is InfiniBand?
&lt;/h2&gt;

&lt;p&gt;Before looking at the troubleshooting commands, let's understand what we are troubleshooting.&lt;/p&gt;

&lt;p&gt;In a typical HPC cluster, multiple compute nodes work together to complete a computational task.&lt;/p&gt;

&lt;p&gt;For example, imagine an application running across four compute nodes:&lt;/p&gt;

&lt;p&gt;Node 1&lt;br&gt;
Node 2&lt;br&gt;
Node 3&lt;br&gt;
Node 4&lt;/p&gt;

&lt;p&gt;Each node performs part of the calculation. However, they also need to exchange information with one another.&lt;/p&gt;

&lt;p&gt;An MPI application might frequently send and receive data between nodes. If communication becomes slow, the entire application can become slower, even when the processors have plenty of available resources.&lt;/p&gt;

&lt;p&gt;InfiniBand provides a high speed network for this communication.&lt;/p&gt;

&lt;p&gt;A simplified InfiniBand setup includes:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Host Channel Adapter (HCA):&lt;/strong&gt; The network adapter installed in a compute server. It connects the server to the InfiniBand fabric.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;InfiniBand cable or transceiver:&lt;/strong&gt; The physical connection between the server and the switch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;InfiniBand switch:&lt;/strong&gt; Connects multiple compute nodes and forwards network traffic between them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Subnet Manager:&lt;/strong&gt; Manages the InfiniBand fabric, including discovering devices and configuring routes.&lt;/p&gt;

&lt;p&gt;Think of an InfiniBand fabric as a road network connecting different buildings. The compute nodes are the buildings, the cables are the roads, and the switches are the junctions.&lt;/p&gt;

&lt;p&gt;If a road develops a problem, traffic might slow down or become disrupted. Similarly, a problem with an InfiniBand link can affect communication between compute nodes.&lt;/p&gt;
&lt;h2&gt;
  
  
  What happens when an InfiniBand link develops errors?
&lt;/h2&gt;

&lt;p&gt;InfiniBand links continuously exchange data. During transmission, the hardware monitors the integrity of the communication.&lt;/p&gt;

&lt;p&gt;If something goes wrong, the hardware can detect errors and update its counters.&lt;/p&gt;

&lt;p&gt;These counters help administrators understand what is happening on the network.&lt;/p&gt;

&lt;p&gt;For example, a cable or transceiver problem might cause physical transmission errors. The link may attempt to recover automatically. If recovery fails, the link could go down.&lt;/p&gt;

&lt;p&gt;The important point is that not every error immediately causes a network outage.&lt;/p&gt;

&lt;p&gt;Some errors can occur while the link remains operational. This is why an administrator might see a node online even though its network connection is experiencing problems.&lt;/p&gt;
&lt;h2&gt;
  
  
  What would an HPC user actually experience?
&lt;/h2&gt;

&lt;p&gt;This is one of the most important parts of troubleshooting.&lt;/p&gt;

&lt;p&gt;Users do not normally see InfiniBand counters. They experience the impact on their applications.&lt;/p&gt;

&lt;p&gt;Here are some possible symptoms.&lt;/p&gt;
&lt;h3&gt;
  
  
  1. MPI jobs taking longer than usual
&lt;/h3&gt;

&lt;p&gt;Imagine running an MPI application across eight compute nodes.&lt;/p&gt;

&lt;p&gt;Previously, the application completed in 30 minutes. Now it takes 50 minutes, even though the CPU utilisation and memory consumption appear similar.&lt;/p&gt;

&lt;p&gt;One possible explanation is that communication between nodes has become slower.&lt;/p&gt;

&lt;p&gt;MPI applications frequently exchange data between ranks. If communication is delayed, some ranks may spend more time waiting for messages instead of performing calculations.&lt;/p&gt;

&lt;p&gt;This can reduce overall application performance.&lt;/p&gt;

&lt;p&gt;However, slow MPI jobs can also result from application behaviour, CPU imbalance, storage delays or other network issues. InfiniBand errors are one possibility to investigate, not an automatic explanation.&lt;/p&gt;
&lt;h3&gt;
  
  
  2. MPI jobs hanging or waiting for communication
&lt;/h3&gt;

&lt;p&gt;Another possible symptom is an MPI job that appears to stop making progress.&lt;/p&gt;

&lt;p&gt;For example, several MPI ranks might be waiting for data from another rank.&lt;/p&gt;

&lt;p&gt;If communication between two nodes is disrupted, the application might experience delays or fail to complete a communication operation.&lt;/p&gt;

&lt;p&gt;From the user's perspective, the job may appear stuck.&lt;/p&gt;

&lt;p&gt;The actual cause could be an application deadlock, an MPI problem or a network issue. Network counters and application logs help narrow down the possibilities.&lt;/p&gt;
&lt;h3&gt;
  
  
  3. Inconsistent application performance
&lt;/h3&gt;

&lt;p&gt;Sometimes the problem is not permanent.&lt;/p&gt;

&lt;p&gt;A job might run normally today but become significantly slower tomorrow. Another job using the same compute nodes might perform differently.&lt;/p&gt;

&lt;p&gt;This can happen when a network link experiences intermittent errors or recovery events.&lt;/p&gt;

&lt;p&gt;For example, a physical connection might work most of the time but occasionally experience errors that require the link to recover.&lt;/p&gt;

&lt;p&gt;The network remains available, but communication performance becomes inconsistent.&lt;/p&gt;
&lt;h3&gt;
  
  
  4. MPI communication errors or job failures
&lt;/h3&gt;

&lt;p&gt;In more serious situations, network problems can cause communication failures.&lt;/p&gt;

&lt;p&gt;Users might see MPI errors, connection failures, communication timeouts or jobs terminating unexpectedly.&lt;/p&gt;

&lt;p&gt;The exact error message depends on the MPI implementation, communication library and nature of the failure.&lt;/p&gt;

&lt;p&gt;For example, an application using Open MPI and UCX may report communication or transport errors if the underlying connection becomes unavailable.&lt;/p&gt;

&lt;p&gt;It is important not to assume that every UCX error is caused by InfiniBand. Configuration mismatches, software problems and other issues can produce similar symptoms.&lt;/p&gt;
&lt;h3&gt;
  
  
  5. A compute node becoming unavailable
&lt;/h3&gt;

&lt;p&gt;If an InfiniBand link goes down completely, communication through that connection may no longer be possible.&lt;/p&gt;

&lt;p&gt;Depending on the cluster configuration and application, this can result in failed jobs, unreachable nodes or communication failures.&lt;/p&gt;

&lt;p&gt;The compute node itself might still be accessible through its Ethernet management network. This is another reason why an administrator should not assume that an accessible server has a healthy InfiniBand connection.&lt;/p&gt;
&lt;h2&gt;
  
  
  Introducing ibqueryerrors
&lt;/h2&gt;

&lt;p&gt;Now that we understand the symptoms, let's look at the tool.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ibqueryerrors&lt;/code&gt; is an InfiniBand diagnostic utility that queries and reports port error counters across an InfiniBand fabric.&lt;/p&gt;

&lt;p&gt;It is part of the &lt;code&gt;infiniband-diags&lt;/code&gt; utilities.&lt;/p&gt;

&lt;p&gt;Rather than checking only one network interface, it can examine ports across the fabric and report counters that exceed their configured thresholds.&lt;/p&gt;

&lt;p&gt;By default, the threshold is zero. This means counters with nonzero values can appear in the output.&lt;/p&gt;

&lt;p&gt;This makes it useful when investigating a suspected network problem because it can help identify which ports are reporting errors.&lt;/p&gt;

&lt;p&gt;It can also report additional port and link information, helping an administrator identify the devices involved.&lt;/p&gt;

&lt;p&gt;One important thing to understand:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ibqueryerrors identifies counters that deserve investigation. It does not automatically tell you the root cause.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A reported error might be related to a physical connection, a switch port, a network adapter or another condition. Further investigation is needed.&lt;/p&gt;
&lt;h2&gt;
  
  
  Installing and checking ibqueryerrors
&lt;/h2&gt;

&lt;p&gt;On a RHEL based system, the utility is generally provided by the &lt;code&gt;infiniband-diags&lt;/code&gt; package.&lt;/p&gt;

&lt;p&gt;You can check whether it is installed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rpm -q infiniband-diags
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If it is not installed, install it using your configured package repositories:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo dnf install infiniband-diags
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then check whether the command is available:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;which ibqueryerrors
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should also confirm that the InfiniBand devices are visible:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ibstat
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output provides basic information about the local InfiniBand adapter, including its port state and physical link state.&lt;/p&gt;

&lt;p&gt;For example, you might see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CA 'mlx5_0'
    CA type: MT4123
    Number of ports: 1
    Port 1:
        State: Active
        Physical state: LinkUp
        Rate: 200
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is an illustrative example. Actual output depends on the hardware and software version.&lt;/p&gt;

&lt;p&gt;An active link is a good starting point, but it does not guarantee that the connection is completely free of errors.&lt;/p&gt;

&lt;h2&gt;
  
  
  Running ibqueryerrors
&lt;/h2&gt;

&lt;p&gt;The basic command is straightforward:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ibqueryerrors
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The tool queries the fabric and reports port error counters that exceed their thresholds.&lt;/p&gt;

&lt;p&gt;You might see output similar to the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Port info: Lid 12 port 1
SymbolErrorCounter: 15
LinkErrorRecoveryCounter: 3
LinkDownedCounter: 1

# Port info: Lid 18 port 1
PortRcvErrors: 7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The values above are fictional examples to help explain the output. Counter names and formatting can differ between versions.&lt;/p&gt;

&lt;p&gt;What does this information tell us?&lt;/p&gt;

&lt;p&gt;It tells us that certain ports have recorded errors or recovery events.&lt;/p&gt;

&lt;p&gt;For example, the first port has recorded symbol errors, link recovery events and a link down event.&lt;/p&gt;

&lt;p&gt;This gives us a starting point for investigating the affected connection.&lt;/p&gt;

&lt;p&gt;To include additional information about the ports and their remote connections, you can use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ibqueryerrors -r
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;-r&lt;/code&gt; option reports port information, including details such as the local port, remote port and link information where available.&lt;/p&gt;

&lt;p&gt;This can be particularly useful when trying to understand which devices are connected to a problematic port.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the important InfiniBand error counters
&lt;/h2&gt;

&lt;p&gt;You do not need to memorise every available counter. However, understanding some of the common ones makes troubleshooting much easier.&lt;/p&gt;

&lt;p&gt;Let's look at the counters you are most likely to encounter.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. SymbolErrorCounter
&lt;/h3&gt;

&lt;p&gt;Symbol errors are physical link errors detected during communication.&lt;/p&gt;

&lt;p&gt;Think of a cable carrying information between two devices. If the signal is not received correctly, the receiving hardware may detect an error.&lt;/p&gt;

&lt;p&gt;Possible causes include:&lt;/p&gt;

&lt;p&gt;Poor cable quality, damaged connectors, faulty transceivers or signal integrity problems.&lt;/p&gt;

&lt;p&gt;If this counter continues increasing, it deserves investigation.&lt;/p&gt;

&lt;p&gt;For example, if a compute node is experiencing slow MPI communication and its connected switch port is also reporting increasing symbol errors, the physical connection becomes a reasonable area to investigate.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. LinkErrorRecoveryCounter
&lt;/h3&gt;

&lt;p&gt;This counter records how many times the port successfully completed a link error recovery process.&lt;/p&gt;

&lt;p&gt;In simple terms, the link experienced a problem and the hardware successfully recovered.&lt;/p&gt;

&lt;p&gt;A small historical value does not necessarily indicate a current problem.&lt;/p&gt;

&lt;p&gt;However, if the counter continues increasing, it might indicate repeated link instability.&lt;/p&gt;

&lt;p&gt;Imagine a network connection that repeatedly loses signal quality and has to recover. Communication may continue, but repeated recovery events can indicate that something is wrong.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. LinkDownedCounter
&lt;/h3&gt;

&lt;p&gt;This counter records how many times the port failed to recover the link and the link was brought down.&lt;/p&gt;

&lt;p&gt;This is more concerning than a simple recovery event.&lt;/p&gt;

&lt;p&gt;If the link repeatedly goes down, the connected device might lose InfiniBand connectivity.&lt;/p&gt;

&lt;p&gt;Possible causes include physical connection problems, faulty transceivers, switch port issues or hardware problems.&lt;/p&gt;

&lt;p&gt;A rising link down counter should be investigated alongside the current port state and switch logs.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. PortRcvErrors
&lt;/h3&gt;

&lt;p&gt;This counter records packets received with errors.&lt;/p&gt;

&lt;p&gt;These can include physical errors, malformed packets and packets discarded because of receive buffer problems.&lt;/p&gt;

&lt;p&gt;It is a broader counter, so it does not identify one specific root cause.&lt;/p&gt;

&lt;p&gt;If it increases rapidly, investigate the more detailed counters and the affected port.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. LocalIntegrityErrors
&lt;/h3&gt;

&lt;p&gt;This counter tracks situations where local physical errors exceed a configured threshold.&lt;/p&gt;

&lt;p&gt;It can indicate problems with the physical integrity of the link.&lt;/p&gt;

&lt;p&gt;If it increases, investigate the connected cable, transceiver, HCA port and switch port.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. ExcessiveBufferOverrunErrors
&lt;/h3&gt;

&lt;p&gt;This counter is related to receive buffer overruns.&lt;/p&gt;

&lt;p&gt;In simple terms, the receiving side cannot handle incoming data within the required flow control conditions.&lt;/p&gt;

&lt;p&gt;This can indicate a problem with the link's flow control behaviour or buffer handling.&lt;/p&gt;

&lt;p&gt;It should not automatically be interpreted as a faulty cable. The surrounding counters and fabric conditions need to be examined.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. VL15Dropped
&lt;/h3&gt;

&lt;p&gt;VL15 is a special virtual lane used for InfiniBand subnet management traffic.&lt;/p&gt;

&lt;p&gt;The VL15 dropped counter records management packets dropped because of resource limitations.&lt;/p&gt;

&lt;p&gt;It is not a direct measure of ordinary MPI application traffic.&lt;/p&gt;

&lt;p&gt;If this counter increases, it may indicate a management traffic or resource issue that needs separate investigation.&lt;/p&gt;

&lt;p&gt;The meaning and significance of counters can vary with hardware and implementation. Always compare the output with the documentation for the installed adapter and switch.&lt;/p&gt;

&lt;h2&gt;
  
  
  A practical troubleshooting example
&lt;/h2&gt;

&lt;p&gt;Let's put everything together.&lt;/p&gt;

&lt;p&gt;Imagine users report that MPI jobs running between two compute nodes are taking longer than usual.&lt;/p&gt;

&lt;p&gt;The cluster administrator checks CPU utilisation, memory utilisation and storage performance. Nothing obvious appears to explain the slowdown.&lt;/p&gt;

&lt;p&gt;The administrator suspects a possible InfiniBand issue.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Check the local InfiniBand link&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On the affected compute node:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ibstat
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Confirm that the expected port is active and the physical link is up.&lt;/p&gt;

&lt;p&gt;If the port is down, the investigation should start with the link state, physical connection and switch port.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Check fabric error counters&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ibqueryerrors
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Suppose the output shows increasing symbol errors and link recovery events on a port connected to one of the affected nodes.&lt;/p&gt;

&lt;p&gt;This gives the administrator a useful lead.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Identify the affected port&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ibqueryerrors -r
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use the reported LID, port and remote port information to identify the connection.&lt;/p&gt;

&lt;p&gt;Remember that the LID is a fabric address, not necessarily the Linux device name or server hostname. You may need the fabric's node name mapping or switch management tools to identify the physical device.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Check the local hardware counters&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On the affected compute node, inspect the available counters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ls /sys/class/infiniband/mlx5_0/ports/1/counters/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can then check individual values:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cat /sys/class/infiniband/mlx5_0/ports/1/counters/symbol_error

cat /sys/class/infiniband/mlx5_0/ports/1/counters/link_error_recovery

cat /sys/class/infiniband/mlx5_0/ports/1/counters/link_downed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The device name and port number will depend on the server hardware.&lt;/p&gt;

&lt;p&gt;These counters provide another view of the local adapter's port statistics.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Compare counter values over time&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is particularly important.&lt;/p&gt;

&lt;p&gt;A counter showing 100 errors does not necessarily mean that 100 errors occurred recently.&lt;/p&gt;

&lt;p&gt;It might have accumulated over several months.&lt;/p&gt;

&lt;p&gt;Record the current values, wait for a suitable interval while the system is experiencing the problem, and check them again.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Initial symbol errors: 100

After 10 minutes: 100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There has been no increase during that interval.&lt;/p&gt;

&lt;p&gt;Now consider:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Initial symbol errors: 100

After 10 minutes: 450
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The counter has increased by 350.&lt;/p&gt;

&lt;p&gt;That is much more interesting and deserves further investigation.&lt;/p&gt;

&lt;p&gt;You should also compare the timing with the affected jobs and application performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 6: Investigate the physical connection&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once a problematic port has been identified, the administrator can investigate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The InfiniBand cable and its connectors.&lt;/li&gt;
&lt;li&gt;The transceiver on both ends of the connection.&lt;/li&gt;
&lt;li&gt;The compute node's HCA port.&lt;/li&gt;
&lt;li&gt;The connected switch port.&lt;/li&gt;
&lt;li&gt;Switch logs and port counters.&lt;/li&gt;
&lt;li&gt;Firmware and hardware health.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If a physical component is suspected, follow the hardware vendor's troubleshooting procedure and maintenance process.&lt;/p&gt;

&lt;p&gt;Do not replace hardware simply because a historical counter is nonzero.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other useful InfiniBand troubleshooting commands
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;ibqueryerrors&lt;/code&gt; is not the only tool available. A few other utilities can help build a clearer picture.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ibstat&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ibstat
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Displays basic information about the local InfiniBand adapter, including port state, physical state and link rate.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;iblinkinfo&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;iblinkinfo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Displays link information across the InfiniBand fabric. It is useful when investigating connectivity and identifying links between devices.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ibnetdiscover&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ibnetdiscover
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Discovers devices and connections in the fabric, helping administrators understand the physical and logical topology.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;perfquery&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;perfquery
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Queries performance counters for an InfiniBand port. It is useful when investigating individual port statistics.&lt;/p&gt;

&lt;p&gt;These tools complement one another. For example, &lt;code&gt;ibqueryerrors&lt;/code&gt; can highlight a port with errors, while &lt;code&gt;iblinkinfo&lt;/code&gt; and &lt;code&gt;ibnetdiscover&lt;/code&gt; can help identify its location within the fabric.&lt;/p&gt;

&lt;h2&gt;
  
  
  Important: Not every error counter indicates a fault
&lt;/h2&gt;

&lt;p&gt;This is worth emphasising.&lt;/p&gt;

&lt;p&gt;A common mistake during InfiniBand troubleshooting is seeing a nonzero counter and immediately assuming that the hardware is faulty.&lt;/p&gt;

&lt;p&gt;Many counters are cumulative. They record events over time and may remain nonzero even when the connection is currently healthy.&lt;/p&gt;

&lt;p&gt;For example, a link might have experienced a recovery event several weeks ago. The counter will still show that event today.&lt;/p&gt;

&lt;p&gt;What matters is understanding the context:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is the counter increasing?&lt;/li&gt;
&lt;li&gt;How quickly is it increasing?&lt;/li&gt;
&lt;li&gt;Is the link currently active?&lt;/li&gt;
&lt;li&gt;Are users reporting performance problems?&lt;/li&gt;
&lt;li&gt;Are multiple related counters increasing?&lt;/li&gt;
&lt;li&gt;Does the connected switch port report similar issues?&lt;/li&gt;
&lt;li&gt;Did the problem begin after a hardware or configuration change?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Looking at the overall picture is much more useful than focusing on a single number.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;InfiniBand is a critical part of many HPC environments. When communication between compute nodes becomes unreliable, the impact can extend beyond the network itself.&lt;/p&gt;

&lt;p&gt;Users might experience slow MPI jobs, inconsistent application performance, communication delays, hanging jobs or unexpected failures.&lt;/p&gt;

&lt;p&gt;For administrators, &lt;code&gt;ibqueryerrors&lt;/code&gt; provides a useful starting point for investigating these situations. It helps identify ports reporting errors and gives you a direction for further troubleshooting.&lt;/p&gt;

&lt;p&gt;The key is to understand what the counters mean, identify the affected connection and compare counter values over time.&lt;/p&gt;

&lt;p&gt;A healthy looking compute node does not always mean a healthy network connection. Sometimes the problem is hidden in the fabric, and knowing how to investigate its counters can save considerable troubleshooting time.&lt;/p&gt;

&lt;p&gt;For anyone working with HPC clusters, understanding tools such as &lt;code&gt;ibqueryerrors&lt;/code&gt;, &lt;code&gt;ibstat&lt;/code&gt;, &lt;code&gt;iblinkinfo&lt;/code&gt; and &lt;code&gt;perfquery&lt;/code&gt; is a valuable step towards becoming more confident with InfiniBand troubleshooting.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Useful references&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://man7.org/linux/man-pages/man8/IBQUERYERRORS.8.html" rel="noopener noreferrer"&gt;ibqueryerrors manual&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://networking-docs.nvidia.com/winofdocumentation/55054000/infiniband-fabric-diagnostic-utilities" rel="noopener noreferrer"&gt;NVIDIA InfiniBand Fabric Diagnostic Utilities&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.kernel.org/admin-guide/abi-stable.html" rel="noopener noreferrer"&gt;Linux InfiniBand counter definitions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://networking-docs.nvidia.com/ufmsdnappswum/4146/appendix-supported-port-counters-and-events" rel="noopener noreferrer"&gt;NVIDIA InfiniBand Port Counters&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>networking</category>
      <category>productivity</category>
      <category>beginners</category>
      <category>testing</category>
    </item>
    <item>
      <title>Slurm CPU and Memory Allocation Explained: Understanding Tasks, Cores and Nodes</title>
      <dc:creator>Muhammad Zubair Bin Akbar</dc:creator>
      <pubDate>Wed, 18 Nov 2026 16:30:29 +0000</pubDate>
      <link>https://dev.to/zubairakbar/slurm-cpu-and-memory-allocation-explained-understanding-tasks-cores-and-nodes-3gj1</link>
      <guid>https://dev.to/zubairakbar/slurm-cpu-and-memory-allocation-explained-understanding-tasks-cores-and-nodes-3gj1</guid>
      <description>&lt;p&gt;When submitting a job to an HPC cluster using Slurm, you will often come across options such as &lt;code&gt;--ntasks&lt;/code&gt;, &lt;code&gt;--cpus-per-task&lt;/code&gt;, &lt;code&gt;--ntasks-per-node&lt;/code&gt;, &lt;code&gt;--mem&lt;/code&gt; and &lt;code&gt;--mem-per-cpu&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;At first glance, these options might look similar. They all describe resources required by a job, but each controls something different.&lt;/p&gt;

&lt;p&gt;Understanding these options is important because requesting the wrong resources can lead to inefficient resource allocation, poor application performance or jobs waiting unnecessarily in the queue.&lt;/p&gt;

&lt;p&gt;Let's understand the concepts behind these options, starting with the basics.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. First, understand the difference between a node, CPU and task
&lt;/h2&gt;

&lt;p&gt;Before exploring the Slurm options, we need to understand three basic concepts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Node:&lt;/strong&gt; A node is simply a computer within an HPC cluster. It has its own CPU cores, memory and other hardware resources.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CPU core:&lt;/strong&gt; Think of a CPU core as a worker that can execute instructions. If a compute node has 32 CPU cores, it has 32 physical processing cores available.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Task:&lt;/strong&gt; A task is an individual unit of work launched by Slurm. In MPI applications, a task commonly represents an MPI process.&lt;/p&gt;

&lt;p&gt;For example, if you run an MPI application with 8 processes, you have 8 tasks. Each process works on its own portion of the calculation and communicates with other processes when necessary.&lt;/p&gt;

&lt;p&gt;A task is not necessarily the same as a CPU core. One task can use one CPU core or multiple CPU cores.&lt;/p&gt;

&lt;p&gt;This distinction is the foundation for understanding Slurm resource requests.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Understanding CPU allocation options
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;--ntasks&lt;/code&gt;: How many tasks do you need?
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;--ntasks&lt;/code&gt; option tells Slurm how many tasks your application needs in total.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#SBATCH --ntasks=8&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This requests 8 tasks.&lt;/p&gt;

&lt;p&gt;If you are running an MPI application, this generally means 8 MPI processes.&lt;/p&gt;

&lt;p&gt;Slurm can distribute these tasks across one or multiple compute nodes, depending on the available resources and other job requirements.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Node 1: 4 tasks&lt;/li&gt;
&lt;li&gt;Node 2: 4 tasks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The total is still 8 tasks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Remember:&lt;/strong&gt; &lt;code&gt;--ntasks&lt;/code&gt; defines the total number of tasks, not the number of CPU cores.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;--cpus-per-task&lt;/code&gt;: How many CPU cores does each task need?
&lt;/h3&gt;

&lt;p&gt;Now imagine that one task needs more than one CPU core to perform its work.&lt;/p&gt;

&lt;p&gt;This is common with applications using OpenMP or other multithreaded programming models.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;--cpus-per-task&lt;/code&gt; option tells Slurm how many CPUs to allocate to each task.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#SBATCH --ntasks=1&lt;/span&gt;
&lt;span class="c"&gt;#SBATCH --cpus-per-task=8&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This requests:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;1 task&lt;/li&gt;
&lt;li&gt;8 CPUs for that task&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In an OpenMP application, one process can create multiple threads to perform calculations in parallel.&lt;/p&gt;

&lt;p&gt;You can configure the number of OpenMP threads using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="kd"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;OMP_NUM_THREADS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$SLURM_CPUS_PER_TASK&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Remember:&lt;/strong&gt; &lt;code&gt;--cpus-per-task&lt;/code&gt; controls the CPU allocation for each task, not the total number of tasks.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;--ntasks-per-node&lt;/code&gt;: How should tasks be distributed?
&lt;/h3&gt;

&lt;p&gt;What if you want to control how many tasks run on each compute node?&lt;/p&gt;

&lt;p&gt;This is where &lt;code&gt;--ntasks-per-node&lt;/code&gt; becomes useful.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#SBATCH --ntasks=16&lt;/span&gt;
&lt;span class="c"&gt;#SBATCH --ntasks-per-node=8&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You are requesting:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;16 tasks in total&lt;/li&gt;
&lt;li&gt;Maximum 8 tasks per node&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A possible distribution is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Node 1: 8 tasks&lt;/li&gt;
&lt;li&gt;Node 2: 8 tasks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Another example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#SBATCH --ntasks=12&lt;/span&gt;
&lt;span class="c"&gt;#SBATCH --ntasks-per-node=4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Slurm can distribute the tasks across three nodes, with 4 tasks on each.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Remember:&lt;/strong&gt; &lt;code&gt;--ntasks&lt;/code&gt; defines the total number of tasks, while &lt;code&gt;--ntasks-per-node&lt;/code&gt; controls the maximum number of tasks placed on each node.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Understanding memory allocation options
&lt;/h2&gt;

&lt;p&gt;CPU resources are only one part of an HPC job. Applications also need memory to store data, intermediate calculations and other information while running.&lt;/p&gt;

&lt;p&gt;Slurm provides two commonly used options for requesting memory.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;--mem&lt;/code&gt;: How much memory does each node need?
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;--mem&lt;/code&gt; option specifies the amount of memory required per node.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#SBATCH --nodes=2&lt;/span&gt;
&lt;span class="c"&gt;#SBATCH --mem=32G&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This requests 32 GB of memory per node.&lt;/p&gt;

&lt;p&gt;Since the job requests two nodes, the total requested memory across the allocation is 64 GB.&lt;/p&gt;

&lt;p&gt;Why per node?&lt;/p&gt;

&lt;p&gt;Because each compute node has its own physical RAM. Memory on one node is not automatically available to applications running on another node.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Remember:&lt;/strong&gt; &lt;code&gt;--mem&lt;/code&gt; specifies memory per node, not total memory across the job.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;--mem-per-cpu&lt;/code&gt;: How much memory does each allocated CPU need?
&lt;/h3&gt;

&lt;p&gt;Instead of requesting a fixed amount of memory per node, you can request memory based on the number of allocated CPUs.&lt;/p&gt;

&lt;p&gt;This is what &lt;code&gt;--mem-per-cpu&lt;/code&gt; does.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#SBATCH --ntasks=8&lt;/span&gt;
&lt;span class="c"&gt;#SBATCH --cpus-per-task=2&lt;/span&gt;
&lt;span class="c"&gt;#SBATCH --mem-per-cpu=4G&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's calculate the request.&lt;/p&gt;

&lt;p&gt;Total allocated CPUs:&lt;/p&gt;

&lt;p&gt;8 tasks × 2 CPUs = 16 CPUs.&lt;/p&gt;

&lt;p&gt;Memory request:&lt;/p&gt;

&lt;p&gt;16 CPUs × 4 GB = 64 GB.&lt;/p&gt;

&lt;p&gt;If the tasks are distributed evenly across two nodes, each node receives 8 CPUs and 32 GB of requested memory.&lt;/p&gt;

&lt;p&gt;This approach can be useful when memory requirements generally increase with the number of CPU resources allocated.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Remember:&lt;/strong&gt; &lt;code&gt;--mem-per-cpu&lt;/code&gt; specifies memory per allocated CPU, whereas &lt;code&gt;--mem&lt;/code&gt; specifies memory per node.&lt;/p&gt;

&lt;p&gt;An important detail: &lt;code&gt;--mem&lt;/code&gt;, &lt;code&gt;--mem-per-cpu&lt;/code&gt; and &lt;code&gt;--mem-per-gpu&lt;/code&gt; are alternative memory request methods. You should not combine them in the same job.&lt;/p&gt;

&lt;p&gt;Also, Slurm has a configurable maximum memory-per-CPU value. If a request exceeds that limit, Slurm may adjust the effective memory-per-CPU and CPU allocation. Therefore, the actual request can depend on cluster configuration.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. How do these options work together?
&lt;/h2&gt;

&lt;p&gt;Let's imagine an HPC cluster where each compute node has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;32 CPU cores&lt;/li&gt;
&lt;li&gt;128 GB RAM&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You are running an MPI application that requires 16 processes, with 2 CPU cores per process.&lt;/p&gt;

&lt;p&gt;Your job script could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="c"&gt;#SBATCH --job-name=hpc-calculation&lt;/span&gt;
&lt;span class="c"&gt;#SBATCH --nodes=2&lt;/span&gt;
&lt;span class="c"&gt;#SBATCH --ntasks=16&lt;/span&gt;
&lt;span class="c"&gt;#SBATCH --ntasks-per-node=8&lt;/span&gt;
&lt;span class="c"&gt;#SBATCH --cpus-per-task=2&lt;/span&gt;
&lt;span class="c"&gt;#SBATCH --mem-per-cpu=4G&lt;/span&gt;
&lt;span class="c"&gt;#SBATCH --time=02:00:00&lt;/span&gt;

srun ./my_mpi_application
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's break down the allocation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Number of nodes:&lt;/strong&gt; 2&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Total tasks:&lt;/strong&gt; 16&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tasks per node:&lt;/strong&gt; 8&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CPUs per task:&lt;/strong&gt; 2&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Total CPU allocation:&lt;/strong&gt; 16 × 2 = 32 CPUs&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Memory per CPU:&lt;/strong&gt; 4 GB&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Total memory request:&lt;/strong&gt; 32 × 4 = 128 GB&lt;/p&gt;

&lt;p&gt;Each node receives:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;8 tasks&lt;/li&gt;
&lt;li&gt;16 CPUs&lt;/li&gt;
&lt;li&gt;64 GB memory&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is how different Slurm options work together to describe the resources required by an application.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. What does the Slurm administrator need to configure?
&lt;/h2&gt;

&lt;p&gt;Here is something that users often overlook.&lt;/p&gt;

&lt;p&gt;Slurm resource requests do not work independently of the cluster configuration. The administrator determines how resources are tracked, scheduled and enforced.&lt;/p&gt;

&lt;p&gt;Let's look at some important configuration parameters in &lt;code&gt;slurm.conf&lt;/code&gt; and &lt;code&gt;cgroup.conf&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  CPU and memory scheduling
&lt;/h3&gt;

&lt;p&gt;Consider the following configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="na"&gt;SelectType&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;select&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;cons_tres&lt;/span&gt;
&lt;span class="na"&gt;SelectTypeParameters&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;CR_Core_Memory&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;SelectType=select/cons_tres&lt;/code&gt; enables consumable resource scheduling.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SelectTypeParameters=CR_Core_Memory&lt;/code&gt; tells Slurm to track consumable CPU cores and memory.&lt;/p&gt;

&lt;p&gt;Other configurations include &lt;code&gt;CR_Core&lt;/code&gt;, &lt;code&gt;CR_CPU&lt;/code&gt; and &lt;code&gt;CR_CPU_Memory&lt;/code&gt;, depending on how the administrator wants Slurm to track resources.&lt;/p&gt;

&lt;p&gt;For memory aware scheduling, a &lt;code&gt;*_Memory&lt;/code&gt; configuration is particularly important.&lt;/p&gt;

&lt;h3&gt;
  
  
  CPU and memory enforcement
&lt;/h3&gt;

&lt;p&gt;Scheduling resources and enforcing resource limits are two different things.&lt;/p&gt;

&lt;p&gt;For example, Slurm might reserve memory for a job, but that does not automatically mean the application is prevented from exceeding its allocation.&lt;/p&gt;

&lt;p&gt;Administrators can configure:&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;slurm.conf&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="na"&gt;TaskPlugin&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;cgroup&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;affinity&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In &lt;code&gt;cgroup.conf&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="na"&gt;ConstrainCores&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;yes&lt;/span&gt;
&lt;span class="na"&gt;ConstrainRAMSpace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;yes&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These settings enable cgroup based CPU and memory constraints.&lt;/p&gt;

&lt;p&gt;In simple terms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;ConstrainCores=yes&lt;/code&gt; restricts jobs to their allocated CPU cores.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ConstrainRAMSpace=yes&lt;/code&gt; enables memory enforcement through cgroups.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This helps prevent jobs from interfering with other workloads running on the same compute node.&lt;/p&gt;

&lt;h3&gt;
  
  
  Default memory allocation
&lt;/h3&gt;

&lt;p&gt;Does a user always need to specify &lt;code&gt;--mem&lt;/code&gt; or &lt;code&gt;--mem-per-cpu&lt;/code&gt;?&lt;/p&gt;

&lt;p&gt;No. Administrators can define default memory allocations.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="na"&gt;DefMemPerCPU&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;4000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This defines a default memory allocation of 4000 MiB per usable allocated CPU.&lt;/p&gt;

&lt;p&gt;Alternatively:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="na"&gt;DefMemPerNode&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;64000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This defines a default memory allocation of 64000 MiB per node.&lt;/p&gt;

&lt;p&gt;These are alternative configuration settings.&lt;/p&gt;

&lt;p&gt;Administrators can also define maximum memory limits using &lt;code&gt;MaxMemPerCPU&lt;/code&gt; or &lt;code&gt;MaxMemPerNode&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The important point is that the availability and behaviour of memory requests depend partly on how the administrator has configured Slurm.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. How can you check the configuration?
&lt;/h2&gt;

&lt;p&gt;If you are an HPC administrator or simply want to understand how your cluster is configured, you can inspect some of these settings.&lt;/p&gt;

&lt;p&gt;To check the main Slurm configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;scontrol show config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To check the resources available on a compute node:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;scontrol show node compute01
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To inspect cgroup configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cat /etc/slurm/cgroup.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The configuration file location may differ depending on the installation.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Final thoughts
&lt;/h2&gt;

&lt;p&gt;Understanding Slurm resource options is not just about memorising command line parameters. It is about understanding how your application uses the underlying HPC infrastructure.&lt;/p&gt;

&lt;p&gt;An MPI application might need multiple tasks distributed across several nodes. An OpenMP application might need one task with multiple CPU cores. Some applications need a fixed amount of memory per node, while others have memory requirements that scale with CPU allocation.&lt;/p&gt;

&lt;p&gt;There are also two sides to resource management: what the user requests and what the cluster administrator configures to schedule and enforce those requests.&lt;/p&gt;

&lt;p&gt;Before submitting your next HPC job, think about three questions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;How many tasks or processes does my application need?&lt;/li&gt;
&lt;li&gt;How many CPU cores does each task require?&lt;/li&gt;
&lt;li&gt;How much memory does the application need per node or per allocated CPU?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Once you understand these concepts, Slurm resource requests become much easier to understand and use effectively.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How CPUs and GPUs Work: Understanding Cores, Threads and Compute Architectures</title>
      <dc:creator>Muhammad Zubair Bin Akbar</dc:creator>
      <pubDate>Fri, 13 Nov 2026 16:08:33 +0000</pubDate>
      <link>https://dev.to/zubairakbar/how-cpus-and-gpus-work-understanding-cores-threads-and-compute-architectures-12hd</link>
      <guid>https://dev.to/zubairakbar/how-cpus-and-gpus-work-understanding-cores-threads-and-compute-architectures-12hd</guid>
      <description>&lt;p&gt;When we talk about High Performance Computing (HPC), we often hear terms such as CPU cores, GPU threads, compute units, parallel processing and heterogeneous computing.&lt;/p&gt;

&lt;p&gt;These terms are frequently used when discussing powerful servers, AI systems and scientific applications. But what do they actually mean?&lt;/p&gt;

&lt;p&gt;How does a CPU execute instructions? Why are GPUs designed to handle thousands of threads? What makes a CPU different from a GPU? And why do some processors combine CPU and GPU resources within the same architecture?&lt;/p&gt;

&lt;p&gt;To understand modern HPC systems, we first need to understand how processors execute work and how their computing resources are organised.&lt;/p&gt;

&lt;p&gt;Let's start with the basics.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. What Does a Processor Actually Do?
&lt;/h2&gt;

&lt;p&gt;At its simplest, a processor executes instructions.&lt;/p&gt;

&lt;p&gt;Think about a computer program that needs to calculate the sum of two numbers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;
&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The processor needs to execute instructions to retrieve the values, perform the addition and store the result.&lt;/p&gt;

&lt;p&gt;A processor repeatedly performs operations such as fetching instructions, decoding them and executing them.&lt;/p&gt;

&lt;p&gt;This is the fundamental job of a CPU or GPU, although their architectures and the way they organise execution are different.&lt;/p&gt;

&lt;p&gt;A processor contains several hardware components that work together to execute instructions. These include execution units, registers, control logic and other supporting components.&lt;/p&gt;

&lt;p&gt;The important question is how a processor handles multiple operations and tasks.&lt;/p&gt;

&lt;p&gt;This brings us to cores and threads.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Understanding CPU Cores and Threads
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is a CPU core?
&lt;/h3&gt;

&lt;p&gt;A CPU core is an individual processing unit within a processor.&lt;/p&gt;

&lt;p&gt;You can think of a core as a worker who can independently execute instructions.&lt;/p&gt;

&lt;p&gt;A CPU with eight physical cores has eight processing units capable of executing different instruction streams concurrently.&lt;/p&gt;

&lt;p&gt;For example, imagine an HPC server with an eight core CPU. One core might execute part of a scientific calculation, another might handle a separate process, while other cores work on additional tasks.&lt;/p&gt;

&lt;p&gt;This allows multiple workloads to make progress at the same time.&lt;/p&gt;

&lt;p&gt;However, having more cores does not automatically make every application faster. The application must be designed to divide its work across multiple cores.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a thread?
&lt;/h3&gt;

&lt;p&gt;A thread is an execution path within a program. It represents a sequence of instructions that can make progress independently of other threads.&lt;/p&gt;

&lt;p&gt;Imagine processing a dataset containing one million records.&lt;/p&gt;

&lt;p&gt;Instead of processing every record sequentially, an application could divide the dataset into smaller sections and assign each section to a different thread.&lt;/p&gt;

&lt;p&gt;Each thread works on its assigned section. If the system has enough available processing resources, multiple threads can execute concurrently.&lt;/p&gt;

&lt;p&gt;There is also an important distinction between software threads and hardware threads.&lt;/p&gt;

&lt;p&gt;A software thread is created by an application or runtime. A hardware thread is an execution context supported by the CPU.&lt;/p&gt;

&lt;p&gt;Modern CPUs can use Simultaneous Multithreading (SMT), allowing one physical core to maintain multiple hardware execution contexts.&lt;/p&gt;

&lt;p&gt;For example, an eight core CPU with two way SMT may expose 16 logical CPUs to the operating system.&lt;/p&gt;

&lt;p&gt;This does not mean the processor has 16 physical cores. The two hardware threads on each core share some of the same underlying execution resources.&lt;/p&gt;

&lt;h3&gt;
  
  
  How does this relate to HPC?
&lt;/h3&gt;

&lt;p&gt;In HPC environments, applications frequently use technologies such as OpenMP and MPI.&lt;/p&gt;

&lt;p&gt;OpenMP allows applications to create multiple threads that can execute across CPU cores within a shared memory system.&lt;/p&gt;

&lt;p&gt;MPI allows separate processes to communicate, including across different compute nodes.&lt;/p&gt;

&lt;p&gt;For example, a scientific application might use MPI to distribute work across four compute nodes and OpenMP to create multiple threads within each node.&lt;/p&gt;

&lt;p&gt;This combination is commonly used in parallel HPC applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Understanding GPUs and GPU Threads
&lt;/h2&gt;

&lt;p&gt;A GPU, or Graphics Processing Unit, is designed to handle large amounts of parallel computation.&lt;/p&gt;

&lt;p&gt;Although GPUs were originally developed primarily for graphics processing, their ability to perform many similar calculations simultaneously made them extremely useful for scientific computing, simulations and AI.&lt;/p&gt;

&lt;p&gt;A CPU is generally designed to handle a wide variety of tasks, including complex instructions and different execution paths.&lt;/p&gt;

&lt;p&gt;A GPU, on the other hand, is designed to execute large numbers of operations in parallel.&lt;/p&gt;

&lt;p&gt;Consider an application that needs to add two arrays containing one million numbers.&lt;/p&gt;

&lt;p&gt;The calculation for each element is independent of the others.&lt;/p&gt;

&lt;p&gt;A GPU can divide this work into thousands of smaller execution tasks, allowing many calculations to be performed concurrently.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a GPU thread?
&lt;/h3&gt;

&lt;p&gt;A GPU thread represents an individual execution instance that performs instructions on its assigned data.&lt;/p&gt;

&lt;p&gt;For example, one GPU thread might calculate the result for the first element of an array, while another calculates the second element.&lt;/p&gt;

&lt;p&gt;Thousands of these threads can be organised and scheduled by the GPU.&lt;/p&gt;

&lt;p&gt;In NVIDIA CUDA terminology, threads are grouped into blocks, and blocks are organised into a grid.&lt;/p&gt;

&lt;p&gt;Threads are also executed in groups called warps. On NVIDIA GPUs, a warp typically contains 32 threads.&lt;/p&gt;

&lt;p&gt;The hardware schedules these warps across its Streaming Multiprocessors (SMs).&lt;/p&gt;

&lt;p&gt;It is important to understand that a GPU thread is not the same as a physical CPU core. Thousands of GPU threads do not require thousands of separate physical processing units.&lt;/p&gt;

&lt;p&gt;Instead, the GPU hardware schedules and executes groups of threads across its available execution resources.&lt;/p&gt;

&lt;p&gt;This is one of the reasons GPUs can support such a large number of parallel tasks.&lt;/p&gt;

&lt;h3&gt;
  
  
  CPU threads vs GPU threads
&lt;/h3&gt;

&lt;p&gt;Although both CPUs and GPUs use threads, they organise and execute them differently.&lt;/p&gt;

&lt;p&gt;CPU threads are generally designed to handle varied instruction sequences and more independent execution paths.&lt;/p&gt;

&lt;p&gt;GPU threads are designed to support large scale parallelism, often performing similar operations across large collections of data.&lt;/p&gt;

&lt;p&gt;For example, a CPU might handle the application logic, prepare data and coordinate the workload, while a GPU performs thousands of mathematical operations on that data.&lt;/p&gt;

&lt;p&gt;Both are important, but they are optimised for different types of work.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Why Do Different Processors Have Different Architectures?
&lt;/h2&gt;

&lt;p&gt;Now that we understand CPU cores and GPU threads, we can look at how processors are designed.&lt;/p&gt;

&lt;p&gt;A compute architecture describes how processing resources are organised and how they interact with other components of a system.&lt;/p&gt;

&lt;p&gt;One important difference between processor architectures is how many types of processing resources are available and how they access memory.&lt;/p&gt;

&lt;p&gt;Let's look at three common examples.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. CPU, Discrete GPU and Integrated GPU Architectures
&lt;/h2&gt;

&lt;h3&gt;
  
  
  CPU based architecture
&lt;/h3&gt;

&lt;p&gt;In a traditional CPU based system, the CPU performs the main processing operations.&lt;/p&gt;

&lt;p&gt;It contains multiple cores, and each core can execute instructions independently.&lt;/p&gt;

&lt;p&gt;The CPU also has its own memory controllers and cache hierarchy to support efficient data access.&lt;/p&gt;

&lt;p&gt;This architecture is common in traditional servers and many HPC compute nodes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Discrete GPU architecture
&lt;/h3&gt;

&lt;p&gt;A discrete GPU is a separate processor installed in a system, usually connected through PCIe or another high speed interconnect.&lt;/p&gt;

&lt;p&gt;It has its own processing resources and dedicated memory.&lt;/p&gt;

&lt;p&gt;Imagine an HPC server containing a CPU and a separate GPU.&lt;/p&gt;

&lt;p&gt;The CPU handles general application tasks, while the GPU handles workloads that benefit from massive parallel computation.&lt;/p&gt;

&lt;p&gt;In this architecture, the CPU and GPU generally operate with separate physical memory spaces.&lt;/p&gt;

&lt;p&gt;This means the application or its runtime needs to manage how data becomes available to each processor.&lt;/p&gt;

&lt;p&gt;The separation between these memory spaces is an important architectural consideration when designing GPU accelerated applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  Integrated GPU and APU architecture
&lt;/h3&gt;

&lt;p&gt;An integrated GPU is built into the same processor package or system on chip as the CPU.&lt;/p&gt;

&lt;p&gt;Many integrated GPU designs share system memory with the CPU.&lt;/p&gt;

&lt;p&gt;An APU, or Accelerated Processing Unit, is a term commonly associated with AMD processors that combine CPU and GPU capabilities within one chip or package.&lt;/p&gt;

&lt;p&gt;In these architectures, CPU and GPU compute resources can access a shared memory space, depending on the hardware design.&lt;/p&gt;

&lt;p&gt;This can reduce the need to transfer data between completely separate physical memory spaces.&lt;/p&gt;

&lt;p&gt;However, shared memory does not mean that CPU and GPU resources have identical performance characteristics. They may compete for memory bandwidth and other shared resources.&lt;/p&gt;

&lt;p&gt;The important distinction is how the processing units and memory are organised, rather than simply whether the CPU and GPU are located on the same chip.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. What Is Heterogeneous Computing?
&lt;/h2&gt;

&lt;p&gt;Modern HPC and AI systems increasingly combine different types of processing resources.&lt;/p&gt;

&lt;p&gt;This approach is called heterogeneous computing.&lt;/p&gt;

&lt;p&gt;Instead of relying on only one type of processor, a system combines resources such as CPUs and GPUs so that each can perform the work it is best suited for.&lt;/p&gt;

&lt;p&gt;For example, an AI training workload might use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CPU cores to manage the application and prepare data.&lt;/li&gt;
&lt;li&gt;GPU compute units to perform mathematical operations.&lt;/li&gt;
&lt;li&gt;Multiple GPUs to distribute larger workloads.&lt;/li&gt;
&lt;li&gt;High speed networking to exchange information between GPUs across different servers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This combination allows applications to take advantage of different processor architectures.&lt;/p&gt;

&lt;p&gt;It is also important to understand that heterogeneous computing is not limited to CPUs and GPUs. Modern systems can include other specialised processing resources such as AI accelerators and data processing units.&lt;/p&gt;

&lt;p&gt;The objective is to improve overall system performance by selecting the right processing resources for different tasks.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Why Does Memory Architecture Matter?
&lt;/h2&gt;

&lt;p&gt;Although this article focuses on processors, memory is an important part of understanding compute architecture.&lt;/p&gt;

&lt;p&gt;A processor needs access to instructions and data before it can perform calculations.&lt;/p&gt;

&lt;p&gt;However, different processor designs organise memory differently.&lt;/p&gt;

&lt;p&gt;For example, a traditional CPU system uses system memory accessed through the CPU memory controllers.&lt;/p&gt;

&lt;p&gt;A discrete GPU generally has its own dedicated memory, while many integrated GPU designs share system memory with the CPU.&lt;/p&gt;

&lt;p&gt;These differences affect how applications are designed and how data moves through a system.&lt;/p&gt;

&lt;p&gt;They also influence performance, particularly when a workload needs to move large amounts of data between processing resources.&lt;/p&gt;

&lt;p&gt;Memory hierarchy, cache, bandwidth and High Bandwidth Memory (HBM) are important topics in their own right. We will explore these in more detail in a separate article.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. What Comes Next in Processor Design?
&lt;/h2&gt;

&lt;p&gt;Modern processor designs are becoming increasingly complex.&lt;/p&gt;

&lt;p&gt;Traditional processors were often designed around a single large silicon die containing the main processing components.&lt;/p&gt;

&lt;p&gt;However, manufacturing increasingly large and complex chips introduces challenges related to manufacturing yields, physical size, cost and power.&lt;/p&gt;

&lt;p&gt;This is where chiplet architecture becomes important.&lt;/p&gt;

&lt;p&gt;Instead of building everything into one large die, manufacturers can combine multiple smaller dies within a single package.&lt;/p&gt;

&lt;p&gt;Different chiplets can perform different functions, such as CPU processing, GPU computation and I/O operations.&lt;/p&gt;

&lt;p&gt;Advanced packaging technologies allow these components to communicate with one another at high speeds.&lt;/p&gt;

&lt;p&gt;Some modern designs also combine compute chiplets with High Bandwidth Memory (HBM), bringing large memory bandwidth close to the processing resources.&lt;/p&gt;

&lt;p&gt;These technologies are helping shape the next generation of HPC and AI processors.&lt;/p&gt;

&lt;p&gt;We will explore chiplets, HBM and advanced processor packaging in upcoming articles.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Understanding modern processors starts with understanding how they execute work.&lt;/p&gt;

&lt;p&gt;CPU cores provide processing resources for executing instruction streams, while threads allow applications to divide work into smaller execution paths.&lt;/p&gt;

&lt;p&gt;GPUs take parallelism further by organising large numbers of threads across their available execution resources.&lt;/p&gt;

&lt;p&gt;Different processor architectures also organise compute resources and memory in different ways. This includes traditional CPU systems, discrete GPUs and integrated CPU and GPU designs.&lt;/p&gt;

&lt;p&gt;These fundamentals are important for anyone learning HPC because they help explain why some applications benefit from more CPU cores, why others perform better on GPUs, and why modern systems increasingly combine different processing architectures.&lt;/p&gt;

&lt;p&gt;Before exploring advanced concepts such as chiplets, HBM and heterogeneous integration, it is important to understand how the processors themselves work.&lt;/p&gt;

&lt;p&gt;That is the foundation of modern high performance computing.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>devops</category>
      <category>architecture</category>
    </item>
    <item>
      <title>GDB Explained: Understanding How to Debug Applications in HPC</title>
      <dc:creator>Muhammad Zubair Bin Akbar</dc:creator>
      <pubDate>Sun, 08 Nov 2026 20:24:31 +0000</pubDate>
      <link>https://dev.to/zubairakbar/gdb-explained-understanding-how-to-debug-applications-in-hpc-22m4</link>
      <guid>https://dev.to/zubairakbar/gdb-explained-understanding-how-to-debug-applications-in-hpc-22m4</guid>
      <description>&lt;p&gt;When you write or run an application, things do not always go as expected.&lt;/p&gt;

&lt;p&gt;Sometimes the program crashes. Sometimes it produces incorrect results. Sometimes it runs for hours without finishing, even though there appears to be no obvious error.&lt;/p&gt;

&lt;p&gt;In these situations, how do you find out what actually went wrong?&lt;/p&gt;

&lt;p&gt;One common approach is to add &lt;code&gt;printf()&lt;/code&gt; statements throughout the code to display variable values and follow the execution. This can help, but it has limitations. You need to decide in advance what information to print, modify the source code and recompile the application every time you want to investigate something new.&lt;/p&gt;

&lt;p&gt;There is a more powerful approach: &lt;strong&gt;using a debugger&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;One of the most widely used debugging tools in Linux and software development is GDB, the GNU Debugger. In HPC environments, you may also encounter ROCgdb, AMD's version of GDB with additional capabilities for debugging GPU applications.&lt;/p&gt;

&lt;p&gt;Let's understand how these tools work and why they are useful.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. What exactly is GDB?
&lt;/h2&gt;

&lt;p&gt;GDB stands for GNU Debugger.&lt;/p&gt;

&lt;p&gt;Think of GDB as a tool that allows you to pause a running application, look inside it and understand what it is doing.&lt;/p&gt;

&lt;p&gt;Normally, when you execute a program, it runs from beginning to end without waiting for you.&lt;/p&gt;

&lt;p&gt;With GDB, you can take control of that execution.&lt;/p&gt;

&lt;p&gt;You can:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pause the application at a particular line of code.&lt;/li&gt;
&lt;li&gt;Check the values stored in variables.&lt;/li&gt;
&lt;li&gt;Execute the program one line at a time.&lt;/li&gt;
&lt;li&gt;Follow which functions called other functions.&lt;/li&gt;
&lt;li&gt;Investigate exactly where an application crashed.&lt;/li&gt;
&lt;li&gt;Change certain values or execution behaviour during debugging.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Imagine watching a recorded football match. Normally, you watch the entire match from beginning to end. But with a debugger, you can pause at any moment, go back to a particular point and examine what happened.&lt;/p&gt;

&lt;p&gt;That is essentially what GDB allows you to do with a running program.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Why is debugging important in HPC?
&lt;/h2&gt;

&lt;p&gt;In HPC, applications are often much more complicated than a simple standalone program.&lt;/p&gt;

&lt;p&gt;An application might use multiple MPI processes, CPU threads and GPUs. It might run across several compute nodes and execute for hours or even days.&lt;/p&gt;

&lt;p&gt;Consider a scientific simulation that runs across 32 compute nodes.&lt;/p&gt;

&lt;p&gt;After several hours, the application crashes.&lt;/p&gt;

&lt;p&gt;Without a debugger, you might only see an error message in the job output. You know something went wrong, but you may not know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which function caused the problem?&lt;/li&gt;
&lt;li&gt;Which variable contained an unexpected value?&lt;/li&gt;
&lt;li&gt;Where exactly did the application fail?&lt;/li&gt;
&lt;li&gt;Was the problem caused by an invalid memory access?&lt;/li&gt;
&lt;li&gt;Did the application receive a signal such as SIGSEGV?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A debugger helps investigate these questions by showing what was happening inside the application when the problem occurred.&lt;/p&gt;

&lt;p&gt;This is particularly useful when working with C, C++ and Fortran applications commonly found in scientific computing.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Before using GDB, prepare your application
&lt;/h2&gt;

&lt;p&gt;There is an important concept to understand before starting a debugger.&lt;/p&gt;

&lt;p&gt;When you compile a program, the compiler normally converts your source code into machine instructions that the processor can execute.&lt;/p&gt;

&lt;p&gt;However, the compiled application does not automatically retain all the information needed to make debugging easy.&lt;/p&gt;

&lt;p&gt;For example, when you look at a running program, you want to understand that the application is currently executing line 25 of &lt;code&gt;simulation.c&lt;/code&gt;, and that the variable &lt;code&gt;temperature&lt;/code&gt; contains the value 45.&lt;/p&gt;

&lt;p&gt;To make this possible, you need to compile the application with debugging information.&lt;/p&gt;

&lt;p&gt;Consider a simple C program.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Result = %d&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can compile it with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gcc &lt;span class="nt"&gt;-ggdb&lt;/span&gt; &lt;span class="nt"&gt;-O0&lt;/span&gt; program.c &lt;span class="nt"&gt;-o&lt;/span&gt; program
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two important compiler options are being used here.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;-ggdb&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This tells the compiler to generate debugging information in a format suitable for GDB.&lt;/p&gt;

&lt;p&gt;It helps the debugger understand source code, variable names, functions and line numbers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;-O0&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This disables compiler optimisation.&lt;/p&gt;

&lt;p&gt;Normally, compilers optimise applications to make them run faster. During optimisation, the compiler might rearrange instructions, remove unnecessary variables or combine calculations.&lt;/p&gt;

&lt;p&gt;This can make debugging confusing because the actual machine instructions may no longer correspond directly to the source code.&lt;/p&gt;

&lt;p&gt;For beginners, &lt;code&gt;-O0&lt;/code&gt; makes it easier to follow the program line by line.&lt;/p&gt;

&lt;p&gt;You might also encounter &lt;code&gt;-g&lt;/code&gt;, which generates debugging information in the platform's default format. Particularly for ROCgdb, &lt;code&gt;-ggdb&lt;/code&gt; is usually the recommendation, if available.&lt;/p&gt;

&lt;p&gt;One important point: optimisation can sometimes expose bugs that do not appear in an unoptimised build. If a problem only happens with &lt;code&gt;-O2&lt;/code&gt; or &lt;code&gt;-O3&lt;/code&gt;, you may need to reproduce it using those optimisation settings.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Starting GDB and running your application
&lt;/h2&gt;

&lt;p&gt;Once your application has been compiled with debugging information, you can start GDB.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gdb ./program
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will see a debugger prompt similar to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is where you enter debugging commands.&lt;/p&gt;

&lt;p&gt;Let's look at three useful commands.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;run&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This starts your application and allows it to execute normally.&lt;/p&gt;

&lt;p&gt;It continues until the application finishes, crashes or reaches a breakpoint.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;start&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This starts the application but pauses at the beginning of the &lt;code&gt;main()&lt;/code&gt; function.&lt;/p&gt;

&lt;p&gt;This is particularly useful for beginners because you can start investigating from the first line of your own application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;continue&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) continue
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells the debugger to resume execution from wherever the program is currently paused.&lt;/p&gt;

&lt;p&gt;Remember the difference:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;run&lt;/code&gt; starts the application again from the beginning.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;continue&lt;/code&gt; allows the current execution to carry on.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. What is a breakpoint?
&lt;/h2&gt;

&lt;p&gt;A breakpoint is one of the most important concepts in debugging.&lt;/p&gt;

&lt;p&gt;Imagine your application contains 500 lines of code. You suspect that something goes wrong around line 150.&lt;/p&gt;

&lt;p&gt;Instead of watching all 500 lines execute, you can tell GDB to stop when it reaches line 150.&lt;/p&gt;

&lt;p&gt;That stopping point is called a breakpoint.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) break program.c:15
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells GDB to stop when execution reaches line 15 of &lt;code&gt;program.c&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You can also set a breakpoint at the beginning of a function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) break main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) break calculate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second command tells GDB to stop when the &lt;code&gt;calculate()&lt;/code&gt; function is reached.&lt;/p&gt;

&lt;p&gt;You can then start the application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the program reaches your breakpoint, execution pauses and GDB gives you control.&lt;/p&gt;

&lt;p&gt;Why is this useful?&lt;/p&gt;

&lt;p&gt;Imagine a simulation has a function that calculates pressure. You suspect the function receives an incorrect value.&lt;/p&gt;

&lt;p&gt;You can set a breakpoint at that function and inspect its input values before it starts calculating.&lt;/p&gt;

&lt;p&gt;You do not need to watch the entire application. You can focus on the part you are interested in.&lt;/p&gt;

&lt;p&gt;You can also use temporary breakpoints, which are automatically removed after they are reached once.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) tbreak calculate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is useful when you only want to stop at a particular location once.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Stepping through your code
&lt;/h2&gt;

&lt;p&gt;Now that you understand breakpoints, let's look at another important concept: stepping.&lt;/p&gt;

&lt;p&gt;Stepping means executing your application one source line at a time.&lt;/p&gt;

&lt;p&gt;Imagine the following program:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Result = %d&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Suppose you start GDB and execute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The application stops at the beginning of &lt;code&gt;main()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You can now move through the code using different commands.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;next&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) next
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This executes the current line and moves to the next line.&lt;/p&gt;

&lt;p&gt;If the current line calls another function, GDB executes that function completely and stops at the next line in the current function.&lt;/p&gt;

&lt;p&gt;Think of it as saying: execute this line, but do not take me inside another function.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;step&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) step
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This also executes the current line, but if that line calls another function, GDB enters that function.&lt;/p&gt;

&lt;p&gt;For example, when execution reaches:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using &lt;code&gt;next&lt;/code&gt; executes &lt;code&gt;add()&lt;/code&gt; and moves to the following line in &lt;code&gt;main()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Using &lt;code&gt;step&lt;/code&gt; takes you inside &lt;code&gt;add()&lt;/code&gt;, allowing you to inspect how the addition is performed.&lt;/p&gt;

&lt;p&gt;This distinction is extremely important when debugging applications containing many functions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;finish&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) finish
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Suppose you have entered the &lt;code&gt;add()&lt;/code&gt; function and want to return to &lt;code&gt;main()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Instead of stepping through every remaining line, you can use &lt;code&gt;finish&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;GDB executes the rest of the current function and stops when it returns to the calling function. It also displays the returned value.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;until&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) until
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is useful when debugging loops.&lt;/p&gt;

&lt;p&gt;Imagine a loop runs 1,000 times. Stepping through every iteration would be tedious.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;until&lt;/code&gt; command can run the loop out to the line after it, rather than making you manually step through every iteration.&lt;/p&gt;

&lt;p&gt;Together, &lt;code&gt;next&lt;/code&gt;, &lt;code&gt;step&lt;/code&gt;, &lt;code&gt;finish&lt;/code&gt; and &lt;code&gt;until&lt;/code&gt; give you control over how you explore your application's execution.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Inspecting variables: What is happening inside the application?
&lt;/h2&gt;

&lt;p&gt;One of the most useful things about GDB is that it allows you to inspect variables while the application is paused.&lt;/p&gt;

&lt;p&gt;Consider this example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Suppose you stop at the line where &lt;code&gt;result&lt;/code&gt; is calculated.&lt;/p&gt;

&lt;p&gt;You can ask GDB to display the value of a variable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) print a
$1 = 10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Similarly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) print b
$2 = 20
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also inspect the result:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) print result
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;print&lt;/code&gt; command allows you to examine variables and expressions without adding extra &lt;code&gt;printf()&lt;/code&gt; statements to your source code.&lt;/p&gt;

&lt;p&gt;This becomes particularly useful when debugging scientific applications.&lt;/p&gt;

&lt;p&gt;Imagine a simulation calculates the temperature of thousands of points. You suspect one of the values is incorrect.&lt;/p&gt;

&lt;p&gt;You can pause execution and inspect the relevant variables to understand what values the application is actually using.&lt;/p&gt;

&lt;p&gt;Other useful commands include:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) info locals
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Displays local variables in the current function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) info args
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Displays the arguments passed to the current function.&lt;/p&gt;

&lt;p&gt;You can also use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) display a
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells GDB to automatically display the value of &lt;code&gt;a&lt;/code&gt; whenever execution stops.&lt;/p&gt;

&lt;p&gt;For example, when stepping through a loop, this helps you see how a variable changes without repeatedly typing &lt;code&gt;print a&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Understanding the call stack
&lt;/h2&gt;

&lt;p&gt;This is another important concept, especially when investigating application crashes.&lt;/p&gt;

&lt;p&gt;A call stack shows the sequence of functions that brought the application to its current execution point.&lt;/p&gt;

&lt;p&gt;Imagine your application has three functions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;main()
   |
   v
calculate()
   |
   v
divide()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;main()&lt;/code&gt; function calls &lt;code&gt;calculate()&lt;/code&gt;, and &lt;code&gt;calculate()&lt;/code&gt; calls &lt;code&gt;divide()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now imagine the application crashes inside &lt;code&gt;divide()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;How do you know how it reached that function?&lt;/p&gt;

&lt;p&gt;This is where the call stack becomes useful.&lt;/p&gt;

&lt;p&gt;You can use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) backtrace
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or its shorter form:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) bt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;GDB displays the chain of function calls.&lt;/p&gt;

&lt;p&gt;Think of it as a record of the application's journey.&lt;/p&gt;

&lt;p&gt;The function at the top of the backtrace is where execution currently stopped. The functions below it show how the application reached that point.&lt;/p&gt;

&lt;p&gt;You can also select a particular frame:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) frame 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And inspect its variables:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) info locals
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is particularly useful when a crash occurs deep inside a function and you want to understand which function called it and what values were passed.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. What happens when an application crashes?
&lt;/h2&gt;

&lt;p&gt;One common problem in C and C++ applications is a segmentation fault.&lt;/p&gt;

&lt;p&gt;A segmentation fault, commonly shown as &lt;code&gt;SIGSEGV&lt;/code&gt;, occurs when an application attempts an invalid memory access.&lt;/p&gt;

&lt;p&gt;For example, consider this code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%d&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;p&lt;/code&gt; is a pointer that contains a NULL value.&lt;/p&gt;

&lt;p&gt;The application attempts to access the memory location pointed to by &lt;code&gt;p&lt;/code&gt;, but it does not point to a valid object.&lt;/p&gt;

&lt;p&gt;As a result, the program may crash with a segmentation fault.&lt;/p&gt;

&lt;p&gt;If you run this application through GDB, the debugger can stop at the point where the error occurs.&lt;/p&gt;

&lt;p&gt;You might see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Program received signal SIGSEGV,
Segmentation fault.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can then run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) bt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To understand the function call sequence, and:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) print p
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To inspect the pointer.&lt;/p&gt;

&lt;p&gt;In this example, GDB can show that &lt;code&gt;p&lt;/code&gt; is NULL.&lt;/p&gt;

&lt;p&gt;This is much more useful than simply seeing that the application terminated with a segmentation fault.&lt;/p&gt;

&lt;p&gt;You can also tell GDB to stop when a particular signal occurs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) catch signal SIGSEGV
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is called a catchpoint. Unlike a normal breakpoint, which stops at a particular source code location, a catchpoint stops when a particular event occurs.&lt;/p&gt;

&lt;h2&gt;
  
  
  10. Watchpoints: Finding who changed a variable
&lt;/h2&gt;

&lt;p&gt;Sometimes the problem is not that a program crashes. Instead, a variable unexpectedly changes its value.&lt;/p&gt;

&lt;p&gt;Imagine a simulation contains a variable called &lt;code&gt;temperature&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You expect it to remain at 100, but somewhere in a large application, another part of the code changes it to 500.&lt;/p&gt;

&lt;p&gt;The challenge is finding exactly where that change happens.&lt;/p&gt;

&lt;p&gt;You could search through hundreds or thousands of lines of code.&lt;/p&gt;

&lt;p&gt;Or you could use a watchpoint.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) watch temperature
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A watchpoint tells GDB to stop when the value of &lt;code&gt;temperature&lt;/code&gt; changes.&lt;/p&gt;

&lt;p&gt;This is extremely useful when you know which variable is incorrect but do not know which part of the application is modifying it.&lt;/p&gt;

&lt;p&gt;There are also other forms:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rwatch&lt;/code&gt; stops when an expression is read.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;awatch&lt;/code&gt; stops when an expression is read or written.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(gdb) awatch array[2]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This can help investigate unexpected access to a particular array element.&lt;/p&gt;

&lt;p&gt;One practical limitation is that hardware watchpoints are limited in number and size. Software watchpoints may be much slower because the debugger has to monitor execution more frequently.&lt;/p&gt;

&lt;h2&gt;
  
  
  11. GDB versus ROCgdb: What is the difference?
&lt;/h2&gt;

&lt;p&gt;Now let's connect these concepts to GPU computing.&lt;/p&gt;

&lt;p&gt;Traditional GDB is designed primarily for debugging CPU applications.&lt;/p&gt;

&lt;p&gt;But modern HPC applications increasingly use GPUs for computational workloads.&lt;/p&gt;

&lt;p&gt;For example, an application might use the CPU to prepare data and then offload large calculations to an AMD GPU.&lt;/p&gt;

&lt;p&gt;This creates a challenge: how do you debug both the CPU and GPU portions of the same application?&lt;/p&gt;

&lt;p&gt;This is where ROCgdb comes in.&lt;/p&gt;

&lt;p&gt;ROCgdb is AMD's fork of the GNU Debugger. It builds on GDB and adds GPU specific debugging capabilities.&lt;/p&gt;

&lt;p&gt;The important point is that many familiar GDB commands remain available.&lt;/p&gt;

&lt;p&gt;You can use the same general debugging approach to inspect the CPU side of an application, while ROCgdb adds facilities for investigating the GPU side.&lt;/p&gt;

&lt;p&gt;For example, a GPU application might encounter an illegal memory access inside a GPU kernel.&lt;/p&gt;

&lt;p&gt;With GPU debugging support, you can investigate the kernel execution and inspect GPU threads rather than looking only at the CPU process.&lt;/p&gt;

&lt;p&gt;This is especially relevant when working with AMD GPUs and the ROCm software stack.&lt;/p&gt;

&lt;h2&gt;
  
  
  12. Why is debugging in HPC different?
&lt;/h2&gt;

&lt;p&gt;There is one final concept worth understanding.&lt;/p&gt;

&lt;p&gt;In a normal application, you might run the program directly from a terminal and interact with GDB whenever you want.&lt;/p&gt;

&lt;p&gt;HPC applications are often submitted through a scheduler such as Slurm.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sbatch simulation.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once submitted, the application runs inside a batch job on a compute node. You might not have an interactive terminal attached to it.&lt;/p&gt;

&lt;p&gt;This makes debugging more challenging.&lt;/p&gt;

&lt;p&gt;Instead of manually entering commands at the GDB prompt, you can prepare a script containing the debugging commands and let the debugger execute them automatically.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rocgdb &lt;span class="nt"&gt;-batch&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-ex&lt;/span&gt; &lt;span class="s2"&gt;"set pagination off"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-ex&lt;/span&gt; &lt;span class="s2"&gt;"break main"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-ex&lt;/span&gt; &lt;span class="s2"&gt;"run"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-ex&lt;/span&gt; &lt;span class="s2"&gt;"bt"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  ./program
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is what happens:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;-batch&lt;/code&gt; tells ROCgdb to execute the supplied commands and exit.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-ex&lt;/code&gt; supplies a debugger command.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;set pagination off&lt;/code&gt; prevents output from stopping at screenfuls.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;break main&lt;/code&gt; sets a breakpoint.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;run&lt;/code&gt; starts the application.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;bt&lt;/code&gt; displays the call stack.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is useful for automated debugging, testing and HPC environments where interactive sessions are not always practical.&lt;/p&gt;

&lt;p&gt;In MPI applications, attaching a debugger to just one rank can also be useful, but it has limitations. Pausing one process can affect timing, hide or introduce race conditions, or cause other processes to wait at an MPI communication point.&lt;/p&gt;

&lt;p&gt;This is why debugging parallel applications often requires tools and approaches designed for MPI.&lt;/p&gt;

&lt;h2&gt;
  
  
  13. The important commands to remember
&lt;/h2&gt;

&lt;p&gt;You do not need to memorise every GDB command when you are starting out. Focus on understanding what the common commands allow you to do.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;run&lt;/code&gt; starts the application.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;start&lt;/code&gt; starts and pauses at &lt;code&gt;main()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;break&lt;/code&gt; sets a breakpoint.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;continue&lt;/code&gt; resumes execution.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;next&lt;/code&gt; executes the next source line without entering a function.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;step&lt;/code&gt; enters a function.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;finish&lt;/code&gt; runs until the current function returns.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;until&lt;/code&gt; runs out of a loop.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;print&lt;/code&gt; displays a variable or expression.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;info locals&lt;/code&gt; displays local variables.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;info args&lt;/code&gt; displays function arguments.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;backtrace&lt;/code&gt; or &lt;code&gt;bt&lt;/code&gt; displays the call stack.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;watch&lt;/code&gt; stops when a variable changes.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;catch&lt;/code&gt; stops when a particular event occurs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Debugging is not simply about finding the line where an application crashes. It is about understanding what the application was doing, what data it was using and how it reached the point where something went wrong.&lt;/p&gt;

&lt;p&gt;GDB provides a way to pause execution, inspect variables, follow function calls and investigate errors without repeatedly modifying the source code.&lt;/p&gt;

&lt;p&gt;For HPC developers, these concepts become even more important when applications use MPI, multiple CPU threads and GPUs.&lt;/p&gt;

&lt;p&gt;Tools such as ROCgdb extend this debugging approach to AMD GPU applications, helping developers investigate both CPU and GPU execution.&lt;/p&gt;

&lt;p&gt;The best way to become comfortable with GDB is to practice with a small application. Compile it with debugging information, set a breakpoint, step through a function and inspect a few variables.&lt;/p&gt;

&lt;p&gt;Once you understand how to control a simple program, the same concepts provide a foundation for investigating much more complex HPC applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Acknowledgement
&lt;/h2&gt;

&lt;p&gt;This article is inspired by the knowledge and practical insights gained during the course attended at HLRS as well as CCFR EuroHPC.&lt;/p&gt;

&lt;p&gt;A big thank you to the teams at &lt;strong&gt;HLRS and CCFR EuroHPC&lt;/strong&gt;, along with the instructors, for sharing their expertise and providing such a valuable learning experience. The course offered an excellent opportunity to explore debugging concepts and tools used in real HPC and (AMD) GPU computing environments.&lt;/p&gt;

&lt;p&gt;This article is an effort to share some of that knowledge in a simple and accessible way, especially for those who are beginning their journey into HPC and parallel computing.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>debugging</category>
      <category>gpu</category>
    </item>
    <item>
      <title>Debugging in HPC: Understanding How to Find Bugs in Parallel and GPU Applications</title>
      <dc:creator>Muhammad Zubair Bin Akbar</dc:creator>
      <pubDate>Wed, 04 Nov 2026 16:58:29 +0000</pubDate>
      <link>https://dev.to/zubairakbar/debugging-in-hpc-understanding-how-to-find-bugs-in-parallel-and-gpu-applications-71</link>
      <guid>https://dev.to/zubairakbar/debugging-in-hpc-understanding-how-to-find-bugs-in-parallel-and-gpu-applications-71</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Imagine you have written a program that performs a scientific calculation. You run it on your laptop, and everything works perfectly.&lt;/p&gt;

&lt;p&gt;Now you move the same program to an HPC cluster. Instead of running on one CPU core, it runs across 32 CPU cores, multiple compute nodes and perhaps several GPUs.&lt;/p&gt;

&lt;p&gt;Suddenly, the program crashes. Or worse, it completes successfully but produces an incorrect result.&lt;/p&gt;

&lt;p&gt;Where would you start looking?&lt;/p&gt;

&lt;p&gt;Would you check the CPU? The GPU? The memory? Or perhaps one of the MPI processes?&lt;/p&gt;

&lt;p&gt;This is one of the challenges of High Performance Computing. As applications become more parallel, understanding and fixing bugs becomes more complicated.&lt;/p&gt;

&lt;p&gt;In a traditional application, you might have one process executing instructions from beginning to end. In an HPC application, hundreds or thousands of processes and threads can execute different parts of the same calculation simultaneously.&lt;/p&gt;

&lt;p&gt;A problem in just one process or GPU thread can affect the entire application.&lt;/p&gt;

&lt;p&gt;This is where debugging tools such as &lt;strong&gt;Linaro DDT&lt;/strong&gt; become useful. They allow developers to inspect what is happening inside an application, understand where something went wrong and investigate the reason behind the problem.&lt;/p&gt;

&lt;p&gt;Let's understand the concepts step by step.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. First, understand the different types of bugs
&lt;/h2&gt;

&lt;p&gt;Before learning about debugging tools, we need to understand what kind of problems we are trying to solve.&lt;/p&gt;

&lt;p&gt;Not every application problem looks like a crash. Sometimes an application runs perfectly from a technical perspective but produces the wrong answer.&lt;/p&gt;

&lt;p&gt;There are four common categories of bugs in parallel applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  Crashes
&lt;/h3&gt;

&lt;p&gt;A crash happens when one or more processes in an application terminate unexpectedly.&lt;/p&gt;

&lt;p&gt;For example, imagine an MPI application running across four processes:&lt;/p&gt;

&lt;p&gt;Rank 0, Rank 1, Rank 2 and Rank 3.&lt;/p&gt;

&lt;p&gt;If Rank 2 encounters an invalid memory access and terminates, the application may fail even though the other three processes are still running.&lt;/p&gt;

&lt;p&gt;Think of four people working together on a project. If one person suddenly leaves without completing their task, the entire project might stop.&lt;/p&gt;

&lt;p&gt;Crashes are generally among the easiest bugs to identify because the application visibly terminates.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hangs
&lt;/h3&gt;

&lt;p&gt;A hang happens when an application stops making useful progress.&lt;/p&gt;

&lt;p&gt;There are two important concepts here.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deadlock&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Imagine two people waiting for each other.&lt;/p&gt;

&lt;p&gt;Person A says, "I will continue when Person B gives me something."&lt;/p&gt;

&lt;p&gt;Person B says exactly the same thing.&lt;/p&gt;

&lt;p&gt;Neither person moves forward.&lt;/p&gt;

&lt;p&gt;This is similar to a deadlock in an MPI application.&lt;/p&gt;

&lt;p&gt;For example, two MPI processes might be waiting for messages from each other, but neither sends the message required by the other process.&lt;/p&gt;

&lt;p&gt;Both remain stuck.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Livelock&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A livelock is slightly different.&lt;/p&gt;

&lt;p&gt;Imagine two people trying to pass through a narrow doorway. Both move left to avoid each other. Then both move right. They keep moving, but neither gets through.&lt;/p&gt;

&lt;p&gt;They are doing something, but they are not making useful progress.&lt;/p&gt;

&lt;p&gt;In an application, processes or threads may continue executing instructions but fail to make overall progress towards completing the calculation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Race conditions
&lt;/h3&gt;

&lt;p&gt;A race condition happens when multiple threads access shared data at the same time and the final result depends on the order in which their operations happen.&lt;/p&gt;

&lt;p&gt;Let's take a very simple example.&lt;/p&gt;

&lt;p&gt;Imagine two threads are updating the same variable.&lt;/p&gt;

&lt;p&gt;The variable initially contains:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;counter = 10&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Both threads want to increase it by one.&lt;/p&gt;

&lt;p&gt;You might expect the final value to be 12.&lt;/p&gt;

&lt;p&gt;However, consider what happens:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Thread 1 reads the value 10.&lt;/li&gt;
&lt;li&gt;Thread 2 also reads the value 10.&lt;/li&gt;
&lt;li&gt;Thread 1 increases its copy to 11.&lt;/li&gt;
&lt;li&gt;Thread 2 increases its copy to 11.&lt;/li&gt;
&lt;li&gt;Both write 11 back to memory.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The final value becomes 11 instead of 12.&lt;/p&gt;

&lt;p&gt;Both threads executed their instructions, but the result is incorrect because their operations overlapped in an unsafe way.&lt;/p&gt;

&lt;p&gt;This is a race condition.&lt;/p&gt;

&lt;p&gt;Race conditions are particularly important in parallel programming because multiple threads can access shared data simultaneously.&lt;/p&gt;

&lt;h3&gt;
  
  
  Incorrect results
&lt;/h3&gt;

&lt;p&gt;This is perhaps the most dangerous category.&lt;/p&gt;

&lt;p&gt;An application starts successfully, performs its calculations and finishes without reporting an error.&lt;/p&gt;

&lt;p&gt;However, the answer is wrong.&lt;/p&gt;

&lt;p&gt;For example, imagine a scientific simulation calculating the temperature distribution across a material.&lt;/p&gt;

&lt;p&gt;The application completes successfully, but some temperature values are incorrect because of a calculation error or incorrect memory access.&lt;/p&gt;

&lt;p&gt;There might be no crash and no obvious warning.&lt;/p&gt;

&lt;p&gt;This is why debugging is not just about finding out why an application stopped. It is also about understanding whether the application calculated the correct answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. What is Linaro DDT?
&lt;/h2&gt;

&lt;p&gt;Now that we understand the types of bugs, let's look at a tool designed to investigate them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Linaro DDT is a graphical debugger designed for parallel applications and HPC environments.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It supports debugging applications written in languages such as C, C++, Fortran and Python.&lt;/p&gt;

&lt;p&gt;It is part of the Linaro Forge toolset.&lt;/p&gt;

&lt;p&gt;One important thing to understand is that DDT uses GDB underneath.&lt;/p&gt;

&lt;p&gt;You might already be familiar with GDB if you have worked with Linux application debugging.&lt;/p&gt;

&lt;p&gt;GDB allows developers to stop a program at a particular point, inspect variables, examine the call stack and execute instructions step by step.&lt;/p&gt;

&lt;p&gt;DDT builds on this debugging foundation and provides additional capabilities for parallel and GPU applications.&lt;/p&gt;

&lt;p&gt;Think about the difference:&lt;/p&gt;

&lt;p&gt;With traditional GDB, you might investigate what is happening inside one process.&lt;/p&gt;

&lt;p&gt;With DDT, you can investigate what is happening across multiple processes and threads at the same time.&lt;/p&gt;

&lt;p&gt;For example, if you have an MPI application running across 64 processes, DDT can help you compare their execution states and identify which process is behaving differently.&lt;/p&gt;

&lt;p&gt;This becomes extremely useful when debugging applications at HPC scale.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Why is debugging an MPI application different?
&lt;/h2&gt;

&lt;p&gt;Let's understand this with a simple example.&lt;/p&gt;

&lt;p&gt;Imagine you have an application that processes a large scientific dataset.&lt;/p&gt;

&lt;p&gt;Instead of processing everything using one CPU core, you divide the work between four MPI processes.&lt;/p&gt;

&lt;p&gt;Each process receives a portion of the dataset.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;Rank 0 processes the first section.&lt;/p&gt;

&lt;p&gt;Rank 1 processes the second section.&lt;/p&gt;

&lt;p&gt;Rank 2 processes the third section.&lt;/p&gt;

&lt;p&gt;Rank 3 processes the fourth section.&lt;/p&gt;

&lt;p&gt;All four processes work together to complete the calculation.&lt;/p&gt;

&lt;p&gt;Now imagine the application produces an incorrect result.&lt;/p&gt;

&lt;p&gt;Which process caused the problem?&lt;/p&gt;

&lt;p&gt;Perhaps Rank 0 is working correctly, Rank 1 is also correct, but Rank 2 has calculated an incorrect value.&lt;/p&gt;

&lt;p&gt;Rank 3 might simply be receiving incorrect information from Rank 2.&lt;/p&gt;

&lt;p&gt;If you only inspect the final result, identifying the original problem can be difficult.&lt;/p&gt;

&lt;p&gt;This is where parallel debugging becomes useful.&lt;/p&gt;

&lt;p&gt;DDT provides features that help developers:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Compare process execution:&lt;/strong&gt; Examine what different processes are doing and identify differences between them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inspect parallel stacks:&lt;/strong&gt; View the functions currently being executed by different processes and threads.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Identify MPI ranks:&lt;/strong&gt; Investigate which particular MPI rank is experiencing a problem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Compare variable values:&lt;/strong&gt; Check whether a variable has the expected value across different processes.&lt;/p&gt;

&lt;p&gt;Think of it as looking at several workers performing different tasks simultaneously rather than watching only one worker.&lt;/p&gt;

&lt;p&gt;This ability to compare processes is one of the most important concepts in parallel debugging.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Understanding the DDT interface
&lt;/h2&gt;

&lt;p&gt;The graphical interface of DDT contains several different windows and panels.&lt;/p&gt;

&lt;p&gt;At first, the interface might look complicated. However, each panel has a specific purpose.&lt;/p&gt;

&lt;p&gt;Here are some important areas.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Source Code View&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This displays the actual application source code.&lt;/p&gt;

&lt;p&gt;You can see the instructions being executed and identify the current execution point.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Variables&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This panel displays the values of variables at the current execution point.&lt;/p&gt;

&lt;p&gt;For example, if your application has variables called &lt;code&gt;temperature&lt;/code&gt;, &lt;code&gt;velocity&lt;/code&gt; and &lt;code&gt;pressure&lt;/code&gt;, you can inspect their current values.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Evaluate Window&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This allows you to evaluate expressions while debugging.&lt;/p&gt;

&lt;p&gt;For example, instead of simply looking at the value of &lt;code&gt;x&lt;/code&gt;, you might want to calculate &lt;code&gt;x + y&lt;/code&gt; to understand what the program is producing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Parallel Stack&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is particularly important in HPC.&lt;/p&gt;

&lt;p&gt;It allows you to inspect the call stacks of multiple processes and threads.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Process Controls&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These controls allow you to start, stop, pause and step through application execution.&lt;/p&gt;

&lt;p&gt;Understanding these panels makes it easier to investigate problems without constantly switching between different debugging tools.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. What is a call stack and why does it matter?
&lt;/h2&gt;

&lt;p&gt;The call stack is one of the most important concepts in application debugging.&lt;/p&gt;

&lt;p&gt;Let's understand it with a simple example.&lt;/p&gt;

&lt;p&gt;Imagine your program contains three functions:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;main()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;calculate()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;update()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The program starts inside &lt;code&gt;main()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;main()&lt;/code&gt; function calls &lt;code&gt;calculate()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Then &lt;code&gt;calculate()&lt;/code&gt; calls &lt;code&gt;update()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If the application encounters an error inside &lt;code&gt;update()&lt;/code&gt;, the call stack helps you understand how the program reached that point.&lt;/p&gt;

&lt;p&gt;It might look like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;main() → calculate() → update()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This gives you the execution path that led to the problem.&lt;/p&gt;

&lt;p&gt;Now imagine an MPI application with 64 processes.&lt;/p&gt;

&lt;p&gt;Each process might be executing a different function or might be waiting at a different point.&lt;/p&gt;

&lt;p&gt;Inspecting the call stack of every process individually would be time consuming.&lt;/p&gt;

&lt;p&gt;DDT provides a Parallel Stack View that helps developers examine these execution states together.&lt;/p&gt;

&lt;p&gt;It can also display GPU threads in the parallel stack view.&lt;/p&gt;

&lt;p&gt;This is particularly useful when debugging applications that combine CPU execution with GPU computation.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Understanding GPU debugging
&lt;/h2&gt;

&lt;p&gt;So far, we have mainly discussed CPU and MPI debugging.&lt;/p&gt;

&lt;p&gt;But modern HPC applications increasingly use GPUs to accelerate scientific calculations.&lt;/p&gt;

&lt;p&gt;GPU debugging introduces another level of complexity.&lt;/p&gt;

&lt;p&gt;Let's first understand how GPU execution works.&lt;/p&gt;

&lt;p&gt;A GPU contains many processing units that can execute a large number of threads simultaneously.&lt;/p&gt;

&lt;p&gt;For example, imagine a scientific application that needs to perform the same mathematical operation on thousands of data elements.&lt;/p&gt;

&lt;p&gt;Instead of processing each element sequentially on the CPU, the application can distribute the work across GPU threads.&lt;/p&gt;

&lt;p&gt;This is extremely useful for computationally intensive workloads.&lt;/p&gt;

&lt;p&gt;However, what happens if one of those GPU threads accesses an invalid memory location?&lt;/p&gt;

&lt;p&gt;The application might encounter an illegal memory access error.&lt;/p&gt;

&lt;p&gt;Finding the exact thread responsible for the problem can be difficult.&lt;/p&gt;

&lt;p&gt;This is where GPU debugging tools become important.&lt;/p&gt;

&lt;h3&gt;
  
  
  Debugging AMD GPUs with DDT
&lt;/h3&gt;

&lt;p&gt;DDT supports GPU debugging on AMD hardware using ROCm and ROCgdb.&lt;/p&gt;

&lt;p&gt;It allows developers to debug CPU and GPU execution together.&lt;/p&gt;

&lt;p&gt;This is important because GPU applications do not operate independently of the CPU.&lt;/p&gt;

&lt;p&gt;The CPU typically manages the application and launches GPU kernels, while the GPU performs the computational work.&lt;/p&gt;

&lt;p&gt;If something goes wrong, developers may need to inspect both sides.&lt;/p&gt;

&lt;p&gt;Some important GPU debugging features include:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Kernel Progress View&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This helps you understand the progress of GPU kernels.&lt;/p&gt;

&lt;p&gt;A kernel is a function that executes on the GPU.&lt;/p&gt;

&lt;p&gt;For example, a matrix multiplication application might launch a GPU kernel to calculate different portions of the result matrix.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GPU Thread Selector&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This allows developers to select particular GPU threads for inspection.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GPU Device Pane&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This provides information about the GPU device involved in the debugging session.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GPU Thread in Parallel Stack View&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This helps developers inspect GPU thread execution alongside other execution information.&lt;/p&gt;

&lt;p&gt;There is also an important detail about AMD GPU debugging.&lt;/p&gt;

&lt;p&gt;DDT can step through a complete GPU wavefront of 64 threads at a time.&lt;/p&gt;

&lt;p&gt;A wavefront is a group of GPU threads that execute together on AMD GPU hardware.&lt;/p&gt;

&lt;p&gt;This is different from stepping through a single CPU instruction or thread.&lt;/p&gt;

&lt;p&gt;For AMD GPU debugging, the application must be compiled with debugging information using &lt;code&gt;-g&lt;/code&gt;, and ROCgdb must be available in the environment.&lt;/p&gt;

&lt;p&gt;For the AMD MI300A GPU architecture used in the Hunter examples, the architecture can be specified using:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;--offload-arch=gfx942&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The important takeaway is that debugging GPU applications requires awareness of how GPU threads execute, how kernels are launched and how memory is accessed.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. One of the most important GPU bugs: Illegal memory access
&lt;/h2&gt;

&lt;p&gt;Let's understand a practical GPU debugging problem.&lt;/p&gt;

&lt;p&gt;Imagine you have a three dimensional scientific dataset.&lt;/p&gt;

&lt;p&gt;For simplicity, think about a box containing thousands of small cells.&lt;/p&gt;

&lt;p&gt;Each cell has neighbouring cells around it.&lt;/p&gt;

&lt;p&gt;A GPU application processes these cells and performs calculations using their neighbouring values.&lt;/p&gt;

&lt;p&gt;However, the application needs to calculate the correct memory location for each neighbour.&lt;/p&gt;

&lt;p&gt;What happens if it calculates the wrong memory address?&lt;/p&gt;

&lt;p&gt;It might attempt to access memory outside the allocated array.&lt;/p&gt;

&lt;p&gt;This is called an out of bounds memory access.&lt;/p&gt;

&lt;h3&gt;
  
  
  A simple example
&lt;/h3&gt;

&lt;p&gt;Imagine you have an array containing ten elements.&lt;/p&gt;

&lt;p&gt;The valid indexes are:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;0, 1, 2, 3, 4, 5, 6, 7, 8, 9&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now imagine your program attempts to access:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;array[10]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That location is outside the array.&lt;/p&gt;

&lt;p&gt;The program is trying to access memory that does not belong to the allocated array.&lt;/p&gt;

&lt;p&gt;This can result in an illegal memory access, a crash or incorrect behaviour.&lt;/p&gt;

&lt;h3&gt;
  
  
  A practical example: Marching Tetrahedra
&lt;/h3&gt;

&lt;p&gt;Consider a GPU implementation of an algorithm called Marching Tetrahedra.&lt;/p&gt;

&lt;p&gt;This algorithm is used to extract an approximate three dimensional surface from a scalar field.&lt;/p&gt;

&lt;p&gt;A scalar field is simply a dataset in which every point has a numerical value.&lt;/p&gt;

&lt;p&gt;For example, imagine a three dimensional space in which every point represents a temperature or pressure measurement.&lt;/p&gt;

&lt;p&gt;To perform its calculations, the algorithm needs to access the eight neighbouring points around each position.&lt;/p&gt;

&lt;p&gt;The developers converted the three dimensional dataset into a one dimensional array to make it easier to process on the GPU.&lt;/p&gt;

&lt;p&gt;However, calculating the memory positions of neighbouring points became more complicated.&lt;/p&gt;

&lt;p&gt;The problem appeared when GPU threads processed points close to the boundaries of the dataset.&lt;/p&gt;

&lt;p&gt;For example, when a thread processed a point at the edge of the three dimensional domain, its neighbour calculations could produce an invalid memory address.&lt;/p&gt;

&lt;p&gt;This resulted in illegal memory access errors.&lt;/p&gt;

&lt;p&gt;The underlying issue was incorrect boundary checking.&lt;/p&gt;

&lt;p&gt;Using Linaro DDT, developers could investigate the problematic GPU threads and identify the out of bounds memory accesses.&lt;/p&gt;

&lt;p&gt;This is a very important lesson for anyone learning GPU programming.&lt;/p&gt;

&lt;p&gt;Your application might work correctly for most data elements but fail when processing elements at the edges of an array.&lt;/p&gt;

&lt;p&gt;Always think about array boundaries and whether every memory access is valid.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Understanding the Multi Dimensional Array Viewer
&lt;/h2&gt;

&lt;p&gt;Another useful feature of DDT is the Multi Dimensional Array Viewer.&lt;/p&gt;

&lt;p&gt;Let's understand why this is useful.&lt;/p&gt;

&lt;p&gt;Imagine your application contains a two dimensional array representing temperature values across a surface.&lt;/p&gt;

&lt;p&gt;The array might look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10   12   14   16
11   13   15   17
12   14   16   18
13   15   17   19
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can understand the data by looking at these numbers.&lt;/p&gt;

&lt;p&gt;But imagine the array contains thousands or millions of elements.&lt;/p&gt;

&lt;p&gt;Looking at every value individually becomes difficult.&lt;/p&gt;

&lt;p&gt;The Multi Dimensional Array Viewer allows developers to inspect arrays visually.&lt;/p&gt;

&lt;p&gt;It supports viewing arrays on a single process or distributed across multiple MPI ranks.&lt;/p&gt;

&lt;p&gt;You can also specify which portions of an array you want to inspect.&lt;/p&gt;

&lt;p&gt;For example, you might want to view only rows 0 to 10 and columns 0 to 10.&lt;/p&gt;

&lt;p&gt;The viewer also supports filtering.&lt;/p&gt;

&lt;p&gt;Imagine you only want to see elements with values greater than zero.&lt;/p&gt;

&lt;p&gt;You can use the condition:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$value &amp;gt; 0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The tool can also visualise array data as a three dimensional representation.&lt;/p&gt;

&lt;p&gt;Why is this useful?&lt;/p&gt;

&lt;p&gt;Because sometimes a numerical problem becomes much easier to understand when you can actually see the data rather than simply reading individual values.&lt;/p&gt;

&lt;p&gt;For scientific applications working with matrices, grids and multidimensional datasets, this can be particularly helpful.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. What is offline debugging?
&lt;/h2&gt;

&lt;p&gt;Until now, we have discussed debugging through a graphical interface.&lt;/p&gt;

&lt;p&gt;But imagine you have an application that runs for several hours on a large HPC cluster.&lt;/p&gt;

&lt;p&gt;You cannot always sit in front of the debugger and watch every execution step.&lt;/p&gt;

&lt;p&gt;This is where offline debugging becomes useful.&lt;/p&gt;

&lt;p&gt;DDT can run in a non interactive mode.&lt;/p&gt;

&lt;p&gt;Instead of manually opening the debugger and inspecting the application, you can execute the application under DDT and generate a debugging report.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ddt &lt;span class="nt"&gt;--offline&lt;/span&gt; &lt;span class="nt"&gt;--output&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;report.html mpiexec &lt;span class="nt"&gt;-n&lt;/span&gt; 4 ./simple
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's understand the command.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ddt&lt;/code&gt; launches the DDT debugger.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;--offline&lt;/code&gt; enables non interactive debugging.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;--output=report.html&lt;/code&gt; specifies the name of the generated report.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mpiexec -n 4&lt;/code&gt; launches the application using four MPI processes.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;./simple&lt;/code&gt; is the application being debugged.&lt;/p&gt;

&lt;p&gt;You can also specify a particular source code location where you want the debugger to stop.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ddt &lt;span class="nt"&gt;--offline&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; offline-debugging.html &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--break-at&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;simple.c:43 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--evaluate&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"recvbuf; sendbuf"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    mpiexec &lt;span class="nt"&gt;-n&lt;/span&gt; 4 ./simple
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, the debugger is instructed to stop at line 43 of &lt;code&gt;simple.c&lt;/code&gt; and evaluate the variables &lt;code&gt;recvbuf&lt;/code&gt; and &lt;code&gt;sendbuf&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The resulting report can help developers understand what happened during execution.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;--mem-debug&lt;/code&gt; option can also be used to enable memory debugging and memory leak detection.&lt;/p&gt;

&lt;p&gt;This approach is particularly useful for long running applications, large scale debugging and automated testing or continuous integration workflows.&lt;/p&gt;

&lt;h2&gt;
  
  
  10. How does debugging work on an actual HPC cluster?
&lt;/h2&gt;

&lt;p&gt;Debugging an HPC application is not necessarily something you do directly on your laptop.&lt;/p&gt;

&lt;p&gt;The application might be running on remote compute nodes, while you use a graphical interface on your local machine.&lt;/p&gt;

&lt;p&gt;Consider a remote debugging workflow using Linaro DDT.&lt;/p&gt;

&lt;p&gt;First, the Linaro Forge remote client is installed on the developer's laptop.&lt;/p&gt;

&lt;p&gt;The developer configures a remote connection to the HPC system by providing the login details and the Forge installation directory on the cluster.&lt;/p&gt;

&lt;p&gt;After authentication, including the required one time authentication code, the debugging job is launched on the HPC system.&lt;/p&gt;

&lt;p&gt;The job starts DDT in connect mode and waits for the remote client.&lt;/p&gt;

&lt;p&gt;The developer then accepts the Reverse Connect request from the local client.&lt;/p&gt;

&lt;p&gt;This establishes the debugging session.&lt;/p&gt;

&lt;p&gt;The important concept is that the application executes on the HPC system, while the developer interacts with it through the graphical debugging client.&lt;/p&gt;

&lt;p&gt;This is particularly useful when working with large HPC systems where applications need access to specific compute nodes and GPU resources.&lt;/p&gt;

&lt;h3&gt;
  
  
  What about Slurm?
&lt;/h3&gt;

&lt;p&gt;In an HPC environment managed by Slurm, the same general principle applies.&lt;/p&gt;

&lt;p&gt;The debugging application must run within an appropriate compute allocation with the required CPU, memory and GPU resources.&lt;/p&gt;

&lt;p&gt;For example, a user might request an interactive allocation or submit a batch job, depending on the cluster configuration and debugging workflow.&lt;/p&gt;

&lt;p&gt;The exact commands depend on how the HPC system and debugging software are configured.&lt;/p&gt;

&lt;p&gt;The important concept is that debugging jobs must run within the HPC cluster's allocated resources and execution environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  11. What should beginners take away from all this?
&lt;/h2&gt;

&lt;p&gt;If you are new to HPC, you do not need to remember every DDT feature or command immediately.&lt;/p&gt;

&lt;p&gt;Instead, focus on understanding the concepts.&lt;/p&gt;

&lt;p&gt;First, debugging parallel applications is different from debugging ordinary serial applications because multiple processes and threads execute simultaneously.&lt;/p&gt;

&lt;p&gt;Second, MPI debugging requires you to understand what individual ranks are doing and whether they are communicating correctly.&lt;/p&gt;

&lt;p&gt;Third, GPU debugging introduces additional complexity because thousands of GPU threads may execute different parts of a calculation.&lt;/p&gt;

&lt;p&gt;Fourth, memory errors are particularly important. An incorrect array index or boundary condition can cause an application to access memory outside its allocated region.&lt;/p&gt;

&lt;p&gt;Finally, debugging is not just about finding where an application crashes. It is about understanding why the application behaves incorrectly.&lt;/p&gt;

&lt;p&gt;Tools such as Linaro DDT make this investigation easier by providing visibility into processes, threads, variables, call stacks, arrays and GPU execution.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;As HPC applications become more complex, debugging becomes an essential part of scientific computing.&lt;/p&gt;

&lt;p&gt;An application that works correctly on a single CPU core might behave differently when distributed across multiple MPI processes or executed on GPUs.&lt;/p&gt;

&lt;p&gt;Understanding how to inspect processes, investigate memory access, compare variables and analyse execution states is therefore an important skill for HPC developers and engineers.&lt;/p&gt;

&lt;p&gt;The biggest lesson is simple: &lt;strong&gt;Do not just look at the error message. Understand what the application was doing when the error occurred.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That is the foundation of effective debugging in HPC.&lt;/p&gt;

&lt;p&gt;If you are learning parallel programming, start by understanding serial debugging with GDB, then move towards MPI debugging and finally GPU debugging.&lt;/p&gt;

&lt;p&gt;Once you understand these fundamentals, tools like Linaro DDT become much easier to learn and use.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>linux</category>
      <category>debugging</category>
    </item>
    <item>
      <title>GPU Memory Explained: VRAM, System RAM and GPU Utilisation</title>
      <dc:creator>Muhammad Zubair Bin Akbar</dc:creator>
      <pubDate>Sat, 31 Oct 2026 17:39:49 +0000</pubDate>
      <link>https://dev.to/zubairakbar/gpu-memory-explained-vram-system-ram-and-gpu-utilisation-2gki</link>
      <guid>https://dev.to/zubairakbar/gpu-memory-explained-vram-system-ram-and-gpu-utilisation-2gki</guid>
      <description>&lt;p&gt;GPUs have become an important part of modern computing. They are used in Artificial Intelligence, Machine Learning, scientific simulations and High Performance Computing (HPC).&lt;/p&gt;

&lt;p&gt;When people discuss GPU performance, they often focus on the number of GPU cores, processing power or memory capacity. However, there is another important part that can significantly affect performance: &lt;strong&gt;GPU memory&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You might have come across terms such as VRAM, System RAM, GPU Memory Usage and GPU Utilisation when monitoring a server or running an AI workload.&lt;/p&gt;

&lt;p&gt;Although these terms are related, they do not mean the same thing.&lt;/p&gt;

&lt;p&gt;Let's understand what each one means and how they work together.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. What is GPU Memory?
&lt;/h2&gt;

&lt;p&gt;Just like a CPU needs memory to work with data, a GPU also needs memory to perform its calculations.&lt;/p&gt;

&lt;p&gt;When a GPU processes an application, it needs to access data such as model parameters, images, datasets and intermediate calculation results.&lt;/p&gt;

&lt;p&gt;This information is stored in GPU memory so that the GPU can access it while performing computations.&lt;/p&gt;

&lt;p&gt;For example, imagine running an AI model on a server. Before the GPU can process the model, its parameters and other required data need to be made available in GPU memory.&lt;/p&gt;

&lt;p&gt;The amount of available memory can determine which models you can run, how large your datasets can be and how much data the GPU can process at once.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. What is VRAM?
&lt;/h2&gt;

&lt;p&gt;VRAM stands for Video Random Access Memory. It is the dedicated memory available on a graphics card or GPU.&lt;/p&gt;

&lt;p&gt;Unlike normal system memory, VRAM is designed to work closely with the GPU and provide fast access to the data it needs.&lt;/p&gt;

&lt;p&gt;Modern GPUs use high bandwidth memory technologies such as GDDR6, GDDR6X and HBM.&lt;/p&gt;

&lt;p&gt;You will commonly find GDDR memory in graphics cards, while many high performance data centre GPUs use HBM.&lt;/p&gt;

&lt;p&gt;For example, an NVIDIA data centre GPU might have 80 GB of HBM memory.&lt;/p&gt;

&lt;p&gt;This means the GPU has 80 GB of dedicated memory available for storing data required by its workloads.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why does VRAM matter for AI?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Consider running a Large Language Model (LLM).&lt;/p&gt;

&lt;p&gt;The GPU needs memory to store:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Model weights and parameters.&lt;/li&gt;
&lt;li&gt;Input and output data.&lt;/li&gt;
&lt;li&gt;Intermediate calculations.&lt;/li&gt;
&lt;li&gt;Activations and other working data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the model requires more memory than the GPU has available, it may fail to load or require techniques such as model quantisation, offloading or splitting the model across multiple GPUs.&lt;/p&gt;

&lt;p&gt;This is why VRAM capacity is an important consideration when selecting GPUs for AI infrastructure.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. What is System RAM?
&lt;/h2&gt;

&lt;p&gt;System RAM is the main memory available to the CPU.&lt;/p&gt;

&lt;p&gt;It stores the data and instructions that applications and the operating system need while running.&lt;/p&gt;

&lt;p&gt;For example, when you start an AI application, its processes run on the CPU and use system RAM. When the application needs GPU processing, the required data is transferred to the GPU.&lt;/p&gt;

&lt;p&gt;Think of a server with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;256 GB System RAM.&lt;/li&gt;
&lt;li&gt;One GPU with 80 GB VRAM.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are two separate memory resources.&lt;/p&gt;

&lt;p&gt;Having 256 GB of system RAM does not mean that the GPU has 256 GB available. The GPU still has its own 80 GB of dedicated memory.&lt;/p&gt;

&lt;p&gt;The CPU and GPU can exchange data through interfaces such as PCIe. In some systems, technologies such as NVIDIA NVLink provide additional high speed communication between GPUs or supported processors.&lt;/p&gt;

&lt;p&gt;System RAM and VRAM work together, but they serve different purposes.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. How Do System RAM and VRAM Work Together?
&lt;/h2&gt;

&lt;p&gt;Let's use a simple example.&lt;/p&gt;

&lt;p&gt;Imagine you are running an AI image recognition application.&lt;/p&gt;

&lt;p&gt;First, the application starts on the server and uses system RAM to load its files and prepare the data.&lt;/p&gt;

&lt;p&gt;Next, the required model and input data are transferred to GPU memory.&lt;/p&gt;

&lt;p&gt;The GPU processes the data and performs the calculations.&lt;/p&gt;

&lt;p&gt;The resulting information can then be transferred back to system RAM for the CPU and application to use.&lt;/p&gt;

&lt;p&gt;This is a simplified explanation, as real applications can move data between CPU and GPU memory multiple times.&lt;/p&gt;

&lt;p&gt;The important point is that both memory resources are involved in the workload.&lt;/p&gt;

&lt;p&gt;If system RAM is insufficient, the application may struggle before the GPU even starts processing.&lt;/p&gt;

&lt;p&gt;If VRAM is insufficient, the GPU may not be able to load the model or process the required data efficiently.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. What is GPU Utilisation?
&lt;/h2&gt;

&lt;p&gt;GPU utilisation is a measurement of how busy the GPU is performing its processing work.&lt;/p&gt;

&lt;p&gt;It is usually displayed as a percentage.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;0% means the GPU is doing little or no processing work at that moment.&lt;/li&gt;
&lt;li&gt;50% means the GPU is moderately busy.&lt;/li&gt;
&lt;li&gt;100% means the GPU is fully busy according to the utilisation metric being reported.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, GPU utilisation should not be confused with GPU memory usage.&lt;/p&gt;

&lt;p&gt;These are two different measurements.&lt;/p&gt;

&lt;p&gt;Imagine a GPU with 80 GB of VRAM.&lt;/p&gt;

&lt;p&gt;An AI workload might use 70 GB of VRAM but show only 20% GPU utilisation.&lt;/p&gt;

&lt;p&gt;This means a large amount of GPU memory is occupied, but the GPU is not necessarily performing calculations continuously.&lt;/p&gt;

&lt;p&gt;Similarly, another workload might show 95% GPU utilisation while using only 15 GB of VRAM.&lt;/p&gt;

&lt;p&gt;The GPU is working hard, but it does not need to occupy all its available memory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;High memory usage does not always mean high GPU utilisation, and high GPU utilisation does not mean all GPU memory is occupied.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  6. How to Monitor GPU Memory and Utilisation
&lt;/h2&gt;

&lt;p&gt;If you work with NVIDIA GPUs, one of the easiest ways to monitor GPU activity is through the &lt;code&gt;nvidia-smi&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;Run:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;nvidia-smi&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This displays useful information, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GPU model.&lt;/li&gt;
&lt;li&gt;Total GPU memory.&lt;/li&gt;
&lt;li&gt;Used GPU memory.&lt;/li&gt;
&lt;li&gt;Free GPU memory.&lt;/li&gt;
&lt;li&gt;GPU utilisation.&lt;/li&gt;
&lt;li&gt;Temperature and power consumption.&lt;/li&gt;
&lt;li&gt;Running GPU processes, where supported.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, you might see:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;GPU Utilisation: 85%&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Memory Usage: 65 GB / 80 GB&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This tells you that the GPU is heavily utilised and that 65 GB of its 80 GB memory is occupied.&lt;/p&gt;

&lt;p&gt;For continuous monitoring, you can use:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;nvidia-smi -l 1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This refreshes the output every second.&lt;/p&gt;

&lt;p&gt;These commands are particularly useful when troubleshooting AI and HPC workloads.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Why Does This Matter in HPC and AI Infrastructure?
&lt;/h2&gt;

&lt;p&gt;Understanding GPU memory becomes especially important when designing and managing HPC and AI environments.&lt;/p&gt;

&lt;p&gt;Consider a server containing four GPUs, each with 80 GB of VRAM.&lt;/p&gt;

&lt;p&gt;Although the server has 320 GB of total GPU memory across all four devices, this does not automatically mean that a single application can use all 320 GB as one shared memory space.&lt;/p&gt;

&lt;p&gt;The application needs to support multi GPU execution and distribute its workload across the GPUs.&lt;/p&gt;

&lt;p&gt;This is particularly important when running large AI models that cannot fit into the memory of a single GPU.&lt;/p&gt;

&lt;p&gt;Another important consideration is GPU memory bandwidth.&lt;/p&gt;

&lt;p&gt;Memory capacity tells us how much data can be stored, while memory bandwidth tells us how quickly data can be transferred between GPU memory and the GPU processing units.&lt;/p&gt;

&lt;p&gt;Both are important for performance.&lt;/p&gt;

&lt;p&gt;A GPU might have plenty of memory capacity, but if its memory bandwidth is insufficient for a particular workload, performance can still be affected.&lt;/p&gt;

&lt;p&gt;This is why GPU selection for HPC and AI infrastructure should consider memory capacity, bandwidth, processing power and the requirements of the applications being deployed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;GPU performance is not just about processing power. Memory plays an equally important role in determining what workloads a GPU can handle and how efficiently it can process them.&lt;/p&gt;

&lt;p&gt;The key points to remember are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;VRAM is the dedicated memory used by the GPU.&lt;/li&gt;
&lt;li&gt;System RAM is the main memory used by the CPU and applications.&lt;/li&gt;
&lt;li&gt;GPU utilisation indicates how busy the GPU is processing work.&lt;/li&gt;
&lt;li&gt;GPU memory usage and GPU utilisation measure different things.&lt;/li&gt;
&lt;li&gt;Memory capacity and memory bandwidth both matter for AI and HPC workloads.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Understanding these basics gives you a better foundation for working with GPUs, troubleshooting performance issues and designing infrastructure for modern AI and HPC environments.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>beginners</category>
      <category>devops</category>
    </item>
    <item>
      <title>What Is an AI Factory? Understanding the Infrastructure Behind AI</title>
      <dc:creator>Muhammad Zubair Bin Akbar</dc:creator>
      <pubDate>Wed, 28 Oct 2026 16:28:50 +0000</pubDate>
      <link>https://dev.to/zubairakbar/what-is-an-ai-factory-understanding-the-infrastructure-behind-ai-5d69</link>
      <guid>https://dev.to/zubairakbar/what-is-an-ai-factory-understanding-the-infrastructure-behind-ai-5d69</guid>
      <description>&lt;p&gt;When we talk about artificial intelligence, we usually think about chatbots, large language models, image generators, and other AI applications.&lt;/p&gt;

&lt;p&gt;But have you ever wondered what happens behind the scenes when an AI model is trained or responds to a question?&lt;/p&gt;

&lt;p&gt;Behind every AI application is an infrastructure layer responsible for processing data, performing calculations, moving information between systems, and delivering results. This infrastructure can include thousands of GPUs, high speed networking, large storage systems, and software that manages workloads across multiple servers.&lt;/p&gt;

&lt;p&gt;This is where the concept of an &lt;strong&gt;AI factory&lt;/strong&gt; comes in.&lt;/p&gt;

&lt;p&gt;An AI factory is not simply a room full of powerful GPUs. It is an integrated infrastructure designed to turn data into useful AI outputs as efficiently as possible.&lt;/p&gt;

&lt;p&gt;Let's break down how it works and why it matters, especially if you are learning about High Performance Computing (HPC).&lt;/p&gt;

&lt;h2&gt;
  
  
  1. What Exactly Is an AI Factory?
&lt;/h2&gt;

&lt;p&gt;Think of a traditional factory. Raw materials enter the factory, machines process them, and finished products come out at the other end.&lt;/p&gt;

&lt;p&gt;An AI factory follows a similar concept, but instead of manufacturing physical products, it processes data to produce AI models, predictions, generated content, or other results.&lt;/p&gt;

&lt;p&gt;Data enters the system, compute resources process it, and the output is delivered to an application or user.&lt;/p&gt;

&lt;p&gt;For example, training a large language model requires enormous amounts of data and computational work. The infrastructure must load that data, distribute calculations across GPUs, coordinate communication between servers, and save the model as training progresses.&lt;/p&gt;

&lt;p&gt;Once the model is trained, the same infrastructure, or a related deployment environment, can be used to serve requests from users.&lt;/p&gt;

&lt;p&gt;The term &lt;em&gt;AI factory&lt;/em&gt; describes this entire system working together.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The Main Components of an AI Factory
&lt;/h2&gt;

&lt;p&gt;An AI factory depends on several infrastructure components. Each has a specific role, and a problem in one area can affect the performance of the entire system.&lt;/p&gt;

&lt;h3&gt;
  
  
  Compute: CPUs and GPUs
&lt;/h3&gt;

&lt;p&gt;Compute is where the actual processing takes place.&lt;/p&gt;

&lt;p&gt;CPUs handle general purpose tasks such as operating system operations, application logic, data preparation, and coordinating workloads.&lt;/p&gt;

&lt;p&gt;GPUs are particularly important for AI because they can perform large numbers of mathematical operations in parallel. These operations are fundamental to training and running many modern AI models.&lt;/p&gt;

&lt;p&gt;A single server might contain multiple GPUs, while a larger AI cluster can connect hundreds or thousands of GPUs across many servers.&lt;/p&gt;

&lt;p&gt;However, adding more GPUs does not automatically guarantee better performance. The workload must be able to use them effectively, and the infrastructure must supply data and coordinate calculations fast enough.&lt;/p&gt;

&lt;h3&gt;
  
  
  Networking: Connecting the Compute Resources
&lt;/h3&gt;

&lt;p&gt;When a workload runs across multiple GPUs or servers, those resources often need to exchange information.&lt;/p&gt;

&lt;p&gt;For example, during distributed model training, GPUs may need to share intermediate results and synchronise updates. Slow communication can leave GPUs waiting instead of performing useful calculations.&lt;/p&gt;

&lt;p&gt;This is why high performance networking is so important.&lt;/p&gt;

&lt;p&gt;Technologies such as InfiniBand and high speed Ethernet are commonly used in AI and HPC environments. Depending on the design, these networks can support Remote Direct Memory Access (RDMA), which allows systems to exchange data with reduced CPU involvement.&lt;/p&gt;

&lt;p&gt;The goal is to keep communication fast enough that the compute resources can continue working efficiently.&lt;/p&gt;

&lt;h3&gt;
  
  
  Storage: Feeding Data to the GPUs
&lt;/h3&gt;

&lt;p&gt;AI workloads need access to datasets, trained models, checkpoints, and other files.&lt;/p&gt;

&lt;p&gt;These files may be stored on local NVMe drives, shared network storage, or parallel file systems designed to serve many compute nodes at once.&lt;/p&gt;

&lt;p&gt;Imagine a server with several powerful GPUs, but the dataset is stored on a system that cannot deliver data quickly enough. The GPUs may spend time waiting for the next batch of data rather than processing it.&lt;/p&gt;

&lt;p&gt;Storage performance is therefore an important part of AI infrastructure.&lt;/p&gt;

&lt;p&gt;Capacity also matters. Large datasets and model checkpoints can consume substantial storage, particularly when multiple training runs must be retained.&lt;/p&gt;

&lt;h3&gt;
  
  
  Software: Making Everything Work Together
&lt;/h3&gt;

&lt;p&gt;Hardware alone cannot run an AI workload.&lt;/p&gt;

&lt;p&gt;The software stack typically includes an operating system, GPU drivers, communication libraries, AI frameworks, and workload management tools.&lt;/p&gt;

&lt;p&gt;For example, Linux provides the operating environment, NVIDIA drivers allow applications to use NVIDIA GPUs, and frameworks such as PyTorch provide tools for building and training AI models.&lt;/p&gt;

&lt;p&gt;In an HPC environment, Slurm can schedule workloads and allocate resources across the cluster.&lt;/p&gt;

&lt;p&gt;Each layer has a different responsibility, but all must work together for the application to run correctly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Power and Cooling
&lt;/h3&gt;

&lt;p&gt;There is another important part of AI infrastructure that is easy to overlook: power and cooling.&lt;/p&gt;

&lt;p&gt;High density GPU servers can consume substantial electrical power and generate significant heat. As clusters grow, the data centre must provide sufficient electrical capacity and cooling to keep the equipment operating within safe limits.&lt;/p&gt;

&lt;p&gt;This affects infrastructure design from the beginning. Server density, rack layouts, cooling methods, power distribution, and operational costs all influence how an AI system can be deployed and scaled.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. How Do These Components Work Together?
&lt;/h2&gt;

&lt;p&gt;Let's consider a simplified example of training an AI model across several GPU servers.&lt;/p&gt;

&lt;p&gt;First, the training dataset is read from storage. The application loads the data and prepares it for processing.&lt;/p&gt;

&lt;p&gt;The CPUs manage the application and help prepare the data, while the GPUs perform the computationally intensive operations involved in training.&lt;/p&gt;

&lt;p&gt;If training is distributed across multiple GPUs or servers, the GPUs communicate through the cluster network to exchange information and coordinate their work.&lt;/p&gt;

&lt;p&gt;This process repeats many times as the model learns from the data. Periodically, the training software saves checkpoints so that the work can be resumed if the job is interrupted.&lt;/p&gt;

&lt;p&gt;Eventually, training finishes and the resulting model can be saved for evaluation or deployment.&lt;/p&gt;

&lt;p&gt;Notice that the process depends on several components working together:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Storage must deliver the required data.&lt;/li&gt;
&lt;li&gt;CPUs must keep the application and data pipeline moving.&lt;/li&gt;
&lt;li&gt;GPUs must have enough compute and memory resources.&lt;/li&gt;
&lt;li&gt;The network must support communication between distributed resources.&lt;/li&gt;
&lt;li&gt;Software must coordinate the workload correctly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If one component becomes a bottleneck, the performance of the entire workload may suffer.&lt;/p&gt;

&lt;p&gt;For example, a slow data pipeline can leave GPUs underutilised. A network bottleneck can slow down distributed training. Insufficient GPU memory can prevent a model from fitting on a device.&lt;/p&gt;

&lt;p&gt;This is why designing an AI factory requires more than selecting the fastest available GPU.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. What Makes an AI Factory Different from a Traditional HPC Cluster?
&lt;/h2&gt;

&lt;p&gt;At first glance, an AI factory and an HPC cluster can look very similar. Both can have compute nodes, high speed networks, shared storage, Linux, and workload management software.&lt;/p&gt;

&lt;p&gt;The main difference is the workloads they are designed to support and the way their infrastructure is optimised.&lt;/p&gt;

&lt;p&gt;Traditional HPC environments commonly run scientific simulations, engineering calculations, weather forecasting, and computational research. These workloads may depend heavily on CPU performance, memory bandwidth, low latency communication, or GPU acceleration.&lt;/p&gt;

&lt;p&gt;AI infrastructure is often designed around model training, distributed GPU workloads, and inference, where trained models generate responses or predictions.&lt;/p&gt;

&lt;p&gt;Large scale AI training can place particularly demanding requirements on GPU memory, network communication, data delivery, and power density.&lt;/p&gt;

&lt;p&gt;Inference introduces a different set of considerations. A system serving AI requests must balance response time, throughput, memory capacity, and the number of users it can support.&lt;/p&gt;

&lt;p&gt;There is considerable overlap between these environments. HPC clusters can run AI workloads, and AI infrastructure often uses technologies that have long been important in HPC.&lt;/p&gt;

&lt;p&gt;In fact, many of the skills used to operate HPC systems, including Linux administration, cluster networking, storage management, automation, and workload scheduling, are directly relevant to AI infrastructure.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Where Does Slurm Fit Into an AI Factory?
&lt;/h2&gt;

&lt;p&gt;If you have worked with HPC, you may already know Slurm.&lt;/p&gt;

&lt;p&gt;Slurm is a workload manager that schedules jobs and allocates resources across a cluster. It helps multiple users share compute resources without each user having to manage individual servers manually.&lt;/p&gt;

&lt;p&gt;In an AI environment, a user might submit a training job requesting two GPUs, several CPU cores, and a specific amount of memory.&lt;/p&gt;

&lt;p&gt;Slurm determines when the requested resources are available, allocates them according to the cluster configuration and scheduling policies, and launches the job.&lt;/p&gt;

&lt;p&gt;A simplified job request might look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="c"&gt;#SBATCH --job-name=ai-training&lt;/span&gt;
&lt;span class="c"&gt;#SBATCH --nodes=1&lt;/span&gt;
&lt;span class="c"&gt;#SBATCH --ntasks=1&lt;/span&gt;
&lt;span class="c"&gt;#SBATCH --cpus-per-task=8&lt;/span&gt;
&lt;span class="c"&gt;#SBATCH --gres=gpu:2&lt;/span&gt;
&lt;span class="c"&gt;#SBATCH --time=01:00:00&lt;/span&gt;

nvidia-smi
python train.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example requests one node, eight CPUs for the task, and two GPUs. The &lt;code&gt;nvidia-smi&lt;/code&gt; command displays information about the available NVIDIA GPUs, and the Python script represents the training application.&lt;/p&gt;

&lt;p&gt;The example assumes the cluster is configured to recognise GPUs through the &lt;code&gt;gres&lt;/code&gt; mechanism and that the required software and training script are available.&lt;/p&gt;

&lt;p&gt;Slurm does not train the model itself. It manages the resources and launches the workload, while the AI framework performs the actual training.&lt;/p&gt;

&lt;p&gt;At larger scales, workload management becomes increasingly important because multiple teams and applications may compete for expensive compute resources.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Why GPU Utilisation Is Not the Whole Story
&lt;/h2&gt;

&lt;p&gt;Suppose you have a powerful GPU server, but your monitoring shows that the GPUs are not being fully utilised.&lt;/p&gt;

&lt;p&gt;It may be tempting to assume that the GPUs are underperforming. However, the actual problem could be elsewhere.&lt;/p&gt;

&lt;p&gt;Perhaps the storage system cannot deliver data quickly enough. Maybe CPU resources are insufficient for preparing batches of data. The application might be waiting for communication from another server, or the model may not be configured to use the available GPUs effectively.&lt;/p&gt;

&lt;p&gt;GPU utilisation is a useful metric, but it does not explain every performance problem.&lt;/p&gt;

&lt;p&gt;A good troubleshooting process considers the entire workload: CPU usage, GPU activity and memory, storage performance, network communication, and application behaviour.&lt;/p&gt;

&lt;p&gt;The same principle applies to traditional HPC. A compute node may have plenty of processing power, but overall performance depends on how effectively all the system components work together.&lt;/p&gt;

&lt;p&gt;Understanding these relationships is a key skill for anyone working with AI infrastructure.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Why Is the AI Factory Concept Important?
&lt;/h2&gt;

&lt;p&gt;AI workloads are growing in size and complexity. Organisations need infrastructure that can support demanding workloads while using expensive hardware efficiently.&lt;/p&gt;

&lt;p&gt;This creates opportunities and challenges for infrastructure engineers.&lt;/p&gt;

&lt;p&gt;Building an effective AI environment requires decisions about compute hardware, GPU memory, network topology, storage architecture, software deployment, scheduling, power, and cooling.&lt;/p&gt;

&lt;p&gt;It also requires understanding how these components interact under real workloads.&lt;/p&gt;

&lt;p&gt;For someone coming from a Linux or HPC background, this is an opportunity to build on existing knowledge rather than start from scratch.&lt;/p&gt;

&lt;p&gt;Linux administration, Slurm, high speed networking, parallel storage, automation, and performance troubleshooting are all valuable foundations for working with AI infrastructure.&lt;/p&gt;

&lt;p&gt;Learning how these technologies fit into the bigger picture is often more useful than focusing on one hardware component in isolation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;An AI factory is much more than a collection of powerful GPUs. It is an integrated infrastructure in which compute, networking, storage, software, power, and cooling work together to turn data into AI results.&lt;/p&gt;

&lt;p&gt;The GPUs may perform the most visible calculations, but their performance depends on the systems surrounding them.&lt;/p&gt;

&lt;p&gt;For anyone learning HPC, understanding the AI factory concept is a useful step towards understanding how modern AI systems are built, operated, and scaled.&lt;/p&gt;

&lt;p&gt;The next time you see a large GPU cluster, think beyond the GPUs. Ask yourself how data reaches them, how they communicate, how workloads are scheduled, and how the entire system is kept running efficiently.&lt;/p&gt;

&lt;p&gt;That is where the real infrastructure engineering begins.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>beginners</category>
      <category>architecture</category>
    </item>
    <item>
      <title>CPU, Cores and Threads in HPC: Understanding What Your Job Actually Uses</title>
      <dc:creator>Muhammad Zubair Bin Akbar</dc:creator>
      <pubDate>Sun, 25 Oct 2026 16:19:42 +0000</pubDate>
      <link>https://dev.to/zubairakbar/cpu-cores-and-threads-in-hpc-understanding-what-your-job-actually-uses-12dn</link>
      <guid>https://dev.to/zubairakbar/cpu-cores-and-threads-in-hpc-understanding-what-your-job-actually-uses-12dn</guid>
      <description>&lt;p&gt;When you submit a job to an HPC cluster, you might request 4 CPUs, 8 CPUs, or perhaps an entire compute node.&lt;/p&gt;

&lt;p&gt;But what does that actually mean?&lt;/p&gt;

&lt;p&gt;Does one CPU mean one physical processor? Does one core mean one CPU? And where do threads fit into the picture?&lt;/p&gt;

&lt;p&gt;Understanding these terms makes it much easier to understand how Slurm allocates resources and how your application uses them.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. What is a CPU?
&lt;/h2&gt;

&lt;p&gt;A CPU is the processor that executes instructions. In an HPC compute node, you might find one or two physical processor packages installed in the server.&lt;/p&gt;

&lt;p&gt;For example, a server could have two Intel Xeon processors or two AMD EPYC processors.&lt;/p&gt;

&lt;p&gt;Each physical processor contains multiple cores. These cores allow the processor to execute several tasks in parallel.&lt;/p&gt;

&lt;p&gt;Think of the physical processor as a building and the cores as individual workers inside it.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. What is a core?
&lt;/h2&gt;

&lt;p&gt;A core is an independent processing unit within a physical processor.&lt;/p&gt;

&lt;p&gt;Imagine a compute node with two processors, each containing 32 physical cores.&lt;/p&gt;

&lt;p&gt;The total number of physical cores is:&lt;/p&gt;

&lt;p&gt;2 processors × 32 cores = 64 physical cores.&lt;/p&gt;

&lt;p&gt;This gives the node 64 physical cores available to execute workloads.&lt;/p&gt;

&lt;p&gt;More cores can help applications run faster when they can divide their work into parallel tasks. However, adding cores does not automatically make every application faster.&lt;/p&gt;

&lt;p&gt;Some applications are limited by memory bandwidth, storage performance, communication overhead, or work that cannot be parallelised.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. What is a thread?
&lt;/h2&gt;

&lt;p&gt;The word thread can mean two different things in HPC.&lt;/p&gt;

&lt;p&gt;The first is a hardware thread. Modern Intel and AMD processors can support simultaneous multithreading, allowing one physical core to expose multiple logical CPUs to the operating system.&lt;/p&gt;

&lt;p&gt;Intel calls its implementation Hyper Threading. AMD commonly refers to its implementation as SMT.&lt;/p&gt;

&lt;p&gt;For example, if a server has 64 physical cores and each core supports two hardware threads, Linux may report 128 logical CPUs.&lt;/p&gt;

&lt;p&gt;These are not 128 physical cores. They are 128 hardware execution contexts sharing 64 physical cores.&lt;/p&gt;

&lt;p&gt;The second meaning is a software thread. An application can create multiple software threads to divide its work. These threads are scheduled onto the available hardware threads by the operating system.&lt;/p&gt;

&lt;p&gt;The distinction matters because requesting more CPUs does not necessarily mean your application will create more software threads. Your application must be designed or configured to use them.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. How does this work on Intel and AMD systems?
&lt;/h2&gt;

&lt;p&gt;Both Intel Xeon and AMD EPYC processors follow the same basic concepts, although their architectures and features vary by processor generation and model.&lt;/p&gt;

&lt;p&gt;Imagine an Intel based server with two Xeon processors. Each processor has 32 physical cores, giving the server 64 physical cores in total.&lt;/p&gt;

&lt;p&gt;Now imagine an AMD based server with two EPYC processors. Each processor has 48 physical cores, giving the server 96 physical cores in total.&lt;/p&gt;

&lt;p&gt;If both systems support two hardware threads per core, Linux could report 128 logical CPUs on the Intel server and 192 on the AMD server.&lt;/p&gt;

&lt;p&gt;These are illustrative examples, not specifications for particular processor models.&lt;/p&gt;

&lt;p&gt;Notice that the number of logical CPUs is higher than the number of physical cores. This is because Intel Hyper Threading and AMD SMT allow each physical core to expose two hardware threads to the operating system.&lt;/p&gt;

&lt;p&gt;However, more logical CPUs do not automatically mean better HPC performance. The actual results depend on the application, memory bandwidth, processor architecture, and how efficiently the workload uses available resources.&lt;/p&gt;

&lt;p&gt;That is why HPC administrators need to understand both the hardware and the workload before deciding how resources should be allocated.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. What does this mean for an HPC job?
&lt;/h2&gt;

&lt;p&gt;Suppose you submit a simple Slurm job requesting four CPUs.&lt;/p&gt;

&lt;p&gt;Your job script might look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="c"&gt;#SBATCH --job-name=cpu-test&lt;/span&gt;
&lt;span class="c"&gt;#SBATCH --ntasks=1&lt;/span&gt;
&lt;span class="c"&gt;#SBATCH --cpus-per-task=4&lt;/span&gt;
&lt;span class="c"&gt;#SBATCH --time=00:05:00&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Running on &lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;hostname&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Allocated CPUs: &lt;/span&gt;&lt;span class="nv"&gt;$SLURM_CPUS_PER_TASK&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

&lt;span class="nb"&gt;sleep &lt;/span&gt;60
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Submit it using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sbatch cpu-test.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is what the important settings mean.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;--ntasks=1&lt;/code&gt; requests one task, which is commonly one process.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;--cpus-per-task=4&lt;/code&gt; requests four CPUs for that task.&lt;/p&gt;

&lt;p&gt;This is useful for an application that uses one process with multiple software threads, such as an appropriately configured OpenMP application.&lt;/p&gt;

&lt;p&gt;However, the script above only runs &lt;code&gt;sleep&lt;/code&gt;. It does not create four computational threads or perform parallel calculations. It simply demonstrates the resource request.&lt;/p&gt;

&lt;p&gt;Slurm allocates resources according to the cluster configuration and scheduling policy. Whether those CPUs correspond to distinct physical cores or hardware threads depends on the node configuration, Slurm settings, and allocation policy.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. How can you check the actual hardware?
&lt;/h2&gt;

&lt;p&gt;On a Linux compute node, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lscpu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look for these fields:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CPU(s):
Thread(s) per core:
Core(s) per socket:
Socket(s):
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CPU(s):                 128
Thread(s) per core:       2
Core(s) per socket:      32
Socket(s):                2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This indicates 128 logical CPUs, two hardware threads per core, 32 cores per processor package, and two processor packages.&lt;/p&gt;

&lt;p&gt;To see how Linux maps logical CPUs to physical cores, use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lscpu &lt;span class="nt"&gt;-e&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also inspect the resources Slurm recognises with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;scontrol show node compute01
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Compare the operating system view with Slurm's view. They should make sense together, although Slurm may intentionally allocate only part of the available hardware.&lt;/p&gt;

&lt;h2&gt;
  
  
  The key takeaway
&lt;/h2&gt;

&lt;p&gt;A physical processor contains cores. A core can expose one or more hardware threads. Applications can create software threads that execute on those hardware resources.&lt;/p&gt;

&lt;p&gt;When working with HPC, remember that the number of logical CPUs is not necessarily the number of physical cores, and the number of CPUs requested from Slurm is not necessarily the number of software threads your application will use.&lt;/p&gt;

&lt;p&gt;Understanding that difference is one of the first steps towards understanding how HPC jobs actually run.&lt;/p&gt;

</description>
      <category>hpc</category>
      <category>cpu</category>
      <category>linux</category>
      <category>architecture</category>
    </item>
    <item>
      <title>5 Slurm Configuration Parameters That Shape Your HPC Cluster</title>
      <dc:creator>Muhammad Zubair Bin Akbar</dc:creator>
      <pubDate>Fri, 16 Oct 2026 16:15:54 +0000</pubDate>
      <link>https://dev.to/zubairakbar/5-slurm-configuration-parameters-that-shape-your-hpc-cluster-2jgl</link>
      <guid>https://dev.to/zubairakbar/5-slurm-configuration-parameters-that-shape-your-hpc-cluster-2jgl</guid>
      <description>&lt;p&gt;When building an HPC cluster, we often focus on compute nodes, CPUs, RAM, GPUs, networking and storage.&lt;/p&gt;

&lt;p&gt;But there is another important part of the design: &lt;strong&gt;how Slurm manages those resources.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A cluster might have hundreds of CPU cores and several GPUs, but how effectively users access those resources depends partly on how Slurm is configured.&lt;/p&gt;

&lt;p&gt;Let's explore five important configuration areas in &lt;code&gt;slurm.conf&lt;/code&gt; and understand their impact on an HPC environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. &lt;code&gt;SelectType&lt;/code&gt; and &lt;code&gt;SelectTypeParameters&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;These parameters control how Slurm selects resources and allocates them to jobs.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="py"&gt;SelectType&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;select/cons_tres&lt;/span&gt;
&lt;span class="py"&gt;SelectTypeParameters&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;CR_Core&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;select/cons_tres&lt;/code&gt; allows Slurm to track and allocate consumable resources, such as CPUs, memory and GPUs when configured appropriately.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SelectTypeParameters&lt;/code&gt; determines the granularity at which resources are allocated. For example, &lt;code&gt;CR_Core&lt;/code&gt; allocates resources at the CPU core level, while &lt;code&gt;CR_CPU&lt;/code&gt; allocates at the CPU level as Slurm defines it. &lt;code&gt;CR_Socket&lt;/code&gt; allocates at socket granularity, and &lt;code&gt;CR_Memory&lt;/code&gt; focuses on memory as a consumable resource. The choice affects how precisely resources can be allocated and shared, potentially influencing resource utilisation and job placement.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Infrastructure impact:&lt;/strong&gt; This setting affects how compute node resources are shared between jobs. The best option depends on the CPU topology, workload requirements and intended allocation policy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Technical note:&lt;/strong&gt; &lt;code&gt;CR_CPU&lt;/code&gt;, &lt;code&gt;CR_Core&lt;/code&gt; and &lt;code&gt;CR_Socket&lt;/code&gt; are not interchangeable on every system. Their effects depend on the CPU topology and Slurm configuration. &lt;code&gt;CR_Memory&lt;/code&gt; is a memory focused allocation option, not simply another CPU allocation granularity. Supported combinations also depend on the selected resource plugin and Slurm version, so check the documentation for your installed version before changing production settings.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. &lt;code&gt;PriorityWeight&lt;/code&gt; and Job Scheduling Priority
&lt;/h2&gt;

&lt;p&gt;When multiple jobs are waiting in the queue, Slurm needs to determine their scheduling priorities.&lt;/p&gt;

&lt;p&gt;With multifactor priority scheduling, administrators can assign weights to different factors that influence job priority.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="py"&gt;PriorityType&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;priority/multifactor&lt;/span&gt;
&lt;span class="py"&gt;PriorityWeightAge&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;1000&lt;/span&gt;
&lt;span class="py"&gt;PriorityWeightFairshare&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;10000&lt;/span&gt;
&lt;span class="py"&gt;PriorityWeightJobSize&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;100&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, the weights determine how much the corresponding factors contribute to a job's priority.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;PriorityWeightAge&lt;/code&gt; gives weight to how long a job has been waiting.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PriorityWeightFairshare&lt;/code&gt; gives weight to fairshare usage, helping account for how much cluster resources users or projects have consumed.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PriorityWeightJobSize&lt;/code&gt; gives weight to job size.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why does this matter?&lt;/p&gt;

&lt;p&gt;Imagine a research cluster shared by several teams. One team regularly submits large simulations, while another runs many smaller jobs.&lt;/p&gt;

&lt;p&gt;Priority weights help administrators influence how waiting time, resource usage and job size affect scheduling decisions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Infrastructure impact:&lt;/strong&gt; Priority policies influence how users access shared compute capacity and can help balance competing workloads. They do not create additional resources or guarantee that a particular job runs first. Actual scheduling also depends on available resources, job constraints, reservations, QoS and other policies.&lt;/p&gt;

&lt;p&gt;The weights should reflect the cluster's operational goals rather than being chosen arbitrarily.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. &lt;code&gt;PartitionName&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;A partition is a group of compute nodes that Slurm makes available under a particular set of scheduling policies.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="py"&gt;PartitionName&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;cpu Nodes=cpu[01-08] &lt;/span&gt;&lt;span class="se"&gt;\
&lt;/span&gt;    &lt;span class="s"&gt;Default=YES MaxTime=24:00:00 State=UP&lt;/span&gt;

&lt;span class="py"&gt;PartitionName&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;gpu Nodes=gpu[01-04] &lt;/span&gt;&lt;span class="se"&gt;\
&lt;/span&gt;    &lt;span class="s"&gt;Default=NO MaxTime=48:00:00 State=UP&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the cluster has two partitions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;cpu&lt;/code&gt;: eight CPU compute nodes.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;gpu&lt;/code&gt;: four GPU compute nodes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A user can submit a job to the GPU partition with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sbatch &lt;span class="nt"&gt;--partition&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;gpu job.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why not put every node into one partition?&lt;/p&gt;

&lt;p&gt;Different workloads have different requirements. A simulation might need many CPU cores, while an AI workload might require GPUs. Some applications need large amounts of RAM, and others have shorter execution times.&lt;/p&gt;

&lt;p&gt;Partitions allow administrators to organise resources and apply different scheduling limits to different groups of nodes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Infrastructure impact:&lt;/strong&gt; Partition design influences which types of compute nodes are needed, how workloads are separated and how resources are made available to users.&lt;/p&gt;

&lt;p&gt;A partition does not automatically guarantee a particular performance level or priority. Those behaviours depend on the wider scheduling configuration and policies.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. &lt;code&gt;MaxTime&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Jobs can run for seconds, hours or several days. Slurm needs a way to limit how long a job is allowed to run.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="py"&gt;PartitionName&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;cpu Nodes=cpu[01-08] &lt;/span&gt;&lt;span class="se"&gt;\
&lt;/span&gt;    &lt;span class="s"&gt;Default=YES MaxTime=24:00:00 State=UP&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;MaxTime=24:00:00&lt;/code&gt; sets the maximum permitted job duration for this partition to 24 hours.&lt;/p&gt;

&lt;p&gt;A job requesting a longer duration than the partition allows will not be accepted with that request.&lt;/p&gt;

&lt;p&gt;Why does this matter?&lt;/p&gt;

&lt;p&gt;Imagine a cluster used by two groups:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Interactive users running short tests.&lt;/li&gt;
&lt;li&gt;Researchers running simulations that take several days.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Administrators could create separate partitions with different maximum durations, allowing short jobs to use one pool and longer jobs to use another.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Infrastructure impact:&lt;/strong&gt; Runtime limits influence how administrators organise compute resources and balance job throughput against long running workloads.&lt;/p&gt;

&lt;p&gt;However, a shorter &lt;code&gt;MaxTime&lt;/code&gt; does not automatically make jobs finish faster or guarantee shorter queue times. Actual scheduling behaviour depends on resource availability, priority, backfill and other policies.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Accounting and Quality of Service (QoS)
&lt;/h2&gt;

&lt;p&gt;An HPC cluster often serves multiple research teams, departments or projects. Administrators need to understand resource usage and control how resources are shared.&lt;/p&gt;

&lt;p&gt;Two important concepts are accounting and Quality of Service.&lt;/p&gt;

&lt;p&gt;An accounting configuration might include:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="py"&gt;AccountingStorageType&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;accounting_storage/slurmdbd&lt;/span&gt;
&lt;span class="py"&gt;AccountingStorageHost&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;headnode&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These settings tell Slurm to use SlurmDBD for accounting data, with the accounting service hosted at &lt;code&gt;headnode&lt;/code&gt; in this example. SlurmDBD must be installed and configured separately.&lt;/p&gt;

&lt;p&gt;Accounting records help administrators answer questions such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which users and projects consume the most compute time?&lt;/li&gt;
&lt;li&gt;How much CPU or GPU time has a research team used?&lt;/li&gt;
&lt;li&gt;Which jobs failed, and how long did they run?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;QoS policies can apply limits to jobs and allocations or influence their scheduling priority. For example, a research cluster might define a QoS that limits the number of running jobs or the resources a user can consume.&lt;/p&gt;

&lt;p&gt;These policies are configured separately using Slurm's accounting tools, such as &lt;code&gt;sacctmgr&lt;/code&gt;, along with the relevant associations and QoS settings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Infrastructure impact:&lt;/strong&gt; Accounting and QoS help administrators govern shared capacity, monitor demand and identify whether additional CPU nodes, GPU nodes or high memory nodes may be needed.&lt;/p&gt;

&lt;p&gt;Accounting alone does not automatically enforce every usage limit. The relevant limits and policies must be configured explicitly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bringing it all together
&lt;/h2&gt;

&lt;p&gt;These configuration areas address different parts of cluster management:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;SelectType&lt;/code&gt; and &lt;code&gt;SelectTypeParameters&lt;/code&gt; determine how resources are selected and allocated.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PriorityWeight&lt;/code&gt; settings influence how pending jobs are ranked.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PartitionName&lt;/code&gt; organises compute resources into scheduling pools.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;MaxTime&lt;/code&gt; controls permitted job duration.&lt;/li&gt;
&lt;li&gt;Accounting and QoS support usage visibility and resource governance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Consider an HPC cluster serving both AI researchers and traditional simulation users. The administrator may need GPU nodes, high memory nodes, separate partitions, suitable allocation policies and accounting controls.&lt;/p&gt;

&lt;p&gt;Slurm cannot replace good infrastructure design. However, its configuration helps ensure that available resources are allocated according to the cluster's requirements and policies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The key takeaway:&lt;/strong&gt; Understanding Slurm configuration is not just about making jobs run. It is about designing an HPC environment that allocates resources effectively, supports different workloads and can grow as demand changes.&lt;/p&gt;

</description>
      <category>hpc</category>
      <category>slurm</category>
      <category>parallelcomputing</category>
      <category>linux</category>
    </item>
    <item>
      <title>Why Memory Bandwidth Matters in HPC</title>
      <dc:creator>Muhammad Zubair Bin Akbar</dc:creator>
      <pubDate>Mon, 12 Oct 2026 17:49:12 +0000</pubDate>
      <link>https://dev.to/zubairakbar/why-memory-bandwidth-matters-in-hpc-1f8k</link>
      <guid>https://dev.to/zubairakbar/why-memory-bandwidth-matters-in-hpc-1f8k</guid>
      <description>&lt;p&gt;Imagine having a powerful CPU with dozens of cores, but those cores spend time waiting for data from memory.&lt;/p&gt;

&lt;p&gt;The processor is ready to work, but the data isn't arriving quickly enough.&lt;/p&gt;

&lt;p&gt;This is one reason why adding more CPU cores doesn't always make an HPC application faster.&lt;/p&gt;

&lt;h2&gt;
  
  
  Memory capacity vs. memory bandwidth
&lt;/h2&gt;

&lt;p&gt;These two terms sound similar, but they describe different things.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Memory capacity&lt;/strong&gt; is how much data can fit in memory. For example, a node might have 256 GB of RAM.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Memory bandwidth&lt;/strong&gt; is how quickly data can move between memory and the processor. It is commonly measured in GB/s.&lt;/p&gt;

&lt;p&gt;Think of memory as a warehouse.&lt;/p&gt;

&lt;p&gt;Capacity tells you how much stock the warehouse can hold. Bandwidth tells you how quickly goods can be delivered to the workers.&lt;/p&gt;

&lt;p&gt;A large warehouse doesn't automatically mean goods can be delivered quickly.&lt;/p&gt;

&lt;p&gt;The same applies to HPC systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why does this matter in HPC?
&lt;/h2&gt;

&lt;p&gt;HPC applications process large amounts of data, often across many CPU cores.&lt;/p&gt;

&lt;p&gt;Consider an application that repeatedly reads arrays from memory, performs calculations, and writes the results back.&lt;/p&gt;

&lt;p&gt;If the CPU can process data faster than memory can supply it, the processor may spend time waiting rather than performing useful calculations.&lt;/p&gt;

&lt;p&gt;This is called a &lt;strong&gt;memory bandwidth bottleneck&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Adding more CPU cores might not help much because those cores must share the available memory bandwidth.&lt;/p&gt;

&lt;h2&gt;
  
  
  A simple example
&lt;/h2&gt;

&lt;p&gt;Imagine a compute node with 32 CPU cores.&lt;/p&gt;

&lt;p&gt;Initially, only 8 cores are running an application, and performance is good.&lt;/p&gt;

&lt;p&gt;You increase the workload to 16 cores, then 32 cores.&lt;/p&gt;

&lt;p&gt;However, the application becomes only slightly faster.&lt;/p&gt;

&lt;p&gt;Why?&lt;/p&gt;

&lt;p&gt;The additional cores increase demand for data, but the memory subsystem cannot deliver that data proportionally faster.&lt;/p&gt;

&lt;p&gt;The CPUs are not necessarily too slow. The application may be limited by how quickly data reaches them.&lt;/p&gt;

&lt;p&gt;This is one reason HPC performance doesn't always scale linearly with the number of CPU cores.&lt;/p&gt;

&lt;h2&gt;
  
  
  How can HPC engineers investigate it?
&lt;/h2&gt;

&lt;p&gt;When an application stops scaling as expected, CPU utilization alone doesn't tell the whole story.&lt;/p&gt;

&lt;p&gt;Engineers may investigate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Memory bandwidth:&lt;/strong&gt; Is the application reaching the memory subsystem's throughput limits?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NUMA placement:&lt;/strong&gt; Are processes accessing memory attached to another CPU socket?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory access patterns:&lt;/strong&gt; Is the application accessing data efficiently?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CPU affinity:&lt;/strong&gt; Are processes and threads placed appropriately on the available cores?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Tools such as &lt;code&gt;numastat&lt;/code&gt;, &lt;code&gt;perf&lt;/code&gt;, and hardware performance counters can help investigate these issues, depending on the system and available permissions.&lt;/p&gt;

&lt;h2&gt;
  
  
  The bigger picture
&lt;/h2&gt;

&lt;p&gt;HPC performance depends on more than processor speed.&lt;/p&gt;

&lt;p&gt;CPU cores need data from memory. Applications may also depend on storage, network communication, and synchronization between processes.&lt;/p&gt;

&lt;p&gt;When one part cannot keep up with the others, it can limit the performance of the entire application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The key takeaway:&lt;/strong&gt; More CPU cores are useful only when the application and the rest of the system can keep them productive.&lt;/p&gt;

&lt;p&gt;In HPC, understanding how quickly data moves can be just as important as understanding how quickly a processor calculates.&lt;/p&gt;

</description>
      <category>memorybandwidth</category>
      <category>cpu</category>
      <category>highperformancecomputing</category>
      <category>networking</category>
    </item>
    <item>
      <title>Why More CPU Cores Don't Always Make an HPC Application Faster</title>
      <dc:creator>Muhammad Zubair Bin Akbar</dc:creator>
      <pubDate>Sun, 04 Oct 2026 15:39:09 +0000</pubDate>
      <link>https://dev.to/zubairakbar/why-more-cpu-cores-dont-always-make-an-hpc-application-faster-2g02</link>
      <guid>https://dev.to/zubairakbar/why-more-cpu-cores-dont-always-make-an-hpc-application-faster-2g02</guid>
      <description>&lt;p&gt;If 1 CPU can run a program, then 8 CPUs should make it much faster.&lt;/p&gt;

&lt;p&gt;Right?&lt;/p&gt;

&lt;p&gt;Not necessarily.&lt;/p&gt;

&lt;p&gt;This is one of the first things that can be surprising when learning HPC.&lt;/p&gt;

&lt;p&gt;We can keep adding CPU cores to a system, but that does not mean an application will keep getting proportionally faster.&lt;/p&gt;

&lt;p&gt;The reason comes down to &lt;strong&gt;parallelism&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Not every part of a program can run in parallel
&lt;/h2&gt;

&lt;p&gt;Imagine an application that takes 100 seconds to run on one CPU.&lt;/p&gt;

&lt;p&gt;Suppose:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;80 seconds can be parallelised&lt;/li&gt;
&lt;li&gt;20 seconds must run sequentially&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The 80 second part can use multiple CPU cores.&lt;/p&gt;

&lt;p&gt;But the 20 second part still has to run one step after another.&lt;/p&gt;

&lt;p&gt;So even if we give the application 100 CPU cores, that sequential portion doesn't magically disappear.&lt;/p&gt;

&lt;p&gt;This is the basic idea behind &lt;strong&gt;Amdahl's Law&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What happens as we add more cores?
&lt;/h2&gt;

&lt;p&gt;Imagine the application running on:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1 core   → 100 seconds
2 cores  → 60 seconds
4 cores  → 40 seconds
8 cores  → 30 seconds
16 cores → 25 seconds
32 cores → 23 seconds
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We're adding more and more CPU cores.&lt;/p&gt;

&lt;p&gt;But the improvement gets smaller.&lt;/p&gt;

&lt;p&gt;Why?&lt;/p&gt;

&lt;p&gt;Because eventually the parts of the application that cannot be parallelised become the limiting factor.&lt;/p&gt;

&lt;p&gt;The application has reached a point where adding more CPUs provides very little benefit.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem isn't always the CPU
&lt;/h2&gt;

&lt;p&gt;This is an important idea in HPC.&lt;/p&gt;

&lt;p&gt;When an application doesn't scale well, the CPU may not be the problem.&lt;/p&gt;

&lt;p&gt;The application might be waiting for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Memory&lt;/li&gt;
&lt;li&gt;Network communication&lt;/li&gt;
&lt;li&gt;Storage I/O&lt;/li&gt;
&lt;li&gt;Synchronisation between processes&lt;/li&gt;
&lt;li&gt;Locks&lt;/li&gt;
&lt;li&gt;Other processes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, imagine an MPI application running across many compute nodes.&lt;/p&gt;

&lt;p&gt;Each process may need to exchange data with other processes.&lt;/p&gt;

&lt;p&gt;Adding more nodes gives you more CPUs, but it also means more communication between them.&lt;/p&gt;

&lt;p&gt;At some point, the communication overhead can start becoming significant.&lt;/p&gt;

&lt;p&gt;You have more computing resources, but you are spending more time coordinating them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Strong scaling vs weak scaling
&lt;/h2&gt;

&lt;p&gt;This leads to two important HPC concepts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Strong scaling&lt;/strong&gt; asks:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;How much faster can I solve the same problem by adding more resources?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Same problem
     ↓
8 cores → 16 cores → 32 cores → 64 cores
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ideally, the runtime keeps decreasing.&lt;/p&gt;

&lt;p&gt;But eventually the speedup usually becomes smaller.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Weak scaling&lt;/strong&gt; asks something different:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Can I solve a larger problem by adding more resources while keeping the workload per resource roughly the same?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;8 cores   → small problem
16 cores  → larger problem
32 cores  → even larger problem
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both are important ways of understanding HPC application performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  More cores can even make things worse
&lt;/h2&gt;

&lt;p&gt;This can sound strange, but adding resources can sometimes reduce efficiency.&lt;/p&gt;

&lt;p&gt;Imagine 16 processes constantly exchanging data.&lt;/p&gt;

&lt;p&gt;Now increase that to 128 processes.&lt;/p&gt;

&lt;p&gt;There are many more processes that may need to communicate and synchronise.&lt;/p&gt;

&lt;p&gt;If the application's communication pattern doesn't scale well, the additional resources can create more overhead than useful computation.&lt;/p&gt;

&lt;p&gt;The CPUs aren't necessarily doing more useful work.&lt;/p&gt;

&lt;p&gt;They may be spending more time waiting.&lt;/p&gt;

&lt;h2&gt;
  
  
  This is why benchmarking matters
&lt;/h2&gt;

&lt;p&gt;You cannot determine how well an HPC application will scale simply by looking at the number of CPU cores in a server.&lt;/p&gt;

&lt;p&gt;You need to test it.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1 node   → 100 seconds
2 nodes  → 55 seconds
4 nodes  → 32 seconds
8 nodes  → 25 seconds
16 nodes → 23 seconds
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The application is scaling.&lt;/p&gt;

&lt;p&gt;But not linearly.&lt;/p&gt;

&lt;p&gt;Doubling the resources does not always halve the runtime.&lt;/p&gt;

&lt;p&gt;That is normal for many real world HPC applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  The goal isn't always maximum CPU usage
&lt;/h2&gt;

&lt;p&gt;Another important lesson is that &lt;strong&gt;100% CPU utilisation doesn't automatically mean an application is scaling well&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;An application could be using every CPU core while spending significant time waiting for memory, communicating with other processes or performing synchronisation.&lt;/p&gt;

&lt;p&gt;This is why HPC performance analysis looks at much more than CPU utilisation.&lt;/p&gt;

&lt;p&gt;You may need to investigate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CPU utilisation&lt;/li&gt;
&lt;li&gt;Memory bandwidth&lt;/li&gt;
&lt;li&gt;NUMA behaviour&lt;/li&gt;
&lt;li&gt;Network traffic&lt;/li&gt;
&lt;li&gt;MPI communication&lt;/li&gt;
&lt;li&gt;Storage I/O&lt;/li&gt;
&lt;li&gt;Process placement&lt;/li&gt;
&lt;li&gt;CPU affinity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The bottleneck can move as you add resources.&lt;/p&gt;

&lt;h2&gt;
  
  
  So how many CPU cores should you use?
&lt;/h2&gt;

&lt;p&gt;There isn't one answer.&lt;/p&gt;

&lt;p&gt;The right number depends on the application.&lt;/p&gt;

&lt;p&gt;For some workloads:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;8 cores → good scaling
16 cores → better
32 cores → better
64 cores → little additional benefit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For another application, 64 or 128 cores might still provide excellent scaling.&lt;/p&gt;

&lt;p&gt;This is why HPC systems don't simply try to give every application as many CPUs as possible.&lt;/p&gt;

&lt;p&gt;The goal is to use the resources &lt;strong&gt;efficiently&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The bigger HPC lesson
&lt;/h2&gt;

&lt;p&gt;HPC isn't simply about having more CPUs.&lt;/p&gt;

&lt;p&gt;It's about using parallel resources effectively.&lt;/p&gt;

&lt;p&gt;A well designed application can divide a large problem across many CPU cores or nodes and achieve significant speedup.&lt;/p&gt;

&lt;p&gt;But parallelism has limits.&lt;/p&gt;

&lt;p&gt;Sequential work, communication, synchronisation, memory bandwidth and I/O can all become bottlenecks.&lt;/p&gt;

&lt;p&gt;So the next time someone says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"This server has twice as many CPU cores, so the application should be twice as fast."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The better question is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Does the application scale?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That's one of the fundamental questions in HPC performance.&lt;/p&gt;

&lt;p&gt;And sometimes, the answer is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;not as much as you might expect.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>cpu</category>
      <category>parallelcomputing</category>
      <category>hpc</category>
    </item>
    <item>
      <title>Why Does HPC Need InfiniBand?</title>
      <dc:creator>Muhammad Zubair Bin Akbar</dc:creator>
      <pubDate>Wed, 30 Sep 2026 18:50:16 +0000</pubDate>
      <link>https://dev.to/zubairakbar/why-does-hpc-need-infiniband-2c9e</link>
      <guid>https://dev.to/zubairakbar/why-does-hpc-need-infiniband-2c9e</guid>
      <description>&lt;p&gt;When people first learn about HPC clusters, they often notice something unusual.&lt;/p&gt;

&lt;p&gt;The compute nodes don't just have Ethernet.&lt;/p&gt;

&lt;p&gt;Many HPC clusters also have &lt;strong&gt;InfiniBand&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So a natural question is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If Ethernet already connects computers together, why do HPC clusters need another network?&lt;/p&gt;

&lt;p&gt;The answer becomes clearer when you look at what HPC applications actually do.&lt;/p&gt;

&lt;h2&gt;
  
  
  HPC applications communicate a lot
&lt;/h2&gt;

&lt;p&gt;Consider an MPI application running across 32 compute nodes.&lt;/p&gt;

&lt;p&gt;The application may constantly exchange data between those nodes.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Node 1  &amp;lt;----&amp;gt;  Node 2
  ↕              ↕
Node 3  &amp;lt;----&amp;gt;  Node 4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The application isn't just sending an occasional file or SSH connection.&lt;/p&gt;

&lt;p&gt;The compute nodes can be communicating continuously while the application is running.&lt;/p&gt;

&lt;p&gt;That makes network performance extremely important.&lt;/p&gt;

&lt;h2&gt;
  
  
  It's not just about bandwidth
&lt;/h2&gt;

&lt;p&gt;A common first thought is:&lt;/p&gt;

&lt;p&gt;"Just give the cluster a faster network."&lt;/p&gt;

&lt;p&gt;But HPC networking is about more than bandwidth.&lt;/p&gt;

&lt;p&gt;Two important factors are:&lt;/p&gt;

&lt;h3&gt;
  
  
  Bandwidth
&lt;/h3&gt;

&lt;p&gt;How much data can be transferred per second.&lt;/p&gt;

&lt;h3&gt;
  
  
  Latency
&lt;/h3&gt;

&lt;p&gt;How long it takes for a message to travel between nodes.&lt;/p&gt;

&lt;p&gt;For many HPC workloads, both matter.&lt;/p&gt;

&lt;p&gt;A network can have high bandwidth but still have latency that isn't ideal for tightly coupled workloads.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where InfiniBand comes in
&lt;/h2&gt;

&lt;p&gt;InfiniBand was designed for high performance communication.&lt;/p&gt;

&lt;p&gt;It provides:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;High bandwidth&lt;/li&gt;
&lt;li&gt;Low latency&lt;/li&gt;
&lt;li&gt;RDMA&lt;/li&gt;
&lt;li&gt;Efficient communication between nodes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One particularly important feature is &lt;strong&gt;RDMA&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;RDMA allows data to be transferred directly between the memory of different systems with minimal involvement from the CPU and operating system.&lt;/p&gt;

&lt;p&gt;That can reduce overhead during communication.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why does that matter?
&lt;/h2&gt;

&lt;p&gt;Imagine an MPI application running across hundreds of nodes.&lt;/p&gt;

&lt;p&gt;The application might repeatedly exchange relatively small messages between processes.&lt;/p&gt;

&lt;p&gt;If every communication requires significant CPU and operating system involvement, that overhead can become important.&lt;/p&gt;

&lt;p&gt;With technologies such as RDMA, the network can handle communication more efficiently.&lt;/p&gt;

&lt;p&gt;This is one reason high performance networks are so important in HPC.&lt;/p&gt;

&lt;h2&gt;
  
  
  InfiniBand isn't the only option
&lt;/h2&gt;

&lt;p&gt;InfiniBand isn't the only technology used for HPC networking.&lt;/p&gt;

&lt;p&gt;You can also find:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;High speed Ethernet&lt;/li&gt;
&lt;li&gt;RoCE&lt;/li&gt;
&lt;li&gt;Other specialised interconnects&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Modern Ethernet can provide very high performance, and technologies such as &lt;strong&gt;RoCE&lt;/strong&gt; can provide RDMA capabilities over Ethernet.&lt;/p&gt;

&lt;p&gt;So the question isn't simply:&lt;/p&gt;

&lt;p&gt;"InfiniBand or Ethernet?"&lt;/p&gt;

&lt;p&gt;It's really about what the workload and cluster architecture require.&lt;/p&gt;

&lt;h2&gt;
  
  
  The bigger picture
&lt;/h2&gt;

&lt;p&gt;An HPC cluster is a collection of computers working together.&lt;/p&gt;

&lt;p&gt;The CPUs do the computation.&lt;/p&gt;

&lt;p&gt;The memory holds the data being processed.&lt;/p&gt;

&lt;p&gt;The storage provides the data.&lt;/p&gt;

&lt;p&gt;And the network allows the nodes to communicate.&lt;/p&gt;

&lt;p&gt;If the application spends a lot of time waiting for data from another node, having powerful CPUs won't solve the problem.&lt;/p&gt;

&lt;p&gt;The network becomes part of the application's performance.&lt;/p&gt;

&lt;p&gt;That's why HPC networking is such an important part of cluster design.&lt;/p&gt;

&lt;p&gt;And that's also why you'll often hear technologies such as:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;InfiniBand → RDMA → MPI → UCX&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;when talking about HPC communication.&lt;/p&gt;

&lt;p&gt;Understanding how these pieces fit together is much more useful than simply knowing that "HPC uses InfiniBand."&lt;/p&gt;

</description>
      <category>ai</category>
      <category>networking</category>
      <category>infiniband</category>
      <category>highperformancecomputing</category>
    </item>
  </channel>
</rss>
