<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Can JMP Software's JSL operations use GPU acceleration? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Can-JMP-Software-s-JSL-operations-use-GPU-acceleration/m-p/841795#M101581</link>
    <description>&lt;P&gt;Here is a recent reply to a discussion item from MZWald of the JMP Staff about multiple core usage and GPU's&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some platforms in JMP only use a single thread so having many threads wouldn't add much value, but having that single thread running at a faster frequency would add value.&amp;nbsp; Some platforms in JMP do take advantage of multiple threads so having more threads/cores does help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the Torch add-in in JMP Pro 18, now for the first time a GPU will be utilized for image classification and deep learning which does those tasks orders of magnitude faster than a CPU.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 16 Feb 2025 03:09:11 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2025-02-16T03:09:11Z</dc:date>
    <item>
      <title>Can JMP Software's JSL operations use GPU acceleration?</title>
      <link>https://community.jmp.com/t5/Discussions/Can-JMP-Software-s-JSL-operations-use-GPU-acceleration/m-p/841770#M101576</link>
      <description>&lt;P&gt;Currently, it's easy to leverage GPU acceleration for computations in Python. Can this be achieved using JSL alone?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks Experts!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;64bit win10&lt;/P&gt;</description>
      <pubDate>Sun, 16 Feb 2025 00:18:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Can-JMP-Software-s-JSL-operations-use-GPU-acceleration/m-p/841770#M101576</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2025-02-16T00:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Can JMP Software's JSL operations use GPU acceleration?</title>
      <link>https://community.jmp.com/t5/Discussions/Can-JMP-Software-s-JSL-operations-use-GPU-acceleration/m-p/841795#M101581</link>
      <description>&lt;P&gt;Here is a recent reply to a discussion item from MZWald of the JMP Staff about multiple core usage and GPU's&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some platforms in JMP only use a single thread so having many threads wouldn't add much value, but having that single thread running at a faster frequency would add value.&amp;nbsp; Some platforms in JMP do take advantage of multiple threads so having more threads/cores does help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the Torch add-in in JMP Pro 18, now for the first time a GPU will be utilized for image classification and deep learning which does those tasks orders of magnitude faster than a CPU.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Feb 2025 03:09:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Can-JMP-Software-s-JSL-operations-use-GPU-acceleration/m-p/841795#M101581</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2025-02-16T03:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: Can JMP Software's JSL operations use GPU acceleration?</title>
      <link>https://community.jmp.com/t5/Discussions/Can-JMP-Software-s-JSL-operations-use-GPU-acceleration/m-p/841797#M101582</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2025-02-16_12-22-17.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/72970i2A410AFC2F588F60/image-size/large?v=v2&amp;amp;px=999" role="button" title="2025-02-16_12-22-17.png" alt="2025-02-16_12-22-17.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Feb 2025 04:23:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Can-JMP-Software-s-JSL-operations-use-GPU-acceleration/m-p/841797#M101582</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2025-02-16T04:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: Can JMP Software's JSL operations use GPU acceleration?</title>
      <link>https://community.jmp.com/t5/Discussions/Can-JMP-Software-s-JSL-operations-use-GPU-acceleration/m-p/841798#M101583</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;import pyopencl as cl
import pyopencl.array as cl_array
import numpy as np
import csv
import os
import time

# Select OpenCL platform and GPU device
platform = cl.get_platforms()[0]  # Select the first platform (e.g., AMD)
device = platform.get_devices()[0]  # Select the first GPU device (e.g., gfx804)
context = cl.Context([device])
queue = cl.CommandQueue(context)

# Define the GPU computation kernel (squares array elements)
kernel_code = """
__kernel void square(__global float *arr) {
    int gid = get_global_id(0);
    arr[gid] = arr[gid] * arr[gid];
}
"""
program = cl.Program(context, kernel_code).build()

# Create the CSV file path
csv_path = r"C:\0\results.csv"  # Changed to a more common name

# Ensure the directory exists
os.makedirs(os.path.dirname(csv_path), exist_ok=True)

# Run 10,000 computation tasks
n = 10**6  # 1 million data points per computation
num_iterations = 10_000

# Pre-allocate arrays
host_array = np.empty(n, dtype=np.float32)
gpu_array = cl_array.empty(queue, host_array.shape, dtype=host_array.dtype)

# Store results
results = []

# Random number generator
rng = np.random.default_rng()

# Start timing
start_time = time.time()

for i in range(num_iterations):
    # Generate random data and fill host_array
    host_array[:] = rng.random(n, dtype=np.float32)

    # Upload data to GPU
    cl.enqueue_copy(queue, gpu_array.data, host_array)

    # Compute on the GPU
    program.square(queue, gpu_array.shape, None, gpu_array.data)

    # Retrieve data from GPU
    cl.enqueue_copy(queue, host_array, gpu_array.data)

    # Record the first 5 results
    results.append([i + 1] + host_array[:5].tolist())

    # Progress display
    if (i + 1) % 100 == 0:
        print(f"Completed {i + 1}/{num_iterations} iterations...")

# Total time statistics
end_time = time.time()
total_time = end_time - start_time
print(f"Total time: {total_time:.2f} seconds")
print(f"Average time per iteration: {total_time / num_iterations:.6f} seconds")

# Write results to CSV in a single operation
with open(csv_path, "w", newline="") as f:
    writer = csv.writer(f)
    writer.writerow(["Iteration", "Result 1", "Result 2", "Result 3", "Result 4", "Result 5"])  # CSV header
    writer.writerows(results)

print(f":white_heavy_check_mark:&lt;/img&gt; Computation complete, results saved to {csv_path}")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;python&lt;BR /&gt;How can to JSL？&lt;/P&gt;</description>
      <pubDate>Sun, 16 Feb 2025 04:25:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Can-JMP-Software-s-JSL-operations-use-GPU-acceleration/m-p/841798#M101583</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2025-02-16T04:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: Can JMP Software's JSL operations use GPU acceleration?</title>
      <link>https://community.jmp.com/t5/Discussions/Can-JMP-Software-s-JSL-operations-use-GPU-acceleration/m-p/842406#M101620</link>
      <description>&lt;P&gt;At present, you can't. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using Python and either PyCUDA or pyOpenCL is about the only way to access GPUs from scripting in JMP. &amp;nbsp;As shown in one of my previous posts, you can create user defined JSL functions that implement functionality in Python using the Python Execute(). &amp;nbsp;This way you can write the GPU Code in Python, yet still present a JSL interface for the rest of your scripting.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2025 15:20:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Can-JMP-Software-s-JSL-operations-use-GPU-acceleration/m-p/842406#M101620</guid>
      <dc:creator>Paul_Nelson</dc:creator>
      <dc:date>2025-02-18T15:20:47Z</dc:date>
    </item>
  </channel>
</rss>

