원시데이터 수집 시스템
선정목록으로

Exploiting Ray Tracing Technology Through OptiX to Compute Particle Interactions with Cutoff in a 3D Environment on GPU

관련 모빌리티 소재 · (2) 샤무드(인공피혁)

기본 정보

저자
  1. David Algis
  2. Bérenger Bramas
DOI
10.14569/ijacsa.2025.0160205
저널
International Journal of Advanced Computer Science and Applications
발행년도
2025
발행기관
Science and Information Organization
피인용수
0
라이선스
cc-by
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.14569/ijacsa.2025.0160205
토픽
Surface Roughness and Optical Measurements
OpenAlex ID
W4408078565

평가 내용

관련도
관련
사업분야
모빌리티 소재 · (2) 샤무드(인공피혁)
부 분야
–
R&D 측면
–
확신도
–
근거 용어
–
판단 근거
임베딩 유사도 기반 평가로 '모빌리티 소재 > 샤무드(인공피혁)' 분야에 선정된 논문입니다.
R&D 활용 포인트
–
평가 입력
–

초록

Particle interaction simulation is a fundamental method of scientific computing that require high-performance solutions. In this context, computing on graphics processing units (GPUs) has become standard due to the significant performance gains over conventional CPUs. However, since GPUs were originally designed for 3D rendering, they still retain several features that are not fully exploited in scientific computing. One such feature is ray tracing, a powerful technique for rendering 3D scenes. In this paper, we propose exploiting ray tracing technology via OptiX and CUDA to compute particle interactions with a cutoff distance in a 3D environment on GPUs. To this end, we describe algorithmic techniques and geometric patterns for efficiently determining the interaction lists for each particle. Our approach enables the computation of interactions with quasi-linear complexity in the number of particles, eliminating the need to construct a grid of cells or an explicit kd-tree. We compare the performance of our method to a classical grid-based approach and demonstrate that our approach is faster in most cases with non-uniform particle distributions.

본문 95,589자

본문 펼치기
_Vol._ _16,_ _No._ _2,_ _2025_ # Exploiting Ray Tracing Technology Through OptiX to Compute Particle Interactions with Cutoff in a 3D Environment on GPU David Algis <sup>1</sup>, B´erenger Bramas <sup>2</sup> University of Poitiers, XLIM, France <sup>1</sup> Studio Nyx, France <sup>1</sup> Inria Nancy, France <sup>2</sup> ICube Laboratory, France <sup>2</sup> University of Strasbourg, France <sup>2</sup> _Abstract_ —Particle interaction simulation is a fundamental method of scientific computing that require high-performance solutions. In this context, computing on graphics processing units (GPUs) has become standard due to the significant performance gains over conventional CPUs. However, since GPUs were originally designed for 3D rendering, they still retain several features that are not fully exploited in scientific computing. One such feature is ray tracing, a powerful technique for rendering 3D scenes. In this paper, we propose exploiting ray tracing technology via OptiX and CUDA to compute particle interactions with a cutoff distance in a 3D environment on GPUs. To this end, we describe algorithmic techniques and geometric patterns for efficiently determining the interaction lists for each particle. Our approach enables the computation of interactions with quasilinear complexity in the number of particles, eliminating the need to construct a grid of cells or an explicit kd-tree. We compare the performance of our method to a classical grid-based approach and demonstrate that our approach is faster in most cases with non-uniform particle distributions. _Keywords_ — _CUDA; graphics processing unit; high-performance_ _computing;_ _OptiX;_ _particle_ _interactions;_ _ray_ _tracing;_ _scientific_ _computing_ I. INTRODUCTION High-performance computing (HPC) is a key technology in scientific computing. Since the early 2000s, the use of graphics processing units (GPUs) has become standard in HPC, and they now equip many of the fastest supercomputers. <sup>1</sup> GPUs are massively parallel processors that allow computations to be performed on thousands of cores, making them perfectly suited for inherently parallel problems. The use of GPUs in scientific computing has led to incredible performance gains in many fields, such as molecular dynamics [1], fluid dynamics [2], astrophysics [3], and machine learning [4]. Most scientific computing applications that use GPUs are based on the CUDA <sup>2</sup> programming model, and to a lesser extent, the OpenCL programming model. They do not exploit all the features of GPUs, particularly those dedicated to 3D rendering. Among these features, ray tracing is a powerful technology used to render 3D scenes. In this method, rays are cast from the camera to the scene, and the intersections [1https://top500.org/](https://top500.org/) [2https://developer.nvidia.com/cuda-toolkit](https://developer.nvidia.com/cuda-toolkit) of the rays with the objects in the scene are computed to generate the colors of the pixels in the image [5]. For example, the NVIDIA GeForce RTX 4090, as a single consumer-grade GPU, demonstrates the raw power of this technology by rendering complex 3D scenes at 87 frames per second in 4K resolution (3840 x 2160 pixels), handling millions of triangles per frame [6]. In this paper, we are interested in evaluating how ray tracing technology could be used to compute particle interactions in a 3D environment. Our motivation is twofold: We want to evaluate if it is possible to use ray tracing technology, and we want to create the algorithmic patterns needed for that purpose. With these aims, we focus on the computation of particle interactions in a 3D environment, which is a common problem in scientific computing. When the potential of the interaction kernel decreases exponentially with distance, the interactions can be computed with a cutoff distance, i.e. the interactions are only computed between particles that are closer than a given distance, achieving less but still satisfactory accuracy. This allows the complexity of the interactions to drop from _O_ ( _N_ <sup>2</sup> ) to _O_ ( _N_ ), where _N_ is the number of particles if the cutoff distance is small enough. Classical methods to compute such interactions are based on the use of a grid of cells or an explicit kd-tree to quickly find the interaction lists for each particle. In this paper, we aim to avoid using such data structures and instead exploit ray tracing technology. The contributions of this paper are as follows: _•_ We propose a method to compute particle interactions with a cutoff distance in a 3D environment based on ray tracing technology. _•_ We describe two algorithmic techniques based on geometric patterns to find the interaction lists for each particle using real intersections. _•_ We compare the performance of our approach with a classical approach based on a grid of cells and with an existing method that relies on ray tracing. The rest of the paper is organized as follows: In Section II, we present the prerequisites. In Section III, we review the related work. In Section IV-A, we present our proposed approach. In Section V, we present the performance study. Finally, we conclude in Section VI. II. PREREQUISITES _A._ _Particle_ _Interactions_ Computing the interactions between _N_ particles in a 3D environment is a common problem in scientific computing. For example, this is essential in fluid simulations using smoothed particle hydrodynamics [7] and in molecular dynamics for simulating forces between atoms [8]. These interactions are usually modeled by a potential function that depends on the distance between the particles. A straightforward way to compute the interactions is to evaluate the potential function for all pairs of particles. However, the potential function can be short-range or long-range. When the potential function is shortrange, the interactions can be computed with a cutoff distance, i.e. the interactions are only computed between particles that are closer than a given distance. This reduces the complexity of the interactions from _O_ ( _N_ <sup>2</sup> ) to _O_ ( _N_ ), where _N_ is the number of particles, but this is only possible if we have an efficient way to find the particles’ neighbors. Moreover, the positions of the particles are usually updated after each computation step. Consequently, the system used to find the interactions between the particles should be updated at each iteration of the simulation. A possible solution to get the interaction list is to build a grid of cells mapped over the simulation space, where each cell contains the particles that are inside. The cells have a width equal to the cutoff distance _C_ . Then, for each particle, the interactions are computed with the particles that are in the same cell and in the neighboring cells. Building the grid of cells and finding the interaction lists for each particle can be done in _O_ ( _N_ ): we start by computing the cell index for each particle, then we order the particles in a new array by assigning a unique index per particle using atomic operations, and finally, we move the particles to a new array [9]. Each of these three operations can be implemented with a parallel loop over the _N_ particles. _B._ _Graphics_ _Processing_ _Units_ Graphics processing units (GPUs) are massively parallel processors that allow computations to be performed on thousands of cores. The hardware design of GPUs has been optimized for graphics rendering, particularly for the rendering of 3D scenes. To this end, GPUs have features dedicated to 3D rendering, such as texture mapping, rasterization, and ray tracing. Internally, GPUs are organized in a hierarchy of processing units, including streaming multiprocessors (SMs), warp schedulers, and execution units. NVIDIA has proposed the CUDA programming model to develop parallel applications for GPUs. CUDA is designed to express algorithms in a way that can be mapped to the GPUs’ hardware organization. For instance, thread blocks are distributed across SMs, and threads are executed in warps. There are also keywords and functions to use shared memory, constant memory, and texture memory. Thus, creating optimized applications for GPUs requires an understanding of the hardware architecture of GPUs and potentially adapting algorithms to their specificities. _Vol._ _16,_ _No._ _2,_ _2025_ _C._ _Ray_ _Tracing_ Among the many features of GPUs dedicated to 3D rendering, ray tracing stands out as a powerful technology widely used in video games for rendering realistic 3D scenes [10]. It is a hardware-accelerated technique that computes the interactions of rays with objects in a scene. Ray tracing generates pixel colors in an image by casting rays from the camera into the scene. For each intersection of a ray with an object, the pixel’s color is determined based on the object’s material properties and lighting conditions. Rays can also be reflected or refracted by objects, or continue through non-opaque surfaces, enabling recursive computation of interactions for enhanced realism. Typically, ray tracing kernels are implemented within the shaders of the graphics pipeline. Shaders are small programs executed on the GPU for each pixel in an image, often written in specialized languages such as GLSL (for OpenGL) or HLSL (for DirectX). These shaders run in parallel on the GPU, allowing for concurrent computation of ray-object interactions. NVIDIA introduced a method to utilize ray tracing within the CUDA programming model through its OptiX library [11]. With OptiX, developers retain the flexibility of CUDA programming while leveraging ray tracing technology, albeit with some constraints on kernel implementation. User code Build tree (BVH) Optix library Fig. 1. Schematic view of BVH tree creation. The OptiX library requires a list of encompassing axis-aligned bounding boxes (AABBs), which can either be directly provided or generated from a list of basic primitives. In ray tracing, scenes are represented using geometric primitives such as triangles or spheres, which are encapsulated within bounding volumes to enhance computational efficiency [12]. A common bounding volume is the Axis-Aligned Bounding Box (AABB), a rectangular box aligned with the coordinate axes and defined by its minimum and maximum bounds ( _xmin, ymin, zmin_ ) and ( _xmax, ymax, zmax_ ). AABBray intersection tests are conducted by calculating _tmin_ and _tmax_ for each axis and ensuring that overlaps exist across all axes, efficiently determining whether the ray intersects the box. To further optimize performance, AABBs are organized into a Bounding Volume Hierarchy (BVH), a tree-like data structure where each node represents an AABB. Internal nodes group child AABBs, while leaf nodes encapsulate the actual primitives. In OptiX, users can either provide a list of basic primitives or directly supply a list of AABBs, as illustrated in Fig. 1. During ray traversal, the algorithm performs intersection tests at each BVH node. If a ray misses an AABB, the entire Create 3D built in primitives Generate AABB Create AABB subtree beneath that node is skipped, reducing unnecessary computations. When a ray reaches a leaf node, precise intersection tests are conducted with the enclosed primitives, and the closest intersection is recorded. This process reduces the complexity of ray-scene intersections from linear to logarithmic by pruning large portions of the scene, ensuring only relevant branches of the BVH are explored. The final output of the ray tracing algorithm, typically the closest hit point, is used for shading or further processing to determine the visual appearance of the scene. This hierarchical approach, combined with the use of AABBs and BVH, ensures that ray tracing remains computationally feasible even for complex scenes containing millions of primitives. Fig. 2 provides a summary of the different operations in ray tracing using OptiX. In the first step, the user casts rays in the desired direction, and OptiX manages the BVH tree traversal and potential interactions. When a ray enters an enclosing bounding box (AABB), a callback function is invoked to determine whether the ray actually intersects the corresponding primitive, based on a built-in or user-defined Intersection Shader (IS), referred to as the intersection strategy. For custom primitives, the user must implement the IS. If the ray does not intersect or is marked to continue, the process is repeated for other primitives. The traversal stops when a final intersection is found or no more primitives can be intersected, triggering a call to the miss callback. User code Optix library Cast rays (direction, origin, tmin, tmax) Custom intersection strategy No Iterate on the BVH tree Ray traverses an AABB Custom primitive ? Yes Built-in intersection strategy No Hit ? No Hit ? No Yes Yes Take it into account to manage the traversal Hit callback Continue? No Miss callback Yes Yes Take it into account to manage the traversal Traversal is over ? No Fig. 2. Schematic view of the OptiX ray tracing workflow. III. RELATED WORK _A._ _Neighbor_ _Search_ _on_ _GPU_ The main work on physical simulation of particle interactions on GPU has been proposed by [13], to compute the gravitational potential. They described an efficient implementation using shared memory that became a standard implementation on GPU. As mentioned in Section II-A, gridbased and kd-tree structures are widely utilized for neighbor _Vol._ _16,_ _No._ _2,_ _2025_ search operations on GPUs. For grid-based approaches, a detailed description can be found in our previous study [9], which focuses on scenarios with few particles per cell and demonstrates that utilizing shared memory often does not yield significant benefits. Regarding kd-tree implementations, [14] present a method for fast k-nearest neighbor searches using GPUs, highlighting the efficiency of kd-trees in highdimensional spaces. _B._ _Ray_ _Tracing_ _in_ _Computer_ _Graphics_ Ray tracing has been widely applied in particle-based representations, primarily in the domain of computer graphics and rendering. The author in [15] propose a method for efficiently ray tracing Gaussian particles to enable advanced rendering effects such as shadows, reflections, and depth of field in dense particle scenes, with applications in novel-view synthesis and visual realism. Similarly, [16] explores hardware-accelerated ray tracing for rendering particles that cast shadows, focusing on evaluating the performance of a prototype system. While these works demonstrate the utility of ray tracing in particlebased scenes, their focus lies in rendering and visualization, contrasting with our application of ray tracing for neighbor search in physical simulations. _C._ _OptiX_ _in_ _Scientific_ _Computing_ The NVIDIA OptiX framework has shown potential for diverse applications in scientific computing. Blyth et al. utilized OptiX to enable high-performance optical photon simulations in particle physics. This approach reduced memory and computation overheads by using GPU-based culling of photon hits, handling millions of photons in complex geometries [17], [18]. OptiX has been utilized as a flexible and high-performing tool for optical 3D modeling, enabling virtual measurements of sample surfaces by tracing over 1 billion light rays per image and comparing simulated results with those from physical measuring devices [19]. While these applications highlight OptiX’s potential in handling computationally intensive tasks, they primarily focus on modeling physical processes rather than using ray tracing for spatial queries or particle interactions. Our work bridges this gap by leveraging OptiX for neighbor detection and particle interaction calculations, building on its demonstrated strengths in scientific modeling to expand its applicability into the domain of particle-based simulations. _D._ _OptiX_ _for_ _Neighbor_ _Search_ Using OptiX to find neighbors between elements has already been explored in several works. I. Evangelou et al. [20] introduced a novel approach to spatial queries, particularly radius search, by leveraging GPU-accelerated ray-tracing frameworks with OptiX. Instead of traditional spatial data structures like kd-trees, the authors proposed mapping the radius-search task to the ray-tracing paradigm by treating query points as primitives within a bounding volume hierarchy (BVH). In the proposed method, a ray used in the radius-search operation is essentially infinitesimal in extent, and its purpose is not to compute a traditional intersection but to test whether the origin of the ray (the query point) is within the bounding volume of a “sphere” surrounding each sample point. For that purpose, the authors reimplemented the function that tests if a ray intersects a sphere to control how the tests are performed. This approach enabled significant performance gains in dynamically updated datasets. Yuhao Zhu [21] further advanced the application of ray tracing for neighbor search by introducing optimizations for mapping the neighbor search problem onto the ray-tracing hardware available in modern GPUs. The author identified two key performance bottlenecks: unmanaged query-to-ray mapping, which led to control-flow divergences, and excessive tree traversals stemming from monolithic BVH construction. To address these issues, they proposed query scheduling and partitioning strategies that exploit spatial coherence and reduce BVH traversal time. Their experiments demonstrated substantial speedups ranging from 2 _._ 2 to 65 _._ 0 over existing GPU neighbor search libraries. Their work highlights the potential of using ray-tracing hardware not only for rendering but also for efficient spatial queries. The source code for their work is available on GitHub; however, the implementation is not directly applicable to our purpose as it primarily focuses on radius search and constructing interaction lists. In contrast, our interest lies in directly computing the interactions. Furthermore, for large test cases involving particles distributed on a sphere, the performance of their method appears to be of the same order of magnitude as ours. Shiwei Zhao et al. [22] extended the use of ray tracing for particle-based simulations by converting neighbor search into a ray tracing problem. Each particle was represented as a bounding box, similar to previous works, with tiny rays emitted to detect intersections and identify neighboring particles. By leveraging NVIDIA’s RT cores alongside CUDA cores, they demonstrated 10% to 60% performance improvements over traditional cell-based methods in various particle-based simulations, including discrete element methods and smooth particle hydrodynamics. Their approach underscores the versatility of ray-tracing cores for accelerating computationally intensive neighbor search tasks across different domains. These works collectively demonstrate the potential of using OptiX and ray-tracing hardware for efficient spatial queries, providing a foundation for further exploration in GPU-accelerated computational methods. However, these approaches lack a direct integration of physical interaction computations within the ray-tracing framework. Our approach addresses this gap by embedding cutoff distances directly into the intersection tests. Additionally, we introduce two novel methods for neighbor detection that utilize actual intersection computations, accommodating scenarios where custom IS are unsupported. IV. PROPOSED SOLUTIONS _A._ _Overview_ The core idea of our approach is to represent particles using geometric primitives and to use ray tracing to find the neighbors of each particle by detecting intersections with these primitives. With this aim, we investigate three possibilities: _Vol._ _16,_ _No._ _2,_ _2025_ _1) Custom_ _AABB:_ in this case, we directly provide the list of englobing bounding boxes. Therefore, we also have to provide our own IS in which we do not compute real intersections but only check if a ray is inside an AABB. This strategy is the closest one to the state of the art. _2) Spheres:_ in this case, we use built-in sphere primitives, which allows us to use the built-in IS that check if a ray really intersect with the surface of a sphere. However, we had to create our own geometric algorithm to make it work. _3) Triangles:_ in this case, we use built-in triangle primitives to create squares, which allows to use the built-in IS that check if a ray really intersect with the surface of a triangles. As for the spheres, we had to create our own geomatric algorithm to make it work. The spherical approach is simpler and more intuitive than using squares, but we are interested in evaluating if the squares made of triangles is more efficient as it is the most used primitive in 3D rendering. We also want to evaluate if the built-in IS is more efficient than our custom IS. In the cases that rely on built-in IS, we use the following algorithmic pattern: 1) We build a geometric representation for each particle. 2) We cast rays from each particle in specific directions to find the neighbors, depending on the representation. 3) We filter the intersections to avoid computing the same interaction multiple times. 4) We compute the interactions between the particles that are closer than _C_ . To reduce overhead, we aim to use as few rays as possible and ensure they do not intersect with too many particles that are not within the distance _C_ . In terms of implementation, we use the OptiX library to develop the ray tracing kernels, which can be used in conjunction with the CUDA programming model. Specifically, in the OptiX API, we create a scene by providing a list of geometric primitives. We then provide a CUDA kernel that launches the rays, where each ray has an origin, a direction, a starting point, and an endpoint. Usually, one CUDA thread is used to launch one ray. Finally, a callback is invoked by OptiX when a ray intersects with a primitive or if no intersection is found between the starting and ending points (in 3D rendering, this usually means that the background color should be used). The data accessible from the callback is limited. OptiX built-in IS can provide information about the intersection, such as the intersection point, the normal on the surface, the distance from the ray’s origin, and the index of the primitive that was hit. Additionally, the user can pass information from the CUDA kernel that launches the rays to the callback using a payload. A payload is a user-defined data structure that is passed along with a ray as it traverses the scene. It allows the ray to carry information that can be read or modified. The number of payload variables is limited (usually 16 32-bit integers in recent versions). When the hit callback is invoked, and we want the ray to continue, there are two possibilities. The first is to launch a new ray from the intersection point in a new direction. This is _Vol._ _16,_ _No._ _2,_ _2025_ _~~√~~_ <sup>_<u>×</u>_</sup> _~~√~~_ 3 <u>2</u> done by storing the intersection distance in a payload variable, returning from the callback, and then launching a new ray from the intersection point using a loop in the CUDA kernel to reach the desired distance. The second possibility is to inform OptiX that we want to continue the traversal by calling a corresponding function in the intersection callback. This second approach is generally more efficient, as it avoids the overhead associated with launching new rays and and should be favored in practice. Additionally, we cannot allocate memory in the callbacks, so we cannot build complex data structures, such as lists, to store intersection lists. Consequently, if we want to filter the intersections, we cannot fill an array with indices and check if an index exists in the array to ensure uniqueness; instead, we must use geometric properties to filter the intersections. In the remainder of the section, we consider that the target particle is the particle for which we want to find the neighbors. _B._ _Spherical_ _Representation_ In this section, we consider the case where the particles are represented by spheres and we use the built-in IS. In OptiX, a sphere is a geometric primitive defined by its center and radius, and multiple spheres of the same radius can be instantiated in the scene, which is the approach we use. We have the following objectives: 1) Expressing the radius of the spheres depending on the cutoff distance; 2) Defining the origins and directions of the rays; 3) Providing a mechanism to filter the intesection when the rays intersect multiple times with the same sphere. the sphere in all cases, obtaining _r_ = <sup>_<u>C×</u>_</sup> _~~√~~_ the sphere in all cases, obtaining _r_ = <sup>_<u>C×</u>_</sup> _~~√~~_ 3 <u>2</u> <sup>+</sup> <sup>_ϵ_</sup> <sup>and</sup> <sup>_l_</sup> <sup>=</sup> <sup>_<u>C×</u>_</sup> _~~√~~_ 3 <u>2</u> <sup>.</sup> The _ϵ_ is a small value such that it must be impossible that two particles are closer than _ϵ_, or some intersections will be missed (see Appendix A for more details). <sup>_<u>×</u>_</sup> _~~√~~_ 3 <u>2</u> _~~√~~_ _~~√~~_ 3 <u>2</u> <sup>+</sup> <sup>_ϵ_</sup> <sup>and</sup> <sup>_l_</sup> <sup>=</sup> <sup>_<u>C×</u>_</sup> _~~√~~_ 3 1.00 0.75 0.50 <u>00.25.00</u> Z 0.25 1.000.750.50 1.00 0.75 0.50 0.25 0.00 Z 0.25 0.50 0.75 1.00 Z 1.000.750.500.250.000.250.500.751.0X <u>0</u> 1.00 0.75 0.50 0.25 0.250.00Y 0.50 0.75 1.00 X1. ~~<u>0.70.50.000.020</u>~~ <u>10</u> ~~05~~ <u>.0.5.25.01.050750</u> ~~00~~ 0. ~~75~~ 0. ~~50~~ 0.250.000.250.500.751.00Y X1. ~~<u>0.70.50.000.020</u>~~ <u>10</u> ~~05~~ <u>.0.5.25.01.050750</u> ~~00~~ 0. ~~75~~ 0. ~~50~~ 0.250.000.250.500.751.00Y Fig. 3. 3D Spherical representation of a source and tar _√_ <u>get</u> particles distance _√_ from _C_ = 1. The source sphere has a radius of _~~√~~_ <u>2</u> from _C_ = 1. The source sphere has a radius of _~~√~~_ <u>23</u> <sup>and</sup> <sup>the</sup> <sup>rays,</sup> represented by segments, are of length _~~√~~_ <u>13</u> <sup>in</sup> <sup>each</sup> <sup>direction.</sup> <sup>In</sup> <sup>this</sup> segments, are of length _~~√~~_ <u>13</u> <sup>in</sup> <sup>each</sup> <sup>direction.</sup> <sup>In</sup> <sup>this</sup> <sup>case,</sup> the sphere could englobe the rays. In our model, we will use three rays for each particle, one in each direction of the coordinate system. Consider a sphere of radius _C_ centered at the origin in a three-dimensional space. The points on this sphere that are at the farthest distance from the three coordinate axes are located in the corners of a cube inscribed within the sphere. For instance, one such point at distance _C_ from the origin lies in the direction (1 _,_ 1 _,_ 1). These 8 points, corresponding to the vertices of the cube, are all at a distance _C_ from the origin, and we want to know how far they are from the coordinate axes. This can be calculated as follows: Since the points have coordinates where _|x|_ = _|y|_ = _|z|_, we use the equation of the sphere _x_ <sup>2</sup> + _y_ <sup>2</sup> + _z_ <sup>2</sup> = _C_ <sup>2</sup> . If we take the point for which _x_ = _y_ = _z_, it gives 3 _x_ <sup>2</sup> = _C_ <sup>2</sup>, resulting in _x_ = _~~√~~_ _<u>C</u>_ 3 <sup>.</sup> <sup>Therefore,</sup> <sup>each</sup> <sup>of</sup> <sup>these</sup> <sup>points</sup> <sup>is</sup> <sup>at</sup> <sup>a</sup> <sup>distance</sup> <sup>of</sup> When the source and target particles are perfectly aligned on one axis, the ray will intersect for particles distant from the extremity by _r_ + _ϵ_ . Therefore, two particle distant from _l_ + _r_ + _ϵ_ can interact. This case and any intermediate situation where the source/target are actually too far can easily be filtered by checking the distance. In Fig. 4, we provide a 2D representation of the particles using spheres on intricate cases. However, each ray can potentially intersect with a sphere several times, and the same sphere can be intersected by several rays of the same target particle, so we need to filter them. It is impossible to maintain a global list that all the rays can access to check if an intersection has already been found, or even a single list per ray to ensure that it does not intersect with the same sphere. Therefore, we must do this based on geometric rules as described in Algorithm 1. When we detect an intersection, we get the position of the source and target particles and first check they are within the cutoff distance. Then, we check if the closest ray to the source particle is the current one, and if yes, we can proceed with the computation (see Appendix A for more details). _C._ _Double_ _Squares_ _Representation_ Most 3D rendering applications use triangles to represent the objects in the scene, which motivated us to create a second model that relies on triangles instead of spheres. Of course, building the AABB representations and the HBV tree is not expected to be faster than the sphere, but the hardware modules and built-in could be more optimize for the triangles, as it is more common primitives. In our model, we use four triangles to draw two squares, which are positioned opposite each other. Each square has a width of _C_ + _ϵ_ and is positioned at a distance of _C/_ 2 along the X-axis relative to the particle, one in each direction. We provide Code 1 in Appendix B, which shows how we generate the triangles from the particles’ positions. We then launch four rays, all with the same length and direction, but positioned at the corners of the squares. Each ray is positioned at _−C/_ 2 from the center of the square and has a length of _C_ + _ϵ_ . The _ϵ_ is used to ensure that when the source and target particles have the same _x_ coordinate and their squares overlap, the rays cross the triangles. We provide _~~√~~_ 3 <sup>.</sup> <sup>Therefore,</sup> <sup>each</sup> <sup>of</sup> <sup>these</sup> <sup>points</sup> <sup>is</sup> <sup>at</sup> <sup>a</sup> <sup>distance</sup> <sup>of</sup> _<u>C×</u>_ _~~√~~_ _<u>×</u>_ _~~√~~_ <u>2</u> <u>2</u> from any of the three coordinate axes. 3 We use this information to define the radius of the sp _~~√~~_ <u>heres</u> and the length of our rays. The radius is set to _r_ = <sup>_<u>C×</u>_</sup> _~~√~~_ 3 <u>2</u> <sup>.</sup> <sup>In</sup> this scenario, it is sufficient that the rays go up to _l_ = _~~√~~_ _<u>C</u>_ 3 <sup>in</sup> each direction relatively to the particle’s position (so a single ray goes from _−l_ to _l_ ). We provide a simplified 3D rendering of the spheres in Fig. 3 that illustrate our model. However, if _l_ _<_ _r_, there are positions where the sphere could simply englobe the rays, and we would miss some intersections (when the source and target are closer than _r −_ _l_ in the three dimensions). Therefore, we set _l_ = _r_ and add an _ϵ_ to the radius of the sphere to ensure that the rays intersect with _~~√~~_ <sup>_<u>×</u>_</sup> _~~√~~_ 3 <u>2</u> 2D representation when the source and target are aligned, the source will be detected at _r + l_ _+ epsilon_ . 2D representation with the four positions the farest from the rays. The source sphere intersect with both rays. _Vol._ _16,_ _No._ _2,_ _2025_ 2D representation with multiple sources that have their spheres intersected with the rays. Fig. 4. 2D Spherical representation of the particles in three different cases. In the first one (left), what will be the position of the farthest source particle and how it will be detected by the ray. In the second one (center), we show the case where the source particle is the farthest from the rays (it also shows that in 2D the sphere radius could be smaller). In the last one (right), we show different source particles with their spheres and the rays that will intersect with them. <u>Algorithm</u> <u>1:</u> <u>Sphere</u> <u>intersection</u> <u>callback</u> Data: Optix variables Result: Callback when a ray intersect with a sphere 1 Function callback() 2 begin /* Get the center of the sphere (source position) - <sup>/</sup> 3 _q_ _←_ optixGetSphereData () /* Current particle position (target position) - <sup>/</sup> 4 _point ←_ getPayloadPartPos() /* Compute differences and distances - <sup>/</sup> 5 _diff_ _<u>pos ←{</u>_ abs( _point.x −_ _q.x_ ) _,_ abs( _point.y −_ _q.y_ ) _,_ abs( _point.z −_ _q.z_ ) _}_ 6 _diff_ _<u>pos</u>_ _squared ←_ _{diff_ _<u>pos.x</u>_ <sup>2</sup> _, diff_ _<u>pos.y</u>_ <sup>2</sup> _, diff_ _<u>pos.z</u>_ <sup>2</sup> _}_ 7 _dist_ _squared ←_ _diff_ _pos_ _squared.x_ + _diff_ _<u>pos</u>_ _<u>squared.y</u>_ + _diff_ _pos_ _squared.z_ /* Get the cutoff distance from payload - <sup>/</sup> 8 _c ←_ getPayloadC() /* Ensure it is in the cutoff distance - <sup>/</sup> 9 if _dist_ _squared < c_ <sup>2</sup> then 10 _dist_ _<u>axis</u>_ _squared ←_ _{diff_ _<u>pos</u>_ _<u>squared.y</u>_ + _diff_ _pos_ _<u>squared.z, diff</u>_ _<u>pos</u>_ _squared.x_ + _diff_ _pos_ _<u>squared.z, diff</u>_ _<u>pos</u>_ _squared.x_ + _diff_ _pos_ _<u>squared.y}</u>_ 11 _ray_ _<u>dir</u>_ _←_ optixGetWorldRayDirection() 12 _closest_ _<u>axis ←</u>_ getClosestAxis( _dist_ _<u>axis</u>_ _squared_ ) 13 _closest_ _<u>axis</u>_ _<u>is</u>_ _ray_ _<u>dir</u>_ _←_ ( _ray_ _<u>dir</u>_ == _closest_ _axis_ ) /* Ensure this ray and this intersection are the good one - <sup>/</sup> 14 if _closest_ _<u>axis</u>_ _<u>is</u>_ _ray_ _<u>dir</u>_ then /* Call computation kernel - <sup>/</sup> in Fig. 5 the 2D representation of the particles using squares (which are lines in 2D). From this description, one particle can be seen as a box of sides ( _C_ + _ϵ, C_ + _ϵ, C_ ) (see Fig. 6). The rays can be seen as the four edges of the box in the _x_ direction, and the triangles composed the front and back faces. If any two boxes have an intersection, we will detect it as shown in Fig. 5. Potentially, the ray will intersect with the squares of the target particle, but this can easily be filtered by checking either the coordinates or the index of the geometric elements. Additionally, if the target and source particles are aligned on the _y_ or _z_ axis, two rays will intersect with the source’s squares. To filter these intersections, we proceed as shown in Algorithm 2. We compare the coordinates between the source and the target and proceed as follows: If _y_ and _z_ are different, we perform the computation (only the current ray will intersect). If _y_ is equal, we use the ray of index 0 if _z_ is smaller, and the ray of index 2 if _z_ is greater. If _z_ is equal, we use the ray of index 0 if _y_ is smaller, and the ray of index 1 if _y_ is greater. Otherwise, only the ray of index 0 will be used for computation (all four rays will intersect). _D._ _Custom_ _AABB_ In this strategy, a bounding box with a width equal to 2 _×C_ is created around each particle. OptiX treats these boxes as custom primitives, requiring us to implement a custom IS that is invoked when a ray enters an AABB. We do not perform any intersection tests within the IS, as our goal is not to compute ray-AABB or ray-surface intersections but to identify pairs of particles that are within a distance _C_ of each other. To achieve this, rays are cast from the particles’ positions with an infinitesimally short length, as illustrated in Fig. 7. The interaction between the source and target particles is computed directly within the IS callback. Consequently, the hit and miss callbacks are left empty, as there is no need to filter intersections. In the IS callback, OptiX provides information about the ray (specifically, the starting point, which corresponds to the position of the source particle) and the index of the AABB being tested. To obtain geometric information about the AABB, one could register a Primitive Geometry Acceleration Structure (PGAS) for each AABB during the OptiX scene build stage and retrieve this data in the IS callback. However, we observed that this approach significantly increased the scene build cost. Instead, we opted to access the global memory directly to retrieve the position of the target particle, which proved to be a more efficient solution. V. PERFORMANCE STUDY This section presents a performance evaluation of the different methods under various configurations. The analysis begins with a description of the experimental setup, including <mark>2D representation when the source and</mark> <mark>target are distant from C in X direction,</mark> <mark>their squares overlap.</mark> 2D representation when the source and target have the same X position, both of their squares overlap. _Vol._ _16,_ _No._ _2,_ _2025_ 2D representation with multiple sources that have their squares intersected with the rays. Fig. 5. Double squares (line) representation of the particles. On the left, we show how the squares can overlap for particles that are too far, but which can be easily filtered with the distance. In the middle, we show how particles that have the same _x_ coordinate can have their squares that overlap. On the right, we show different source particles with their squares and the rays that will intersect with them. 1.0 0.5 0.0 X 0.5 1.0 1.5 2.0 1.0 0.5 0.0 0.5Y 1.0 1.5 2.0 1.0 0.5 0.0 X 0.5 1.0 2.0 1.5 1.0 0.5 Z 0.0 0.5 1.0 X ~~0~~ 0.51.01.52.01.00.5.0 1.0 0.5 0.0 0.5Y 1.0 1.5 2.0 2.0 1.5 1.0 0.5 Z 0.0 0.5 1.0 ~~10~~ 0.50.51.0.0.01.52.0Z _•_ RTX8000 <sup>4</sup> with 48GB GDDR6, 48KB of sharedmemory, 72 multi-processors, 72 RT Cores, 4608 CUDA Cores, maximum Ray casting of 10Giga Rays/sec, max single-precision performance 16.3TFLOPS, and max tensor performance 130.5TFLOPS. Despite the lack of RT cores, the A100 is capable of executing ray tracing kernels, the GPU then use its other units to behave similarly. _2) Software:_ We have implemented the proposed approach in OptiX 8. <sup>5</sup> We use the GNU compiler 11.2.0 and the NVidia CUDA compiler 12.3. The source code is available online. <sup>6</sup> The code was compiled with the following flags: -arch=sm_75 for the RTX8000, -arch=sm_80 for the A100 (and -O3 -DNDEBUG on both). We execute each kernel five times and take the average as reference. We provide in Fig. 8 the 3D rendering of the primitives using ray tracing: in Fig. 8a for the spheres and in Fig. 8b for the squares. These figures were drawn using the OptiX API and ray tracing from camera to the scene. (a) 3D Rendering of sphere primitives. (b) 3D Rendering of square primitives. Fig. 8. 3D Rendering of the primitives using conventional ray tracing. _B._ _Uniform_ _distribution_ In this test case, the particles are distributed uniformly within a unit box. Consequently, there are no (or very few) [4https://www.nvidia.com/content/dam/en-zz/Solutions/design-visualization/](https://www.nvidia.com/content/dam/en-zz/Solutions/design-visualization/quadro-product-literature/quadro-rtx-8000-us-nvidia-946977-r1-web.pdf) [quadro-product-literature/quadro-rtx-8000-us-nvidia-946977-r1-web.pdf](https://www.nvidia.com/content/dam/en-zz/Solutions/design-visualization/quadro-product-literature/quadro-rtx-8000-us-nvidia-946977-r1-web.pdf) [5https://developer.nvidia.com/rtx/ray-tracing/optix](https://developer.nvidia.com/rtx/ray-tracing/optix) [6https://gitlab.inria.fr/bramas/particle-interaction-with-optix](https://gitlab.inria.fr/bramas/particle-interaction-with-optix) 1.5 2.0 1.0 0.5 0.0 0.5Y 1.0 1.5 2.0 Fig. 6. 3D Rectangular representation of a source and target particles. Some rays (thick lines) intersect with the squares. AABB Box Cutoff radius Particle Ray Fig. 7. Custom AABB representation of the particles. The rays cast from the particles’ positions with a infinitesimal length. In the IS callback invoked if a ray enters an AABB, the distance is checked and the interaction between the source and target particles is computed. Self interactions are filtered by ensuring that the source and target are different. the hardware and software used for implementation. Performance is then examined for two types of particle distributions: uniform and non-uniform. Differentiating these distributions allows for assessing the efficiency of grid-based methods like CUDA, which are optimized for uniform distributions but can encounter inefficiencies with sparse or highly localized data in non-uniform scenarios. _A._ _Experimental_ _Setup_ _1) Hardware:_ We have used two NVidia GPUs: _•_ A100 <sup>3</sup> with 40GB hBM2, 48KB of shared-memory, 108 multi-processors, zero RT Cores, 8192 CUDA Cores max single-precision performance 19.5TFLOPS, and max tensor performance 311.84TFLOPS. [3https://www.nvidia.com/content/dam/en-zz/Solutions/Data-Center/a100/](https://www.nvidia.com/content/dam/en-zz/Solutions/Data-Center/a100/pdf/nvidia-a100-datasheet-nvidia-us-2188504-web.pdf) [pdf/nvidia-a100-datasheet-nvidia-us-2188504-web.pdf](https://www.nvidia.com/content/dam/en-zz/Solutions/Data-Center/a100/pdf/nvidia-a100-datasheet-nvidia-us-2188504-web.pdf) <u>Algorithm</u> <u>2:</u> <u>Triangle</u> <u>intersection</u> <u>callback</u> Data: Optix variables Result: Callback when a ray intersect with a triangle 1 Function callback() 2 begin /* Get information on the intersected triangle - <sup>/</sup> 3 _vertices ←_ optixGetTriangleVertexData ( _gas, prim_ _<u>idx, sbtGASIndex,</u>_ 0 _.f, vertices_ ) /* Retreive the source position from the triangle vertices - <sup>/</sup> 4 Declare _q_ as float3 5 _q.y_ _←_ (max( _vertices_ [0] _.y, vertices_ [1] _.y, vertices_ [2] _.y_ )+ min( _vertices_ [0] _.y, vertices_ [1] _.y, vertices_ [2] _.y_ )) _/_ 2 6 _q.z_ _←_ (max( _vertices_ [0] _.z, vertices_ [1] _.z, vertices_ [2] _.z_ )+ min( _vertices_ [0] _.z, vertices_ [1] _.z, vertices_ [2] _.z_ )) _/_ 2 7 _c ←_ getPayloadC() 8 if ( _prim_ _<u>idx</u>_ mod 4) _<_ 2 then 9 _q.x ←_ _vertices_ [0] _.x_ + _c/_ 2 10 else 11 _q.x ←_ _vertices_ [0] _.x −_ _c/_ 2 /* Get target particle position - <sup>/</sup> 12 _point ←_ getPayloadPartPos() /* Compute distance - <sup>/</sup> 13 _dist_ _p_ <u>1</u> _p_ 2 _←_ distance( _point, q_ ) /* Ensure it is not a self intersection and it is in the cutoff distance - <sup>/</sup> 14 if _dist_ _p_ <u>1</u> _p_ 2 _< cANDdist_ _p_ 1 _<u>p</u>_ 2 _> ϵ_ then 15 _ray_ _<u>idx ←</u>_ getPayloadRayidx() 16 _is_ _<u>ray</u>_ _<u>f</u>_ _or_ _compute ←_ ( _point.y̸_ = _q.y_ AND _point.z̸_ = _q.z_ ) 17 OR (( _point.z_ _< q.z_ AND _ray_ _<u>idx</u>_ == 0) OR ( _point.z_ _> q.z_ AND _ray_ _<u>idx</u>_ == 2)) 18 OR (( _point.y_ _< q.y_ AND _ray_ _<u>idx</u>_ == 0) OR ( _point.y_ _> q.y_ AND _ray_ _<u>idx</u>_ == 1)) 19 OR _ray_ _idx_ == 0 20 if _is_ _<u>ray</u>_ _<u>f</u>_ _or_ _compute_ then /* Perform the computation - <sup>/</sup> empty cells in the grid of the CUDA version. The cutoff distance is defined as 1 _/β_, where _β_ can be 2, 4, 8, 16, or 32. For a given _β_, the simulation grid consists of 3 <sup>_β_</sup> cells. The number of particles _N_ is then calculated as _N_ = _p ×_ 3 <sup>_β_</sup>, where _p_ represents the average number of particles per cell, taking values of 1, 2, 4, 8, 16, or 32. All computations are performed in single-precision floating point. We present the results in Fig. 9. For all configurations, we measured the initialization step (light color) and the computation step (dark color). For the OptiX-based implementation, the initialization step involves building the scene by invoking the OptiX API to create the primitives. For the CUDA version, the initialization step involves constructing the grid of cells. Consequently, in _Vol._ _16,_ _No._ _2,_ _2025_ the OptiX-based version, the computation step includes the time spent launching the rays, executing the callback functions, and performing the interactions. In the CUDA version, the computation step corresponds to the kernel time required to compute the interactions. _1) Comparison_ _between_ _triangles_ _and_ _spheres:_ First, we analyze the performance difference between triangles (blue) and spheres (green). On the A100 GPU, both models deliver similar performance, but the ratio of initialization time (light color) to computation time (dark color) is higher for spheres. This indicates that the computation step is more efficient for spheres than for triangles. This suggests that in scenarios where the initialization step is performed only once (e.g. static elements), spheres might be a better choice. However, on the RTX8000, triangles are faster than spheres across all configurations. Although the initialization step for spheres is quicker than for triangles in cases with fewer particles, this trend does not hold for larger configurations. _2) Comparison_ _between_ _custom_ _AABB_ _and_ _built-in_ _prim-_ _itives:_ Next, we compare the Custom AABB method (orange/red) with the built-in primitives (triangles in blue and spheres in green). On the A100, the Custom AABB consistently outperforms the built-in primitives, and its advantage grows as the number of particles or cells increases. For _β_ = 32 (Fig. 9i), the Custom AABB is up to four times faster than the triangle- or sphere-based methods. On the RTX8000, the Custom AABB performs similarly to triangles for small particle counts but becomes faster as the number of particles increases. Overall, the Custom AABB is the fastest method. This demonstrates that creating a custom Intersection Shader (IS) that is significantly simpler and lighter than the builtin ones, which compute actual intersections, can accelerate execution. _3) Benefit_ _of_ _sorting_ _the_ _particles_ _in_ _the_ _custom_ _AABB_ _methods:_ Sorting the particles to position them closer in memory based on their spatial proximity in the simulation is expected to optimize memory accesses. However, sorting the particles also incurs a computational cost. We observe that the strategy without sorting (orange) is faster than the strategy with sorting (red) when there are few particles. However, as the number of particles increases, the benefits of sorting become significant. In our test case, for a given _β_, increasing the number of particles leads to an increase in neighboring particles and, consequently, the number of interactions. In such cases, optimizing memory access becomes critical. _Vol._ _16,_ _No._ _2,_ _2025_ Optix Triangles (compute) <u>Optix TrianN = 8</u> gles (init)N = 16 <u>0.16</u> 5 <u>1e</u> ~~0.10~~ <u>4</u> ~~0.10~~ <u>1e0.094</u> Optix Custom Spheres (compute) <u>Optix Custom SphN = 256</u> eres (init) <u>N = 8</u> 0.28 <u>N = 16384</u> 0.07 <u>1e</u> <u>4</u> Optix Sorted Custom Spheres (compute) <u>Optix SortN = 160.16</u> ed Custom SphN = 320.17 eres (init)N = 64 <u>1e</u> <u>4</u> <u>1e</u> <u>4</u> <u>0.15</u> <u>N = 8</u> 0.28 <u>N = 160.16</u> 0.16 <u>N = 320.17</u> 0.17 <u>N = 64</u> <u>2.08</u> ~~0.14~~ <u>N = 128</u> ~~0.17~~ Pure CUDA (compute) <u>Pure CUDA (init)N = 256</u> <u>N = 256</u> <u>N = 8</u> 0.39 0.86 <u>0.16N = 16</u> 0.36 0.79 <u>N = 32</u> Optix Spheres (compute) <u>Optix Spheres (init)N = 64</u> 0.41 <u>N = 256</u> <u>0.19</u> ~~0.21~~ ~~0.17~~ <u>1e</u> <u>4</u> ~~0.12~~ <u>0.14</u> <u>N = 64</u> <u>1e</u> <u>4</u> 0.28 0.61 <u>1e</u> <u>4</u> 0.71 0.36 <u>1e</u> <u>3</u> 0.39 0.33 <u>1e</u> <u>3</u> 0.07 <mark>5.83</mark> <u>1e</u> <u>2</u> 0.02 <u>2.07</u> ~~0.14~~ <u>1e</u> <u>4</u> 0.12 0.70 <u>1e</u> <u>4</u> 0.31 0.65 <u>1e</u> <u>4</u> 0.27 0.64 <u>1e</u> <u>4</u> 0.11 0.75 <u>1e</u> <u>4</u> 0.25 0.70 <u>1e</u> <u>4</u> 0.22 0.58 <u>1e</u> <u>4</u> 0.21 0.77 <u>1e</u> <u>4</u> 0.35 0.18 0.79 <u>1e</u> <u>3</u> 0.09 0.74 0.17 1.02 1.00 1.00 3.0 2.5 2.0 1.5 1.0 0.5 0.0 3.0 2.5 2.0 1.5 1.0 0.5 0.0 4.0 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 2.00 1.75 1.50 1.25 1.00 0.75 0.50 0.25 0.00 1.0 0.8 0.6 0.4 0.2 0.0 <u>1e</u> <u>4</u> 0.23 1.57 <u>1e</u> <u>4</u> 0.29 0.60 <u>1e</u> <u>4</u> 0.31 0.69 0.43 0.17 0.98 0.13 0.44 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 0.17 0.33 0.15 0.29 0.28 0.29 1.00 1.00 0.85 0.19 0.38 3.0 2.5 2.0 1.5 1.0 0.5 0.0 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 5 4 3 2 1 0 0.37 0.91 0.23 1.80 0.83 0.27 0.89 0.37 0.17 0.16 0.39 0.66 0.20 0.86 0.26 0.17 0.38 0.16 0.85 <u>N = 4096</u> 1.00 <mark>1.00</mark> 0.29 2.49 0.45 0.21 0.20 0.38 1.03 0.31 0.17 0.87 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 5 4 3 2 1 0 6 5 4 3 2 1 0 ~~0.22~~ <u>N = 2048</u> 0.30 0.31 0.26 0.39 0.77 4 3 2 1 0 0.73 <u>N = 65536</u> 0.04 0.23 0.16 0.61 0.16 0.67 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 0.26 0.38 0.69 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 4 3 2 1 0 4 3 2 1 0 0.17 0.24 0.35 0.67 7 6 5 4 3 2 1 0 1.2 1.0 0.8 0.6 0.4 0.2 0.0 1.75 1.50 1.25 1.00 0.75 0.50 0.25 0.00 8 6 4 2 0 7 6 5 4 3 2 1 0 0.71 <u>1e</u> <u>3</u> 0.19 0.66 <u>1e</u> <u>3</u> 0.15 0.64 <u>1e</u> <u>3</u> 0.03 <u><mark>4.43</mark></u> <u>1e</u> <u>2</u> 0.02 <u>2.15</u> <u>1.73</u> 7 6 5 4 3 2 1 0 1.2 1.0 0.8 0.6 0.4 0.2 0.0 3.0 2.5 2.0 1.5 1.0 0.5 0.0 2.0 1.5 1.0 0.5 0.0 4 3 2 1 0 0.32 0.66 <u>1e</u> <u>3</u> 0.73 0.38 <u>1e</u> <u>3</u> 0.20 0.34 <u>1e</u> <u>2</u> 0.04 <u>2.95</u> <u>1e</u> <u>1</u> 0.02 <u>2.09</u> <u>2.19</u> 1.2 1.0 0.8 0.6 0.4 0.2 0.0 2.00 1.75 1.50 1.25 1.00 0.75 0.50 0.25 0.00 5 4 3 2 1 0 1.75 1.50 1.25 1.00 0.75 0.50 0.25 0.00 0.11 0.42 <u>1.85</u> 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 4.0 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 4.0 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 8 6 4 2 0 0.38 2.05 <u>1e</u> <u>4</u> 0.42 0.59 <u>1e</u> <u>4</u> 0.55 0.49 <u>1e</u> <u>3</u> <u>N = 128</u> 0.11 0.17 0.17 0.36 0.45 0.90 <u>N = 1024</u> <u>0.19</u> 0.26 0.29 0.28 0.37 0.85 <u>N = 8192</u> 0.14 (a) A100 _β_ = 2. (b) RTX8000 _β_ = 2. <u>0.31N = 64</u> 1.00 1.00 <u>4</u> <u>N = 640.33</u> 0.23 0.35 0.30 0.45 0.82 0.47 0.24 0.48 <u>N = 1280.37</u> 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 ~~0.25~~ <u>N = 1024</u> <u>0.21N = 2048</u> <u>0.20N = 512</u> <u>N = 5120.32</u> 0.27 <u>1e</u> <u>4</u> <u>0.30N = 256</u> 0.35 0.19 0.36 0.22 0.58 0.48 0.63 <u>0.37</u> <u>0.31</u> ~~0.42~~ <u>0.42</u> <u>0.38</u> ~~0.32~~ <u>N = 128</u> <u>1e</u> <u>4</u> 0.21 0.61 <u>1e</u> <u>4</u> 0.65 0.51 0.33 0.21 0.74 0.33 <u>N = 2048</u> 0.18 0.25 0.28 0.36 0.64 0.34 0.25 0.28 0.31 0.39 0.38 0.24 0.58 0.33 0.43 0.89 0.32 0.22 ~~0.24~~ <u>N = 256</u> 0.34 0.34 0.31 0.35 0.76 0.39 0.31 0.40 8 7 6 5 4 3 2 1 0 5 4 3 2 1 0 0.27 0.37 0.35 0.52 0.39 0.29 0.76 0.35 0.80 0.69 0.26 (c) A100 _β_ = 4. (d) RTX8000 _β_ = 4. <u>N = 5120.38</u> <u>N = 5120.38</u> 1.00 1.00 1.00 1.00 1.00 1.00 ~~0.27~~ <u>N = 1024</u> 1.00 1.00 <u>4</u> <u>N = 5120.39</u> 0.40 ~~0.31~~ <u>N = 16384</u> 0.08 <u>N = 4096</u> <u>0.18</u> 0.39 <u>N = 10240.36</u> ~~0.31~~ <u>N = 20480.39</u> <u>N = 4096</u> ~~0.25~~ <u>0.39</u> <u>0.37</u> 1.00 1.00 1.00 1.00 1.00 1.00 1.00 <u>0.17N = 8192</u> 0.30 0.41 <u>1e</u> <u>3</u> 0.18 0.59 1.00 1.00 1.00 1.00 1.00 1.00 <u>1e</u> <u>4</u> 0.62 0.39 0.35 0.24 0.77 0.30 1.00 1.00 1.00 1.00 1.00 1.00 <u>1e</u> <u>4</u> 0.59 0.38 0.37 0.37 <u>1e</u> <u>3</u> 0.17 0.60 <u>1e</u> <u>3</u> 0.08 <mark>0.61</mark> 0.35 0.29 0.22 0.27 0.25 0.25 0.23 <mark>0.40</mark> 0.32 0.18 0.29 <u>1e</u> <u>4</u> 0.60 0.33 1.00 1.00 0.30 0.30 0.36 0.52 0.25 0.37 0.20 0.78 0.29 0.18 0.36 0.32 0.20 0.54 5 4 3 2 1 0 0.30 1.0 0.8 0.6 0.4 0.2 0.0 0.27 0.65 0.27 0.91 0.21 0.66 0.24 0.45 0.20 <u><mark>0.81</mark></u> 0.26 0.19 (e) A100 _β_ = 8. (f) RTX8000 _β_ = 8. <u>1e</u> <u>3</u> 1.0 0.8 0.6 0.4 0.46 0.2 8.17 0.0 <u>1e</u> <u>3</u> <u>3</u> <u>N = 8192</u> 1.00 1.00 0.38 0.30 0.33 3.00 4.56 9.24 <u>1e</u> <u>3</u> 1.0 0.8 1.75 1.50 1.25 1.00 0.75 0.50 0.25 0.00 <u>N = 65536</u> 0.03 <u>1e</u> <u>2</u> 3.5 0.02 3.0 <u>N = 131072</u> 0.03 <u>N = 131072</u> 0.03 <u>1e</u> <u>3</u> 0.29 19.71 <u>N = 4096</u> 1.00 <mark>1.00</mark> 0.34 0.34 7.57 27.18 <u>N = 8192</u> 1.00 1.00 1.4 <u>1e</u> <u>3</u> <u>0.10N = 16384</u> <u>N = 32768</u> 0.06 0.22 0.20 2.36 <u>1e</u> <u>2</u> 3.5 0.02 1.0 <u>1e</u> <u>3</u> 0.8 0.6 0.28 0.4 <u>N = 16384</u> 1.00 1.00 <u>N = 32768</u> 0.07 <u>1e</u> <u>3</u> 0.06 7.24 <u>1e</u> <u>3</u> 0.15 5.42 3.0 2.5 2.0 1.5 1.0 0.5 0.0 0.29 9.07 0.34 1.98 0.31 0.28 3.17 9.17 4.77 0.21 5.57 8.77 3.23 1.00 0.28 1.00 2.09 4.70 2.5 2.0 1.5 1.0 0.5 0.0 0.15 0.80 <u>6.65</u> <u>4.88</u> 0.28 12.93 0.15 5.10 0.23 11.34 5.65 0.31 1.00 0.22 1.96 9.88 0.36 50.35 <mark>2.9</mark> 0 1 <mark>1.8</mark> 7 3.90 <mark>9.12</mark> <mark>6.33</mark> <mark>3.60</mark> 0.11 <u><mark>6.64</mark></u> <u><mark>2.06</mark></u> 0.13 <u>4.44</u> 0.19 0.36 0.12 <u>10.37</u> 0.16 <mark>1.08</mark> 2 <mark>0.513.8</mark> 6 10.38 <mark>7.4</mark> 3 (g) A100 _β_ = 16. (h) RTX8000 _β_ = 16. <u>N = 32768</u> 1.00 <mark>1.00</mark> <u>1e</u> <u>4</u> 0.23 5.60 1.2 1.0 0.8 0.6 0.4 0.2 0.0 0.15 5.62 1.00 1.00 <mark>1.001.00</mark> <u>N = 524288</u> 0.02 0.04 0.20 <u>N = 1048576</u> 0.01 0.02 0.15 <u>1e</u> <u>3</u> 0.11 6.74 0.27 7.75 <u>N = 262144</u> 0.02 2.00 <u>1e</u> <u>1</u> <u>N = 655360.35</u> <u>0.10</u> 0.29 1.00 1.00 1.29 0.6 0.4 0.2 0.0 2.0 1.5 1.0 0.5 0.0 0.23 8.08 <u>1e</u> <u>3</u> 0.05 5.99 <u>N = 65536</u> 0.06 0.21 0.17 1.04 2.5 <sup><u>1e</u></sup> 0.022 <u>N = 262144</u> 0.03 0.13 0.25 0.31 0.09 4.48 0.02 <u>2.32</u> <u>N = 1048576</u> 0.02 0.06 0.10 <u>N = 32768</u> 1.00 1.00 0.15 0.32 0.31 3.08 4.84 7.60 0.2 0.0 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 <u>1e</u> <u>3</u> 0.07 <mark>5.16</mark> <u>N = 131072</u> 0.06 0.30 0.21 0.60 0.27 9.53 0.78 1.00 1.00 4.09 1.00 1.00 1.2 1.0 0.8 0.6 0.4 0.2 0.0 7 6 5 4 3 2 1 0 0.11 7.93 <u>1e</u> <u>3</u> 0.03 <mark>3.67</mark> <u>N = 131072</u> 0.04 0.18 0.15 0.59 3.41 1.75 1.50 1.25 1.00 0.75 0.50 0.25 0.00 <u>1e</u> <u>2</u> 0.03 <u><mark>1.94</mark></u> 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 <mark>1.001.00</mark> <u>N = 524288</u> 0.02 0.07 0.10 0.12 0.45 4.89 2.0 1.5 1.0 0.5 0.0 5 4 3 2 1 0 6 5 4 3 2 1 0 1.0 0.8 0.6 0.4 0.2 0.0 6 5 4 3 2 1 0 8 6 4 2 0 <mark>7.29</mark> <mark>2.92</mark> <u><mark>2.31</mark></u> <u><mark>5.62</mark></u> 1.00 1.00 1.00 1.00 1.00 1.00 1.00 <mark>1.00</mark> <mark>1.001.00</mark> 1.00 1.00 1.00 1.00 1.00 1.00 1.00 <mark>1.00</mark> <mark>1.001.00</mark> <u><mark>2.41</mark></u> <u>3.52</u> 1.00 1.00 1.00 <mark>1.00</mark> 1.00 <u><mark>1.00</mark></u> <mark>1.001.00</mark> <mark>1.001.00</mark> <u><mark>2.59</mark></u> 0.10 <u>4.14</u> 1.00 1.00 1.00 1.00 1.00 <mark>1.00</mark> 1.00 <u><mark>1.00</mark></u> <u><mark>1.001.00</mark></u> <u>3.05</u> <u>3.96</u> <u><mark>0.29</mark></u> <u>3.15</u> <mark>0.22</mark> <u><mark>0.22</mark></u> <u>3.07</u> <u>0.14</u> (i) A100 _β_ = 32. (j) RTX8000 _β_ = 32. Fig. 9. Performance results for the two GPUs for our approaches (OptiX spheres, OptiX triangles, and Custom AABB without and with sort) and the pure CUDA implementation that use a grid of cells (CUDA). _β_ is the divisor coefficient of the simulation box. The cutoff distance is 1 _/β_ and there are _β_ <sup>3</sup> cells in the grid in the Cuda version. The speedup against the CUDA version is shown above the bars for both the build and compute steps. _Vol._ _16,_ _No._ _2,_ _2025_ Optix Triangles (compute) <u>Optix TrianN = 512</u> gles (init)N = 1024 <u>1e</u> <u>4</u> 7 6 5 4 3 2 1.62 0.59 <u>N = 2048</u> <u>N = 8192</u> 0.20 <u>1e</u> <u>3</u> <u>N = 8192</u> <u>1e</u> <u>3</u> <u>N = 16384</u> <u>1e</u> <u>4</u> <u>N = 1024</u> ~~0.27~~ 1.2 <u>1e</u> <u>3</u> <u>N = 4096</u> <u>1e</u> <u>3</u> Optix Custom Spheres (compute) <u>Optix Custom SphN = 16384</u> eres (init) <u>N = 512</u> <u>N = 16384</u> <u>1e</u> <u>4</u> Optix Sorted Custom Spheres (compute) <u>Optix SortN = 1024</u> ed Custom SphN = 2048 eres (init)N = 4096 <u>N = 10240.41</u> <u>0.41</u> <u>N = 5120.40</u> <u>0.40</u> 0.39 0.20 0.67 Pure CUDA (compute) <u>Pure CUDA (init)N = 16384</u> <u>N = 512</u> 0.43 0.42 0.87 Optix Spheres (compute) <u>Optix Spheres (init)N = 4096</u> <u>1e</u> <u>3</u> <u>1e</u> <u>4</u> <u>N = 20480.40</u> ~~0.28~~ <u>1e</u> <u>4</u> <u>N = 4096</u> <u>0.23</u> 0.49 0.32 <u>0.40</u> 4.0 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 1.00 <u>1e</u> <u>4</u> 0.90 0.69 ~~0.35~~ 1.80 <u>0.40</u> 0.17 ~~0.29~~ 0.32 0.27 <u>3</u> <u>N = 4096</u> 6.76 2.14 0.23 0.43 2.0 1.5 1.0 0.5 0.0 0.36 4.200.68 0.42 0.82 1.10 0.67 0.44 0.29 1.00 1.00 1.00 0.12 1.00 1.00 <u>1e</u> <u>4</u> 0.94 0.34 1.00 1.00 2.43 0.61 0.20 0.17 1.00 1.00 0.43 1.00 0.25 1.00 1.00 1.00 1.00 0.37 0.28 0.44 0.23 1.00 <mark>1.00</mark> 1.00 1.00 1.00 8 7 6 5 4 3 2 1 0 0.35 0.19 1.00 <mark>1.00</mark> 1.00 1.00 1.00 0.38 0.70 1.6 1.4 1.2 1.0 0.8 0.6 0.4 0.2 0.0 0.31 3.88 0.25 <mark>0.44</mark> 0.56 5 4 3 2 1 0 1.00 0.42 0.79 0.44 0.47 0.87 7 6 5 4 3 2 1 0 0.65 1.00 5.42 0.44 0.26 0.79 0.39 0.26 1.0 0.8 0.6 0.4 0.2 0.0 0.39 0.69 2.19 0.42 5 4 3 2 1 0 1.26 0.62 4.0 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 1.00 1.00 1.00 1.00 0.42 0.33 0.71 7 0.12 6 5 4 3 2 1 0 <mark>8.440.66</mark> <mark>0.45</mark> 1.00 0.10 0.01 1.00 0.10 0.01 0.00 1.00 0.10 0.01 0.00 0.00 <u>1e</u> <u>1N = 1048576</u> 0.03 0.10 0.19 34.06 <u>N = 8388608</u> 0.02 0.03 0.17 <u>147.22</u> 0.37 0.45 0.16 <u><mark>0.89</mark></u> 1.00 0.09 5 4 3 2 1 0 <mark>7.630.61</mark> 0.25 1.00 <sup><u>1e1</u></sup> <u>N = 83886080.01</u> 0.01 0.10 0.16 0.01 0.00 0.00 <u>213.46</u> 0.34 0.31 0.11 <u><mark>0.64</mark></u> 0.40 0.87 0.33 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 1.00 1.00 1.00 0.10 1.00 (a) A100 _α_ = 8. (b) RTX8000 _α_ = 8. <u>1e</u> <u>3</u> <u>N = 4096</u> 1.00 1.00 1.00 <u>1e</u> <u>3</u> <u>3</u> <u>N = 8192</u> <u>1e</u> <u>3N = 16384</u> <u>1e</u> <u>3N = 32768</u> 0.26 <u>1e</u> <u>2</u> <u>2N = 65536</u> <u>1e</u> <u>2N = 131072</u> 0.05 <u>1e</u> <u>3</u> 6 × 10 4 4 × 10 4 3 × 10 4 2 × 10 4 1.00 <u>1e</u> <u>3</u> <u>N = 8192</u> <u>1e</u> <u>3N = 16384</u> <u>1e</u> <u>3N = 32768</u> 0.30 <u>1e</u> <u>2</u> <u>2N = 65536</u> <u>1e</u> <u>2N = 131072</u> 0.04 1.00 1.71 0.16 0.60 0.70 <u>1</u> <u>N = 524288</u> 0.03 0.15 0.21 0.08 0.91 1.00 5.31 1.00 <u><mark>1.00</mark></u> 1.00 1.00 1.00 1.00 1.60 1.00 <u><mark>1.00</mark></u> 1.00 1.00 1.00 1.00 1.00 0.10 ~~1~~ 0.19 0.23 0.31 1.00 1.39 1.68 5.18 <u>1e</u> <u>1N = 1048576</u> 0.01 0.02 1.00 0.17 0.10 0.01 32.25 1.00 0.10 0.18 0.24 1.00 0.10 1.01 0.94 1.00 2.08 1.00 5.17 1.07 1.00 1.24 2.33 6 × 10 4 4 × 10 4 3 × 10 4 2 × 10 4 1.00 4.65 ~~1~~ 0.54 4.45 1.00 6 × 10 4 4 × 10 4 3 × 10 4 2 × 10 4 1.00 10.20 4.84 <u>1e</u> <u>3</u> 5.15 (c) A100 _α_ = 16 (Log.). (d) RTX8000 _α_ = 16 (Log.). 0.39 0.41 <u>1</u> <u>N = 524288</u> 0.02 0.05 0.21 14.71 6 × 10 4 4 × 10 4 3 × 10 4 15.04 <u>N = 32768</u> 1.34 1.87 3.11 6.76 <u>N = 32768</u> 0.91 1.52 2.41 5.22 <u>1e</u> <u>3</u> 4.53 1.00 1.00 1.00 1.00 6 × 10 4 4 × 10 4 3 × 10 4 2 × 10 4 <u>1e</u> <u>3</u> 4.82 <u>2</u> <u>N = 262144</u> 0.04 0.22 0.25 <u>2</u> <u>N = 262144</u> 0.04 0.20 0.28 1.00 3.39 <u>N = 65536</u> 0.49 0.81 1.63 1.00 <u>N = 131072</u> 0.14 0.48 0.57 1.00 2.51 <u>N = 65536</u> 0.36 0.70 1.10 1.00 <u>N = 131072</u> 0.11 0.46 0.41 <u>1e</u> <u>3</u> 4.15 1.00 1.00 <u>1e</u> <u>3</u> 4.21 1.00 1.00 0.10 <u>1e</u> <u>2</u> 5.53 1.00 0.10 <u>1e</u> <u>2</u> 5.06 4.56 <u>1e</u> <u>1</u> 12.97 9.88 1.00 <u>1e</u> <u>1</u> 0.10 0.01 11.95 1.00 0.10 0.01 1.00 0.10 0.01 0.00 1.00 4.81 2 × 10 4 4.45 (e) A100 _α_ = 32 (Log.). (f) RTX8000 _α_ = 32 (Log.). <u>101.22</u> 1.04 1.00 <u>N = 1048576</u> 0.03 0.05 0.33 <u>N = 4194304</u> 0.01 0.01 0.16 72.71 <u>N = 2097152</u> 0.02 0.08 0.16 <u>1e</u> <u>2</u> 5.61 <u>1e</u> <u>1</u> 42.32 <u>2</u> <u>N = 524288</u> 0.06 0.29 0.31 <u>1N = 4194304</u> 0.06 0.19 0.41 <u>1e</u> <u>2</u> 8.52 <u>1e</u> <u>1</u> <u>2</u> <u>N = 524288</u> 0.09 0.18 0.49 <u>1N = 4194304</u> 0.11 0.15 <u>N = 2097152</u> 0.01 0.02 0.21 <u>1e</u> <u>1</u> 43.55 <u>N = 33554432</u> 0.02 0.03 0.22 1.00 <u>371.19</u> <u>N = 4194304</u> 0.02 0.04 0.16 <u>1e</u> <u>2</u> 10.12 <u>N = 1048576</u> 0.03 0.14 0.23 1.00 0.10 1.00 0.10 0.01 1.00 1.00 0.10 <u>1e</u> <u>3</u> 5.01 <u>1e</u> <u>2</u> 31.67 <u>3</u> <u>N = 262144</u> 0.33 0.51 0.83 <u>2N = 2097152</u> 0.14 0.54 1.00 1.00 0.10 1.00 0.10 0.01 <u>1e</u> <u>3</u> <u>N = 262144</u> 0.33 0.72 1.10 5.60 <u>1e</u> <u>2N = 2097152</u> 0.39 0.50 2.24 65.76 1.00 1.00 1.00 <u>1e</u> <u>1</u> 0.10 0.01 13.30 1.00 1.00 0.10 1.00 0.10 0.01 1.00 0.10 0.01 0.00 1.00 0.10 0.01 <u>1e</u> <u>1</u> 25.69 1.00 1.00 0.10 0.01 <u>1e</u> <u>1</u> 20.56 1.00 0.10 1.00 0.10 0.01 1.00 1.00 (g) A100 _α_ = 64 (Log.). (h) RTX8000 _α_ = 64 (Log.). <u>1170.22</u> <u>N = 67108864</u> 0.02 0.03 0.20 <u>N = 16777216</u> 0.02 0.02 0.36 ~~3~~ 03.78 <u>1902.20</u> <u>1e1</u> <u>N = 8388608</u> 0.04 0.05 0.52 1.00 <u>147.27</u> 1.00 0.10 0.01 0.00 <u>1e1</u> <u>1e1</u> <u>N = 33554432</u> 0.01 0.01 0.24 1.00 <u>645.56</u> 1.00 0.10 0.01 0.00 0.00 <u>N = 67108864</u> 0.01 0.01 0.19 <u>1e</u> <u>1</u> 64.31 <u>N = 8388608</u> 0.04 0.08 0.23 1.00 0.10 0.01 0.00 0.89 1.00 1.00 1.00 1.00 0.10 0.01 0.00 0.00 1.00 0.10 0.01 0.00 <u>N = 16777216</u> 0.02 0.05 0.23 <u>144.21</u> (i) A100 _α_ = 128 (Log.). (j) RTX8000 _α_ = 128 (Log.). Fig. 10. Performance results for the two GPUs for our approaches (OptiX spheres, OptiX triangles, and Custom AABB without and with sort) and the pure CUDA implementation that use a grid of cells (CUDA). _α_ is the divisor coefficient of the simulation box. The cutoff distance is lower than 1 _/β_ and there are around _α_ <sup>3</sup> non-empty cells in the grid in the Cuda version. The speedup against the CUDA version is shown above the bars for both the build and compute steps, or for the complete run. _4) GPU_ _Performance_ _comparison:_ We then compare the performance of the two GPUs. Results for the A100 are presented in Fig. 9a, 10c, 9e, 9g, and 9i, while results for the RTX8000 are shown in Fig. 9b, 9d, 9f, 9h, and 9j. Both GPUs exhibit comparable performance and a similar initializationto-computation time ratio. Although the A100 is expected to offer higher raw performance, the OptiX implementation is not fully optimized for this GPU, while the RTX8000 benefits from having more RT cores to accelerate computation. Additionally, we do not utilize the tensor cores of the A100, which represent a key differentiator between the two GPUs and could help approach theoretical performance. _5) Comparison_ _between_ _OptiX_ _and_ _CUDA_ _implementa-_ _tions:_ Finally, we compare the OptiX triangles (blue), OptiX spheres (green), Custom AABB (orange), Custom sorted AABB (red), and CUDA implementation (green). The OptiXbased implementation is generally slower than the CUDA implementation for _β_ values from 2 to 8, except in a few cases (e.g. _β_ = 2 and _N_ = 8). In these scenarios, the initialization step in the CUDA implementation is negligible, and the computation step dominates. Consequently, avoiding the grid of cells does not yield a significant advantage. For _β_ = 8 (Fig. 9e and 9f), the CUDA computation step is shorter because the OptiX implementations include not only the interaction computation but also the intersection list computation using rays. Additionally, the memory access pattern in OptiX-based implementations differs, as spatially close particles in memory may not be close in space and may have varying neighbors. For _β_ = 16 and _β_ = 32, the Custom AABB performs better for configurations with few particles per cell (e.g. one or two particles per cell on average in the CUDA version). In these cases, the computation cost is low, and the CUDA version spends most of its time in the initialization step. Furthermore, the CUDA version incurs overhead for empty cells because it constructs a dense grid. For such configurations, the OptiXbased implementations allocate more time to the computation step, making the Custom AABB a suitable choice when the number of particles per cell is low, particularly in scenarios where moving particles require frequent grid rebuilding. _C._ _Non_ _Uniform_ _Distribution_ In this test case, we distribute the particles on the surface of a unit sphere. Consequently, most of the cells on the grid in the CUDA version are empty. With this aim, we use a coefficient _α_, which can be 8, 16, 32, 64 or 128. For a given _α_, the simulation grid consists of approximately 3 <sup>_α_</sup> nonempty cells. The number of particles _N_ is then calculated as _N_ = _p_ _×_ 3 <sup>_α_</sup>, where _p_ represents the average number of particles per cell, taking values of 1, 2, 4, 8, 16, or 32. The cutoff radius is set such that each particle should have approximately 9 _× p_ neighbor particles (it will be in general smaller than 2 _/α_ ). In order to facilitate the reproducibility of our test case, we provide in Appendix, the Code 2 that generates the different configurations. All computations are performed in single-precision floating point. We present the results in Fig. 10. For all configurations, we measured both the initialization step (light color) and the computation step (dark color) for the first configuration. However, for the others, we directly present the total execution _Vol._ _16,_ _No._ _2,_ _2025_ time using a logarithmic scale on the y-axis due to extreme differences. For the OptiX-based implementation, the initialization step involves building the scene by invoking the OptiX API to create the primitives. For the CUDA version, the initialization step involves constructing the grid of cells. Consequently, in the OptiX-based version, the computation step includes the time spent launching the rays, executing the callback functions, and performing the interactions. In the CUDA version, the computation step corresponds to the kernel time required to compute the interactions. _1) OptiX_ _spheres:_ The OptiX spheres method is consistently the slowest (except for _α_ = 2 and a small number of particles). It has a more expensive initialization step compared to the Custom AABB methods and a significantly larger computation step. This is because the built-in IS kernel for spheres is computationally intensive, as it calculates several values, such as the norm of the intersection, that we do not use since we are not rendering an image. _2) Custom_ _AABB_ _without_ _and_ _with_ _sorting:_ For low _α_, sorting does not provide an advantage; it increases the cost of the initialization step too much relative to the gains in the computation step. However, for high _α_ and a large number of particles, sorting the particles results in a performance improvement. This demonstrates that random access to global memory is so costly that the overhead of sorting the particles is worthwhile. The Custom AABB method with sorting performs comparably to the CUDA version. However, the Custom AABB methods are generally slower than both the CUDA version and the OptiX triangles method. _3) OptiX_ _triangles:_ This strategy is the most efficient. For _α_ = 8, its initialization step is comparable in cost to the OptiX spheres and Custom AABB methods. However, its computation step is significantly faster. We attribute this to two primary reasons. First, the built-in IS kernel for triangles is likely much simpler than that for spheres and is probably heavily optimized by NVIDIA, as triangles are the most commonly used primitive in 3D rendering. Second, the AABB bounding boxes around triangles are much smaller than those around spheres or the custom AABB primitives. This enables faster tree traversal and fewer false positives (i.e. cases where a ray intersects a bounding box but not the primitive inside it). Finally, the CUDA version includes several components in its implementation that rely on algorithms with complexity linear in the number of cells. Since the vast majority of these cells are empty, these steps become highly inefficient. This is particularly evident for _α_ = 8, where the initialization step is notably prominent. Moreover, if we were to create a test case with _α_ = 256 (not included in the current study), the GPU would run out of memory for the the CUDA version allocating an excessively large grid. This limitation makes alternative approaches based on a tree structure - such as our OptiXbased methods - the only viable options. VI. CONCLUSION In this paper, we proposed leveraging ray tracing technology to compute particle interactions within a cutoff distance in a 3D environment. We introduced one method that uses custom primitives and a custom Intersection Shader (IS), similar to the state-of-the-art, and two methods that use built-in primitives and actual intersection computations. For the latter, we described geometric algorithms to build the interaction list based on ray intersections with spheres or triangles. Our results indicate that our approach provides a modest advantage in the preprocessing stage by avoiding the construction of a grid of cells. In addition, it is slower than the classical approach during the computation step when dealing with large numbers of uniformly distributed particles. However, when most cells are empty, our approach can provide a significant speedup. Therefore, we believe these methods have the potential to deliver better performance in the future or for specific applications, and we hope our work inspires the community to explore this direction further. As GPU architectures continue to evolve, with advancements such as NVIDIA’s Ada Lovelace architecture featuring third-generation RT cores and AMD’s RDNA 3 architecture incorporating second-generation ray-tracing accelerators, we anticipate that algorithms leveraging these capabilities will become increasingly effective and relevant. Consequently, our approach is prepared to benefit from these hardware improvements, enhancing its performance and applicability in future computational scenarios and we hope our work inspires the community to explore this direction further. We plan to evaluate our approach on other GPUs, such as AMD Radeon, and aim to port our method even in cases where the IS cannot be customized, thanks to our geometric algorithms. In a second step, we will take our best strategy and compare it with state-of-the-art particle interaction solvers that support GPUs. ACKNOWLEDGMENT Experiments presented in this paper were carried out using the PlaFRIM experimental test-bed. REFERENCES [1] C. Kutzner, S. P´all, M. Fechner, A. Esztermann, B. L. de Groot, and H. Grubm¨uller, “More bang for your buck: Improved use of gpu nodes for gromacs 2018,” _Journal_ _of_ _Computational_ _Chemistry_, vol. 40, no. 27, pp. 2418–2431, 2019. [Online]. Available: [https://onlinelibrary.wiley.com/doi/abs/10.1002/jcc.26011](https://onlinelibrary.wiley.com/doi/abs/10.1002/jcc.26011) [2] M. Zubair, D. Ranjan, A. Walden, G. Nastac, E. Nielsen, B. Diskin, M. Paterno, S. Jung, and J. H. Davis, “Efficient gpu implementation of automatic differentiation for computational fluid dynamics,” in _2023_ _IEEE_ _30th_ _International_ _Conference_ _on_ _High_ _Performance_ _Computing,_ _Data,_ _and_ _Analytics_ _(HiPC)_ . IEEE, 2023, pp. 377–386. [3] B. Rybakin and V. Goryachev, “Parallel algorithms for astrophysics problems,” _Lobachevskii Journal of Mathematics_, vol. 39, pp. 562–570, 2018. [4] A. Ilievski, V. Zdraveski, and M. Gusev, “How cuda powers the machine learning revolution,” in _2018_ _26th_ _Telecommunications_ _Forum_ _(TELFOR)_ . IEEE, 2018, pp. 420–425. [5] H. Friedrich, J. G¨unther, A. Dietrich, M. Scherbaum, H.-P. Seidel, and P. Slusallek, “Exploring the use of ray tracing for future games,” in _Proceedings_ _of_ _the_ _2006_ _ACM_ _SIGGRAPH_ _Symposium_ _on_ _Videogames_, 2006, pp. 41–50. [6] NVIDIA, “Nvidia ada gpu architecture,” 2023, version 2.1 https://images.nvidia.com/aem-dam/Solutions/Data-Center/l4/nvidiaada-gpu-architecture-whitepaper-v2.1.pdf. [7] D. Koschier, J. Bender, B. Solenthaler, and M. Teschner, “Smoothed particle hydrodynamics techniques for the physics based simulation of fluids and solids,” _arXiv_ _preprint_ _arXiv:2009.06944_, 2020. _Vol._ _16,_ _No._ _2,_ _2025_ [8] M. S. Badar, S. Shamsi, J. Ahmed, and M. A. Alam, “Molecular dynamics simulations: concept, methods, and applications,” in _Trans-_ _disciplinarity_ . Springer, 2022, pp. 131–151. [9] D. Algis, B. Bramas, E. Darles, and L. Aveneau, “Efficient GPU Implementation of Particle Interactions with Cutoff Radius and Few Particles per Cell,” in _International_ _Symposium_ _on_ _Parallel_ _Computing_ _and_ _Distributed_ _Systems_ _(PCDS2024)_ . Singapore, Singapore: IEEE, Sep. 2024. [Online]. Available: [https://inria.hal.science/hal-04621128](https://inria.hal.science/hal-04621128) [10] G. IGN, “Top 5 Games That Make the Best Use of NVIDIA’s RTX Technologies,” https://www.ign.com/articles/top-5-games-that-makethe-best-use-of-nvidias-rtx-technologies, Dec. 2023. [11] S. G. Parker, J. Bigler, A. Dietrich, H. Friedrich, J. Hoberock, D. Luebke, D. McAllister, M. McGuire, K. Morley, A. Robison, and M. Stich, “Optix: a general purpose ray tracing engine,” _ACM_ _Trans._ _Graph._, vol. 29, no. 4, jul 2010. [Online]. Available: [https://doi.org/10.1145/1778765.1778803](https://doi.org/10.1145/1778765.1778803) [12] P. Shirley, I. Wald, T. Akenine-M¨oller, and E. Haines, “Ray tracing gems: High-quality and real-time rendering with dxr and other apis.” Berkeley, CA: Apress, 2019, ch. What is a Ray?, pp. 15–19. [Online]. Available: [https://doi.org/10.1007/978-1-4842-4427-2](https://doi.org/10.1007/978-1-4842-4427-2_2) <u>2</u> [13] L. Nylons, M. Harris, and J. Prins, “Fast n-body simulation with cuda,” _GPU_ _gems_, vol. 3, pp. 62–66, 2007. [14] V. Garcia, E. Debreuve, and M. Barlaud, “Fast k nearest neighbor search using gpu,” in _2008_ _IEEE_ _Computer_ _Society_ _Conference_ _on_ _Computer_ _Vision_ _and_ _Pattern_ _Recognition_ _Workshops_ . IEEE, 2008, pp. 1–6. [15] N. Moenne-Loccoz, A. Mirzaei, O. Perel, R. de Lutio, J. Martinez Esturo, G. State, S. Fidler, N. Sharp, and Z. Gojcic, “3d gaussian ray tracing: Fast tracing of particle scenes,” vol. 43, no. 6, Nov. 2024. [Online]. Available: [https://doi.org/10.1145/3687934](https://doi.org/10.1145/3687934) [16] L. Lindau, “Hardware accelerated ray tracing of particle systems,” 2020. [17] S. Blyth, “Opticks: Gpu optical photon simulation for particle physics using nvidia® optixtm,” in _EPJ_ _Web_ _of_ _Conferences_, vol. 214. EDP Sciences, 2019, p. 02027. [18] ——, “Integration of juno simulation framework with opticks: Gpu accelerated optical propagation via nvidia® optix™,” in _EPJ_ _Web_ _of_ _Conferences_, vol. 251. EDP Sciences, 2021, p. 03009. [19] A. Keksel, S. Schmidt, D. Beck, and J. Seewig, “Scientific modeling of optical 3d measuring devices based on gpu-accelerated ray tracing using the nvidia optix engine,” in _Modeling_ _Aspects_ _in_ _Optical_ _Metrology_ _IX_, vol. 12619. SPIE, 2023, pp. 117–125. [20] I. Evangelou, G. Papaioannou, K. Vardis, and A. A. Vasilakis, “Fast radius search exploiting ray tracing frameworks,” _Journal_ _of_ _Computer_ _Graphics_ _Techniques_ _(JCGT)_, vol. 10, no. 1, pp. 25–48, February 2021. [Online]. Available: [http://jcgt.org/published/0010/01/02/](http://jcgt.org/published/0010/01/02/) [21] Y. Zhu, “Rtnn: accelerating neighbor search using hardware ray tracing,” in _Proceedings_ _of_ _the_ _27th_ _ACM_ _SIGPLAN_ _Symposium_ _on_ _Principles_ _and_ _Practice_ _of_ _Parallel_ _Programming_, ser. PPoPP ’22. New York, NY, USA: Association for Computing Machinery, 2022, p. 76–89. [Online]. Available: [https://doi.org/10.1145/3503221.3508409](https://doi.org/10.1145/3503221.3508409) [22] S. Zhao, Z. Lai, and J. Zhao, “Leveraging ray tracing cores for particlebased simulations on gpus,” _International_ _Journal_ _for_ _Numerical_ _Methods_ _in_ _Engineering_, vol. 124, no. 3, pp. 696–713, 2023. [Online]. Available: [https://onlinelibrary.wiley.com/doi/abs/10.1002/nme.7139](https://onlinelibrary.wiley.com/doi/abs/10.1002/nme.7139) APPENDICES A. DISCUSSION ON THE SPHERE MODEL The filtering algorithm presented in Section IV-B is based on the assumption that there is always at least one ray that is intersected once by the sphere and that it is the closest one to the center of the sphere. The following section is dedicated to demonstrating this hypothesis. In Fig. 11, we show the different possibilities depending on the radius _r_ and ray’s length _l_ . As it can be seen, even if the sources located at a distance of _C_ from the target could have their spheres that intersect with the rays when _r_ _> l_, we must set _l_ = _r_ to ensure that the rays will intersect with the sphere in all cases, especially when the source and target are close. For the clarity of the proof, a demonstration is first provided in the plane, followed by a generalization to R <sup>3</sup> . _1) 2D_ _Case:_ Let us consider a cercle of radius _r_ centered at ( _xc, yc_ ), and a cross <sup>7</sup> centered at the origin with a length of _r_ . We consider the cases where the cercle is located in the first quarter, i.e., 0 _≤_ _xs_ _≤_ _r_ and 0 _≤_ _ys_ _≤_ _r_, but the demonstration remains valid for other quarters. The equation of a cercle is given by: ( _x −_ _xc_ ) <sup>2</sup> + ( _y −_ _yc_ ) <sup>2</sup> = _r_ <sup>2</sup> _._ (1) The coordinates of the intersection points of the cercle with the axis are given by: _Vol._ _16,_ _No._ _2,_ _2025_ For our definition range of _yc_ _∈_ [0 _, r_ ], this equation has no solution (see Fig. 13), which confirms that _C_ will always intersect with the cross at most once for _ex_ or _ey_ . 7That is, two orthogonal axis-aligned segments of the same size intersecting at their respective centers. The second statement is to show that the ray that is intersected once is the closest to the center of the sphere. Lemma 2. _Given_ _a_ _circle_ _C_ _and_ _e_ _one_ _of_ _the_ _two_ _segments_ _of_ _the_ _cross_ _of_ _length_ _less_ _than_ _r,_ _such_ _as_ _the_ _number_ _of_ _intersection_ _of_ _C_ _with_ _e_ _is_ _equal_ _to_ 1 _,_ _then_ _the_ _distance_ _of_ _e_ _with_ _C_ _is_ _smaller_ _than_ _the_ _distance_ _of_ _the_ _other_ _bar_ _to_ _C._ Proof: Consider that _C_ intersects with _ey_ twice <u>and</u> _ex_ once, it means that _<u>y</u>_ 1 _< r_ and _x_ 1 _> r_, i.e. _yc_ +� _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ _< r_ once, it means that _<u>y</u>_ 1 _< r_ and _x_ 1 _> r_, i.e. _yc_ +� _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ _< r_ and _xc_ + ~~�~~ _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _> r_ . ~~�~~ _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _> r_ . We aim to demonstrate that the inequality _x_ 0 = _xc −_ - _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> and _x_ 1 = _xc_ + ~~�~~ _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _y_ 0 = _yc −_ - _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c._ and _y_ 1 = _yc_ + ~~�~~ _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ ~~�~~ _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c._ _x_ 0 = _xc −_ - _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> and _x_ 1 = _xc_ + - _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c._ and _y_ 1 = _yc_ + - _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _< xc_ + _yc_ + (2) We provide the Fig. 12 that shows where these points are located on the sphere and the cross. _x_ 0 and _y_ 0 are the coordinates of the intersection points of the cercle that remain on the cross as the cercle get away from the origin. On the other hand, _x_ 1 and _y_ 1 are the coordinates of the intersection points of the cercle that are the farthest from the origin of the cross and that can potentially be too far to remain on the cross (they will be on the corresponding axis but behind _l_ ). Lemma 1. _Given_ _a_ _circle_ _C_ _and_ _let_ _ex_ _and_ _ey_ _be_ _the_ _two_ _segments_ _of_ _the_ _cross_ _of_ _length_ _less_ _than_ _r,_ _then_ _the_ _number_ _of_ _intersections_ _of_ _C_ _with_ _ex_ _or_ _with_ _ey_ _is_ _strictly_ _less_ _than_ 2 _._ Proof: As we consider that it is impossible that both _x_ 1 and _y_ 1 exist at the same time, we consider that these two equations cannot be true at the same time holds if and only if _xc_ _> yc_ . We start with the inequality: - _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ (6) - _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c._ (7) _yc_ + ~~�~~ _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _< xc_ + Subtracting _yc_ from both sides, we obtain: - _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _< xc −_ _yc_ + We can further simplify this to: - _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c._ (8) - _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _−_ ~~�~~ _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ _< xc −_ _yc._ (9) ~~�~~ _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ _≤_ _r._ (3) <u>The</u> <u>inequality</u> now compares two quantities: - _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _−_ ~~�~~ _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ and _xc −_ _yc_ . _•_ The term - _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> represents the horizontal distance from the point ( _xc, yc_ ) to the vertical axis. _•_ The term - _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ represents the vertical distance from the point ( _xc, yc_ ) to the horizontal axis. Let’s consider the case where _xc_ _> yc_ : _•_ If _xc_ _> yc_, then _xc −_ _yc_ _>_ 0. _xc_ + ~~�~~ _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _≤_ _r_ and _yc_ + Which can be simplified as - _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ _≤_ _r −_ _yc_ _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ <sup>_≤_</sup> <sup>_r_</sup> <sup>2</sup> <sup>_−_</sup> <sup>2</sup> <sup>_ry_</sup> <sup>2</sup> _c_ <sup>_≤_</sup> <sup>_r_</sup> <sup>2</sup> <sup>_−_</sup> <sup>2</sup> <sup>_ryc_</sup> <sup>+</sup> <sup>_y_</sup> _c_ <sup>2</sup> _xc_ _< r −_ ~~�~~ _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> and (4) _c_ _x_ <sup>2</sup> _c_ <sup>_>_</sup> <sup>2</sup> <sup>_ryc_</sup> <sup>_−_</sup> <sup>_y_</sup> _c_ <sup>2</sup> - _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _>_ _•_ Additionally, Additionally, - _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _>_ - _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ because _yc_ _<_ _xc_ . <sup>2</sup> _c_ <sup>_>_</sup> <sup>2</sup> <sup>_ryc_</sup> <sup>_−_</sup> <sup>_y_</sup> _c_ <sup>2</sup> _c_ _xc_ _>_ �2 _ryc −_ �2 _ryc −_ _yc_ <sup>2</sup> _,_ This implies that the term ~~�~~ _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _−_ ending up with ~~�~~ 2 _ryc −_ _yc_ <sup>2</sup> _< r −_ - _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _._ (5) This implies that the term ~~�~~ _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _−_ ~~�~~ _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ is pos itive, and it is less than _xc_ _−_ _yc_, proving that the inequality holds under this condition. Thus, for the inequality _yc_ + - _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _< xc_ + - _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ to hold, it is necessary that _xc_ _>_ _yc_ . So, the _x_ axis is the closest axis to the center of the sphere and is intersected once. Thus, for the inequality _yc_ + - _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _< xc_ + If r > l, the sphere might not intersect with the rays, even if the source and target a closer than the cutoff distance If l > r, the sphere might intersect twice with all rays, leading to difficulty to filter _Vol._ _16,_ _No._ _2,_ _2025_ If r == l, the sphere cannot englobe the rays and there is always a ray that is intersected only once. Fig. 11. 2D Spherical representation of the particles in three different cases with _r_ _> l_, _l_ _> r_ and _r_ == _l_ . x0 x0 x1 y0 <u>x0</u> y0 <u>x0</u> y0 y0 Fig. 12. 2D spherical representation illustrating the classification of intersection points between the sphere and the cross. _•_ Intersection with the _y_ -axis (set _x_ = 0 and _z_ = 0): - _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ _−_ _zc_ <sup>2</sup> (12) 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.0 _y_ = _yc ±_ _•_ Intersection with the _z_ -axis (set _x_ = 0 and _y_ = 0): _z_ = _zc ±_ ~~�~~ _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ _−_ _yc_ <sup>2</sup> (13) Let’s denote the intersection points on the positive half of the axes as: ~~�~~ _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _−_ _zc_ <sup>2</sup> - _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ _−_ _zc_ <sup>2</sup> - _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ _−_ _yc_ <sup>2</sup> 0.0 0.2 0.4 0.6 0.8 1.0 yc _•_ _x_ 1 = _xc_ + _•_ _y_ 1 = _yc_ + _•_ _z_ 1 = _zc_ + Fig. 13. Plot of the equation ~~�~~ 2 _ryc −_ _yc_ <sup>2</sup> _−_ _r_ + ~~�~~ _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup>, for r = 1. _2) 3D Case:_ To convert this proof from 2D to 3D, we need to extend the concepts from the circle and cross to a sphere and a three dimensional cross. <sup>8</sup> Consider a sphere with radius _r_ centered at ( _xc, yc, zc_ ) in 3D space, and a cross (or coordinate axes) centered at the origin with each axis extending from _−l_ to _l_ . We are interested in analyzing the intersection of the sphere with the axes, focusing particularly on the first octant where 0 _≤_ _xc_ _≤_ _l_, 0 _≤_ _yc_ _≤_ _l_, and 0 _≤_ _zc_ _≤_ _l_ . The equation of the sphere is given by: ( _x −_ _xc_ ) <sup>2</sup> + ( _y −_ _yc_ ) <sup>2</sup> + ( _z −_ _zc_ ) <sup>2</sup> = _r_ <sup>2</sup> _._ (10) The coordinates of the intersection points of the sphere with the axes are found by setting two of the coordinates to zero in the sphere’s equation: _•_ Intersection with the _x_ -axis (set _y_ = 0 and _z_ = 0): We need to analyze whether these points lie within the bounds of the cross, i.e. whether _x_ 1 _≤_ _l_, _y_ 1 _≤_ _l_, and _z_ 1 _≤_ _l_ . Assume that one of these coordinates, say _x_ 1, exceeds _l_ . This would mean that the intersection does not lie on the cross, i.e. _xc_ + ~~�~~ _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _−_ _zc_ <sup>2</sup> _> l_ . Similarly, for _y_ 1 and _z_ 1, we require that: ~~�~~ _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ _−_ _yc_ <sup>2</sup> _> l._ (14) _yc_ + - _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ _−_ _zc_ <sup>2</sup> _> l_ or _zc_ + These conditions cannot all be true simultaneously for _xc_, _yc_, and _zc_ within the defined range, similar to the 2D case. Thus, a sphere will intersect the cross at most once per axis. Next, we determine the axis closest to the sphere’s center. If _xc_ _> yc_ _> zc_, we aim to prove that the intersection on the _x_ -axis occurs first (i.e. is the smallest). Starting with: _xc_ + - _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _−_ _zc_ <sup>2</sup> _< yc_ + - _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ _−_ _zc_ <sup>2</sup> and _xc_ + ~~�~~ _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _−_ _zc_ <sup>2</sup> _< zc_ + ~~�~~ _r_ <sup>2</sup> _−_ _x_ - _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _−_ _zc_ <sup>2</sup> _< yc_ + _x_ = _xc ±_ - _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _−_ _zc_ <sup>2</sup> (11) _xc_ + ~~�~~ _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ _−_ _yc_ <sup>2</sup> _._ (15) 8That is, three axis aligned orthogonal segments of the same size intersecting at their respective centers. ~~�~~ _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _−_ _zc_ <sup>2</sup> _< zc_ + These can be simplified, following similar steps as in the 2D case: - _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _−_ _zc_ <sup>2</sup> _−_ ~~�~~ _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ _−_ _zc_ <sup>2</sup> _< yc −_ _xc_ and ~~�~~ _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _−_ _zc_ <sup>2</sup> _−_ - _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ _−_ _yc_ <sup>2</sup> _< z_ - _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _−_ _zc_ <sup>2</sup> _−_ _Vol._ _16,_ _No._ _2,_ _2025_ 22 <mark>vertices.push_back(corners[4]);</mark> 23 <mark>vertices.push_back(corners[6]);</mark> 24 <mark>vertices.push_back(corners[7]);</mark> 25 <mark>}</mark> 26 Code 1: Triangles generation from particles’s positions. C. GENERATION OF PARTICLES ON A SPHERE 1 <mark>const</mark> <mark>int</mark> <mark>MaxParticlesPerCell</mark> <mark>=</mark> <mark>32;</mark> 2 <mark>const</mark> <mark>int</mark> <mark>MaxBoxDiv</mark> <mark>=</mark> <mark>128;</mark> 3 <mark>for</mark> <mark>(</mark> <mark>int</mark> <mark>boxDiv</mark> <mark>=</mark> <mark>2</mark> <mark>;</mark> <mark>boxDiv</mark> <mark><=</mark> <mark>MaxBoxDiv</mark> <mark>;</mark> <mark>boxDiv</mark> <mark>*=</mark> <mark>2){</mark> 4 <mark>const</mark> <mark>int</mark> <mark>nbBoxes</mark> <mark>=</mark> <mark>boxDiv*boxDiv*boxDiv;</mark> 5 <mark>for</mark> <mark>(</mark> <mark>int</mark> <mark>nbParticles</mark> <mark>=</mark> <mark>nbBoxes</mark> <mark>;</mark> <mark>nbParticles</mark> <mark><=</mark> <mark>...</mark> <mark>nbBoxes*MaxParticlesPerCell</mark> <mark>;</mark> <mark>nbParticles</mark> <mark>*=</mark> <mark>2){</mark> 6 <mark>const</mark> <mark>double</mark> <mark>particlePerCell</mark> <mark>=</mark> <mark>...</mark> <mark>double</mark> <mark>(nbParticles)/</mark> <mark>double</mark> <mark>(nbBoxes);</mark> 7 <mark>const</mark> <mark>double</mark> <mark>expectedNbNeighbors</mark> <mark>=</mark> <mark>9*particlePerCell;</mark> 8 <mark>const</mark> <mark>double</mark> <mark>coef</mark> <mark>=</mark> <mark>1.</mark> <mark>-</mark> <mark>...</mark> <mark>((2*expectedNbNeighbors)/nbParticles);</mark> 9 <mark>const</mark> <mark>double</mark> <mark>validCoef</mark> <mark>=</mark> <mark>std::min(1.0,</mark> <mark>std::max(-1.0,</mark> <mark>coef));</mark> 10 <mark>const</mark> <mark>double</mark> <mark>sphereRadius</mark> <mark>=</mark> <mark>acos(validCoef);</mark> 11 12 <mark>//</mark> <mark>The</mark> <mark>following</mark> <mark>is</mark> <mark>only</mark> <mark>used</mark> <mark>if</mark> <mark>we</mark> <mark>need</mark> <mark>to</mark> <mark>build</mark> <mark>a</mark> <mark>grid</mark> <mark>...</mark> <mark>of</mark> <mark>cell</mark> 13 <mark>const</mark> <mark>float</mark> <mark>boxWidth</mark> <mark>=</mark> <mark>std::ceil(2.0</mark> <mark>/</mark> <mark>sphereRadius)</mark> <mark>*</mark> <mark>...</mark> <mark>sphereRadius;</mark> 14 <mark>const</mark> <mark>int</mark> <mark>gridDim</mark> <mark>=</mark> <mark>boxWidth/sphereRadius;</mark> 15 <mark>const</mark> <mark>float</mark> <mark>cellWidth</mark> <mark>=</mark> <mark>boxWidth/gridDim;</mark> 16 <mark>......</mark> 17 18 <mark>auto</mark> <mark>generateRandomParticle()</mark> <mark>{</mark> 19 <mark>double</mark> <mark>theta</mark> <mark>=</mark> <mark>2.0</mark> <mark>*</mark> <mark>M_PI</mark> <mark>*</mark> <mark>((</mark> <mark>double</mark> <mark>)rand()</mark> <mark>/</mark> <mark>RAND_MAX);</mark> <mark>//</mark> <mark>...</mark> <mark>Random</mark> <mark>angle</mark> <mark>between</mark> <mark>0</mark> <mark>and</mark> <mark>2PI</mark> 20 <mark>double</mark> <mark>phi</mark> <mark>=</mark> <mark>acos(1.0</mark> <mark>-</mark> <mark>2.0</mark> <mark>*</mark> <mark>((</mark> <mark>double</mark> <mark>)rand()</mark> <mark>/</mark> <mark>RAND_MAX));</mark> <mark>...</mark> <mark>//</mark> <mark>Random</mark> <mark>angle</mark> <mark>between</mark> <mark>0</mark> <mark>and</mark> <mark>PI</mark> 21 22 <mark>//</mark> <mark>Convert</mark> <mark>spherical</mark> <mark>coordinates</mark> <mark>to</mark> <mark>Cartesian</mark> <mark>coordinates</mark> 23 <mark>double</mark> <mark>x</mark> <mark>=</mark> <mark>sin(phi)</mark> <mark>*</mark> <mark>cos(theta);</mark> 24 <mark>double</mark> <mark>y</mark> <mark>=</mark> <mark>sin(phi)</mark> <mark>*</mark> <mark>sin(theta);</mark> 25 <mark>double</mark> <mark>z</mark> <mark>=</mark> <mark>cos(phi);</mark> 26 27 <mark>return</mark> <mark>Particle{x,</mark> <mark>y,</mark> <mark>z};</mark> 28 <mark>}</mark> 29 Code 2: Non-uniform test case generation. ~~�~~ _r_ <sup>2</sup> _−_ _yc_ <sup>2</sup> _−_ _zc_ <sup>2</sup> _−_ - _r_ <sup>2</sup> _−_ _x_ <sup>2</sup> _c_ _−_ _yc_ <sup>2</sup> _< zc −_ _xc._ (16) The argument follows that since _xc_ _>_ _yc_ _>_ _zc_, the inequalities hold true, confirming that the _x_ -axis is the closest, and thus it is intersected first. The 3D extension of the proof shows that a sphere intersects each axis of a coordinate cross at most once, and the axis closest to the sphere’s center (in the order of _xc_ _>_ _yc_ _>_ _zc_ ) will have the intersection point closest to the origin. B. CONVERSION FROM PARTICLES’ POSITIONS TO TRIANGLES 1 <mark>for</mark> <mark>(</mark> <mark>int</mark> <mark>i</mark> <mark>=</mark> <mark>0;</mark> <mark>i</mark> <mark><</mark> <mark>nbPoints;</mark> <mark>i++)</mark> 2 <mark>{</mark> 3 <mark>const</mark> <mark>float3</mark> <mark>point</mark> <mark>=</mark> <mark>points[i];</mark> 4 <mark>std::array<float3,</mark> <mark>8></mark> <mark>corners;</mark> 5 <mark>for</mark> <mark>(</mark> <mark>int</mark> <mark>idxCorner</mark> <mark>=</mark> <mark>0</mark> <mark>;</mark> <mark>idxCorner</mark> <mark><</mark> <mark>8</mark> <mark>;</mark> <mark>++idxCorner){</mark> 6 <mark>corners[idxCorner].z</mark> <mark>=</mark> <mark>point.z</mark> <mark>+</mark> <mark>(idxCorner&1</mark> <mark>?</mark> <mark>...</mark> <mark>(cutoffRadius/2)+epsilon</mark> <mark>:</mark> <mark>(-cutoffRadius/2)-epsilon</mark> <mark>);</mark> 7 <mark>corners[idxCorner].y</mark> <mark>=</mark> <mark>point.y</mark> <mark>+</mark> <mark>(idxCorner&2</mark> <mark>?</mark> <mark>...</mark> <mark>(cutoffRadius/2)+epsilon</mark> <mark>:</mark> <mark>(-cutoffRadius/2)-epsilon</mark> <mark>);</mark> 8 <mark>corners[idxCorner].x</mark> <mark>=</mark> <mark>point.x</mark> <mark>+</mark> <mark>(idxCorner&4</mark> <mark>?</mark> <mark>...</mark> <mark>cutoffRadius/2</mark> <mark>:</mark> <mark>-cutoffRadius/2</mark> <mark>);</mark> 9 <mark>}</mark> 10 <mark>vertices.push_back(corners[0]);</mark> 11 <mark>vertices.push_back(corners[1]);</mark> 12 <mark>vertices.push_back(corners[3]);</mark> 13 14 <mark>vertices.push_back(corners[0]);</mark> 15 <mark>vertices.push_back(corners[2]);</mark> 16 <mark>vertices.push_back(corners[3]);</mark> 17 18 <mark>vertices.push_back(corners[4]);</mark> 19 <mark>vertices.push_back(corners[5]);</mark> 20 <mark>vertices.push_back(corners[7]);</mark> 21

섹션 본문 147문단 · 51,148자

(제목 없음)

1Particle interaction simulation is a fundamental method of scientific computing that require high-performance solutions.In this context, computing on graphics processing units (GPUs) has become standard due to the significant performance gains over conventional CPUs.However, since GPUs were originally designed for 3D rendering, they still retain several features that are not fully exploited in scientific computing.One such feature is ray tracing, a powerful technique for rendering 3D scenes.In this paper, we propose exploiting ray tracing technology via OptiX and CUDA to compute particle interactions with a cutoff distance in a 3D environment on GPUs.To this end, we describe algorithmic techniques and geometric patterns for efficiently determining the interaction lists for each particle.Our approach enables the computation of interactions with quasilinear complexity in the number of particles, eliminating the need to construct a grid of cells or an explicit kd-tree.We compare the performance of our method to a classical grid-based approach and demonstrate that our approach is faster in most cases with non-uniform particle distributions.

I. INTRODUCTION

2High-performance computing (HPC) is a key technology in scientific computing.Since the early 2000s, the use of graphics processing units (GPUs) has become standard in HPC, and they now equip many of the fastest supercomputers. 1 GPUs are massively parallel processors that allow computations to be performed on thousands of cores, making them perfectly suited for inherently parallel problems.The use of GPUs in scientific computing has led to incredible performance gains in many fields, such as molecular dynamics [1], fluid dynamics [2], astrophysics [3], and machine learning [4].

3Most scientific computing applications that use GPUs are based on the CUDA 2 programming model, and to a lesser extent, the OpenCL programming model.They do not exploit all the features of GPUs, particularly those dedicated to 3D rendering.Among these features, ray tracing is a powerful technology used to render 3D scenes.In this method, rays are cast from the camera to the scene, and the intersections 1 https://top500.org/ 2 https://developer.nvidia.com/cuda-toolkit of the rays with the objects in the scene are computed to generate the colors of the pixels in the image [5].For example, the NVIDIA GeForce RTX 4090, as a single consumer-grade GPU, demonstrates the raw power of this technology by rendering complex 3D scenes at 87 frames per second in 4K resolution (3840 x 2160 pixels), handling millions of triangles per frame [6].

4In this paper, we are interested in evaluating how ray tracing technology could be used to compute particle interactions in a 3D environment.Our motivation is twofold: We want to evaluate if it is possible to use ray tracing technology, and we want to create the algorithmic patterns needed for that purpose.

5With these aims, we focus on the computation of particle interactions in a 3D environment, which is a common problem in scientific computing.When the potential of the interaction kernel decreases exponentially with distance, the interactions can be computed with a cutoff distance, i.e. the interactions are only computed between particles that are closer than a given distance, achieving less but still satisfactory accuracy.This allows the complexity of the interactions to drop from O(N 2 ) to O(N ), where N is the number of particles if the cutoff distance is small enough.Classical methods to compute such interactions are based on the use of a grid of cells or an explicit kd-tree to quickly find the interaction lists for each particle.In this paper, we aim to avoid using such data structures and instead exploit ray tracing technology.

6The contributions of this paper are as follows:

7• We propose a method to compute particle interactions with a cutoff distance in a 3D environment based on ray tracing technology.

8• We describe two algorithmic techniques based on geometric patterns to find the interaction lists for each particle using real intersections.

9• We compare the performance of our approach with a classical approach based on a grid of cells and with an existing method that relies on ray tracing.

10The rest of the paper is organized as follows: In Section II, we present the prerequisites.In Section III, we review the related work.In Section IV-A, we present our proposed approach.In Section V, we present the performance study.Finally, we conclude in Section VI.

A. Particle Interactions

11Computing the interactions between N particles in a 3D environment is a common problem in scientific computing.For example, this is essential in fluid simulations using smoothed particle hydrodynamics [7] and in molecular dynamics for simulating forces between atoms [8].These interactions are usually modeled by a potential function that depends on the distance between the particles.A straightforward way to compute the interactions is to evaluate the potential function for all pairs of particles.However, the potential function can be short-range or long-range.When the potential function is shortrange, the interactions can be computed with a cutoff distance, i.e. the interactions are only computed between particles that are closer than a given distance.This reduces the complexity of the interactions from O(N 2 ) to O(N ), where N is the number of particles, but this is only possible if we have an efficient way to find the particles' neighbors.Moreover, the positions of the particles are usually updated after each computation step.Consequently, the system used to find the interactions between the particles should be updated at each iteration of the simulation.

12A possible solution to get the interaction list is to build a grid of cells mapped over the simulation space, where each cell contains the particles that are inside.The cells have a width equal to the cutoff distance C.Then, for each particle, the interactions are computed with the particles that are in the same cell and in the neighboring cells.Building the grid of cells and finding the interaction lists for each particle can be done in O(N ): we start by computing the cell index for each particle, then we order the particles in a new array by assigning a unique index per particle using atomic operations, and finally, we move the particles to a new array [9].Each of these three operations can be implemented with a parallel loop over the N particles.

B. Graphics Processing Units

13Graphics processing units (GPUs) are massively parallel processors that allow computations to be performed on thousands of cores.The hardware design of GPUs has been optimized for graphics rendering, particularly for the rendering of 3D scenes.To this end, GPUs have features dedicated to 3D rendering, such as texture mapping, rasterization, and ray tracing.Internally, GPUs are organized in a hierarchy of processing units, including streaming multiprocessors (SMs), warp schedulers, and execution units.

14NVIDIA has proposed the CUDA programming model to develop parallel applications for GPUs.CUDA is designed to express algorithms in a way that can be mapped to the GPUs' hardware organization.For instance, thread blocks are distributed across SMs, and threads are executed in warps.There are also keywords and functions to use shared memory, constant memory, and texture memory.Thus, creating optimized applications for GPUs requires an understanding of the hardware architecture of GPUs and potentially adapting algorithms to their specificities.

C. Ray Tracing

15Among the many features of GPUs dedicated to 3D rendering, ray tracing stands out as a powerful technology widely used in video games for rendering realistic 3D scenes [10].It is a hardware-accelerated technique that computes the interactions of rays with objects in a scene.Ray tracing generates pixel colors in an image by casting rays from the camera into the scene.For each intersection of a ray with an object, the pixel's color is determined based on the object's material properties and lighting conditions.Rays can also be reflected or refracted by objects, or continue through non-opaque surfaces, enabling recursive computation of interactions for enhanced realism.

16Typically, ray tracing kernels are implemented within the shaders of the graphics pipeline.Shaders are small programs executed on the GPU for each pixel in an image, often written in specialized languages such as GLSL (for OpenGL) or HLSL (for DirectX).These shaders run in parallel on the GPU, allowing for concurrent computation of ray-object interactions.NVIDIA introduced a method to utilize ray tracing within the CUDA programming model through its OptiX library [11].With OptiX, developers retain the flexibility of CUDA programming while leveraging ray tracing technology, albeit with some constraints on kernel implementation.

Create 3D builtin primitives

17Generate AABB

Build tree (BVH)

18Create AABB

Optix library

19Fig. 1.Schematic view of BVH tree creation.The OptiX library requires a list of encompassing axis-aligned bounding boxes (AABBs), which can either be directly provided or generated from a list of basic primitives.

20In ray tracing, scenes are represented using geometric primitives such as triangles or spheres, which are encapsulated within bounding volumes to enhance computational efficiency [12].A common bounding volume is the Axis-Aligned Bounding Box (AABB), a rectangular box aligned with the coordinate axes and defined by its minimum and maximum bounds (x min , y min , z min ) and (x max , y max , z max ).AABBray intersection tests are conducted by calculating t min and t max for each axis and ensuring that overlaps exist across all axes, efficiently determining whether the ray intersects the box.

21To further optimize performance, AABBs are organized into a Bounding Volume Hierarchy (BVH), a tree-like data structure where each node represents an AABB.Internal nodes group child AABBs, while leaf nodes encapsulate the actual primitives.In OptiX, users can either provide a list of basic primitives or directly supply a list of AABBs, as illustrated in Fig. 1.

22During ray traversal, the algorithm performs intersection tests at each BVH node.If a ray misses an AABB, the entire subtree beneath that node is skipped, reducing unnecessary computations.When a ray reaches a leaf node, precise intersection tests are conducted with the enclosed primitives, and the closest intersection is recorded.This process reduces the complexity of ray-scene intersections from linear to logarithmic by pruning large portions of the scene, ensuring only relevant branches of the BVH are explored.

23The final output of the ray tracing algorithm, typically the closest hit point, is used for shading or further processing to determine the visual appearance of the scene.This hierarchical approach, combined with the use of AABBs and BVH, ensures that ray tracing remains computationally feasible even for complex scenes containing millions of primitives.

24Fig. 2 provides a summary of the different operations in ray tracing using OptiX.In the first step, the user casts rays in the desired direction, and OptiX manages the BVH tree traversal and potential interactions.When a ray enters an enclosing bounding box (AABB), a callback function is invoked to determine whether the ray actually intersects the corresponding primitive, based on a built-in or user-defined Intersection Shader (IS), referred to as the intersection strategy.For custom primitives, the user must implement the IS.If the ray does not intersect or is marked to continue, the process is repeated for other primitives.The traversal stops when a final intersection is found or no more primitives can be intersected, triggering a call to the miss callback.

A. Neighbor Search on GPU

25The main work on physical simulation of particle interactions on GPU has been proposed by [13], to compute the gravitational potential.They described an efficient implementation using shared memory that became a standard implementation on GPU.As mentioned in Section II-A, gridbased and kd-tree structures are widely utilized for neighbor search operations on GPUs.For grid-based approaches, a detailed description can be found in our previous study [9], which focuses on scenarios with few particles per cell and demonstrates that utilizing shared memory often does not yield significant benefits.Regarding kd-tree implementations, [14] present a method for fast k-nearest neighbor searches using GPUs, highlighting the efficiency of kd-trees in highdimensional spaces.

B. Ray Tracing in Computer Graphics

26Ray tracing has been widely applied in particle-based representations, primarily in the domain of computer graphics and rendering.The author in [15] propose a method for efficiently ray tracing Gaussian particles to enable advanced rendering effects such as shadows, reflections, and depth of field in dense particle scenes, with applications in novel-view synthesis and visual realism.Similarly, [16] explores hardware-accelerated ray tracing for rendering particles that cast shadows, focusing on evaluating the performance of a prototype system.While these works demonstrate the utility of ray tracing in particlebased scenes, their focus lies in rendering and visualization, contrasting with our application of ray tracing for neighbor search in physical simulations.

C. OptiX in Scientific Computing

27The NVIDIA OptiX framework has shown potential for diverse applications in scientific computing.Blyth et al. utilized OptiX to enable high-performance optical photon simulations in particle physics.This approach reduced memory and computation overheads by using GPU-based culling of photon hits, handling millions of photons in complex geometries [17], [18].OptiX has been utilized as a flexible and high-performing tool for optical 3D modeling, enabling virtual measurements of sample surfaces by tracing over 1 billion light rays per image and comparing simulated results with those from physical measuring devices [19].

28While these applications highlight OptiX's potential in handling computationally intensive tasks, they primarily focus on modeling physical processes rather than using ray tracing for spatial queries or particle interactions.Our work bridges this gap by leveraging OptiX for neighbor detection and particle interaction calculations, building on its demonstrated strengths in scientific modeling to expand its applicability into the domain of particle-based simulations.

D. OptiX for Neighbor Search

29Using OptiX to find neighbors between elements has already been explored in several works.I. Evangelou et al. [20] introduced a novel approach to spatial queries, particularly radius search, by leveraging GPU-accelerated ray-tracing frameworks with OptiX.Instead of traditional spatial data structures like kd-trees, the authors proposed mapping the radius-search task to the ray-tracing paradigm by treating query points as primitives within a bounding volume hierarchy (BVH).In the proposed method, a ray used in the radius-search operation is essentially infinitesimal in extent, and its purpose is not to compute a traditional intersection but to test whether the origin of the ray (the query point) is within the bounding volume of a "sphere" surrounding each sample point.For that purpose, the authors reimplemented the function that tests if a ray intersects a sphere to control how the tests are performed.This approach enabled significant performance gains in dynamically updated datasets.

30Yuhao Zhu [21] further advanced the application of ray tracing for neighbor search by introducing optimizations for mapping the neighbor search problem onto the ray-tracing hardware available in modern GPUs.The author identified two key performance bottlenecks: unmanaged query-to-ray mapping, which led to control-flow divergences, and excessive tree traversals stemming from monolithic BVH construction.To address these issues, they proposed query scheduling and partitioning strategies that exploit spatial coherence and reduce BVH traversal time.Their experiments demonstrated substantial speedups ranging from 2.2 to 65.0 over existing GPU neighbor search libraries.Their work highlights the potential of using ray-tracing hardware not only for rendering but also for efficient spatial queries.The source code for their work is available on GitHub; however, the implementation is not directly applicable to our purpose as it primarily focuses on radius search and constructing interaction lists.In contrast, our interest lies in directly computing the interactions.Furthermore, for large test cases involving particles distributed on a sphere, the performance of their method appears to be of the same order of magnitude as ours.

31Shiwei Zhao et al. [22] extended the use of ray tracing for particle-based simulations by converting neighbor search into a ray tracing problem.Each particle was represented as a bounding box, similar to previous works, with tiny rays emitted to detect intersections and identify neighboring particles.By leveraging NVIDIA's RT cores alongside CUDA cores, they demonstrated 10% to 60% performance improvements over traditional cell-based methods in various particle-based simulations, including discrete element methods and smooth particle hydrodynamics.Their approach underscores the versatility of ray-tracing cores for accelerating computationally intensive neighbor search tasks across different domains.

32These works collectively demonstrate the potential of using OptiX and ray-tracing hardware for efficient spatial queries, providing a foundation for further exploration in GPU-accelerated computational methods.However, these approaches lack a direct integration of physical interaction computations within the ray-tracing framework.Our approach addresses this gap by embedding cutoff distances directly into the intersection tests.Additionally, we introduce two novel methods for neighbor detection that utilize actual intersection computations, accommodating scenarios where custom IS are unsupported.

A. Overview

33The core idea of our approach is to represent particles using geometric primitives and to use ray tracing to find the neighbors of each particle by detecting intersections with these primitives.

34With this aim, we investigate three possibilities:

351) Custom AABB: in this case, we directly provide the list of englobing bounding boxes.Therefore, we also have to provide our own IS in which we do not compute real intersections but only check if a ray is inside an AABB.This strategy is the closest one to the state of the art.

362) Spheres: in this case, we use built-in sphere primitives, which allows us to use the built-in IS that check if a ray really intersect with the surface of a sphere.However, we had to create our own geometric algorithm to make it work.

373) Triangles: in this case, we use built-in triangle primitives to create squares, which allows to use the built-in IS that check if a ray really intersect with the surface of a triangles.As for the spheres, we had to create our own geomatric algorithm to make it work.

38The spherical approach is simpler and more intuitive than using squares, but we are interested in evaluating if the squares made of triangles is more efficient as it is the most used primitive in 3D rendering.We also want to evaluate if the built-in IS is more efficient than our custom IS.

39In the cases that rely on built-in IS, we use the following algorithmic pattern:

401) We build a geometric representation for each particle.

412) We cast rays from each particle in specific directions to find the neighbors, depending on the representation.3) We filter the intersections to avoid computing the same interaction multiple times.4) We compute the interactions between the particles that are closer than C.

42To reduce overhead, we aim to use as few rays as possible and ensure they do not intersect with too many particles that are not within the distance C.

43In terms of implementation, we use the OptiX library to develop the ray tracing kernels, which can be used in conjunction with the CUDA programming model.Specifically, in the OptiX API, we create a scene by providing a list of geometric primitives.We then provide a CUDA kernel that launches the rays, where each ray has an origin, a direction, a starting point, and an endpoint.Usually, one CUDA thread is used to launch one ray.Finally, a callback is invoked by OptiX when a ray intersects with a primitive or if no intersection is found between the starting and ending points (in 3D rendering, this usually means that the background color should be used).

44The data accessible from the callback is limited.OptiX built-in IS can provide information about the intersection, such as the intersection point, the normal on the surface, the distance from the ray's origin, and the index of the primitive that was hit.Additionally, the user can pass information from the CUDA kernel that launches the rays to the callback using a payload.A payload is a user-defined data structure that is passed along with a ray as it traverses the scene.It allows the ray to carry information that can be read or modified.The number of payload variables is limited (usually 16 32-bit integers in recent versions).

45When the hit callback is invoked, and we want the ray to continue, there are two possibilities.The first is to launch a new ray from the intersection point in a new direction.This is done by storing the intersection distance in a payload variable, returning from the callback, and then launching a new ray from the intersection point using a loop in the CUDA kernel to reach the desired distance.The second possibility is to inform OptiX that we want to continue the traversal by calling a corresponding function in the intersection callback.This second approach is generally more efficient, as it avoids the overhead associated with launching new rays and and should be favored in practice.

46Additionally, we cannot allocate memory in the callbacks, so we cannot build complex data structures, such as lists, to store intersection lists.Consequently, if we want to filter the intersections, we cannot fill an array with indices and check if an index exists in the array to ensure uniqueness; instead, we must use geometric properties to filter the intersections.

47In the remainder of the section, we consider that the target particle is the particle for which we want to find the neighbors.

B. Spherical Representation

48In this section, we consider the case where the particles are represented by spheres and we use the built-in IS.In OptiX, a sphere is a geometric primitive defined by its center and radius, and multiple spheres of the same radius can be instantiated in the scene, which is the approach we use.

49We have the following objectives:

501) Expressing the radius of the spheres depending on the cutoff distance; 2) Defining the origins and directions of the rays; 3) Providing a mechanism to filter the intesection when the rays intersect multiple times with the same sphere.

51In our model, we will use three rays for each particle, one in each direction of the coordinate system.Consider a sphere of radius C centered at the origin in a three-dimensional space.The points on this sphere that are at the farthest distance from the three coordinate axes are located in the corners of a cube inscribed within the sphere.For instance, one such point at distance C from the origin lies in the direction (1, 1, 1).These 8 points, corresponding to the vertices of the cube, are all at a distance C from the origin, and we want to know how far they are from the coordinate axes.This can be calculated as follows: Since the points have coordinates where |x| = |y| = |z|, we use the equation of the sphere

52from any of the three coordinate axes.

53We use this information to define the radius of the spheres and the length of our rays.The radius is set to r = C× √ 2 √ 3 .In this scenario, it is sufficient that the rays go up to l = C √ 3 in each direction relatively to the particle's position (so a single ray goes from −l to l).We provide a simplified 3D rendering of the spheres in Fig. 3 that illustrate our model.However, if l < r, there are positions where the sphere could simply englobe the rays, and we would miss some intersections (when the source and target are closer than r − l in the three dimensions).Therefore, we set l = r and add an ϵ to the radius of the sphere to ensure that the rays intersect with the sphere in all cases, obtaining r = C×

54The ϵ is a small value such that it must be impossible that two particles are closer than ϵ, or some intersections will be missed (see Appendix A for more details).in each direction.In this case, the sphere could englobe the rays.

55When the source and target particles are perfectly aligned on one axis, the ray will intersect for particles distant from the extremity by r + ϵ.Therefore, two particle distant from l + r + ϵ can interact.This case and any intermediate situation where the source/target are actually too far can easily be filtered by checking the distance.In Fig. 4, we provide a 2D representation of the particles using spheres on intricate cases.However, each ray can potentially intersect with a sphere several times, and the same sphere can be intersected by several rays of the same target particle, so we need to filter them.It is impossible to maintain a global list that all the rays can access to check if an intersection has already been found, or even a single list per ray to ensure that it does not intersect with the same sphere.Therefore, we must do this based on geometric rules as described in Algorithm 1.When we detect an intersection, we get the position of the source and target particles and first check they are within the cutoff distance.Then, we check if the closest ray to the source particle is the current one, and if yes, we can proceed with the computation (see Appendix A for more details).

C. Double Squares Representation

56Most 3D rendering applications use triangles to represent the objects in the scene, which motivated us to create a second model that relies on triangles instead of spheres.Of course, building the AABB representations and the HBV tree is not expected to be faster than the sphere, but the hardware modules and built-in could be more optimize for the triangles, as it is more common primitives.In our model, we use four triangles to draw two squares, which are positioned opposite each other.Each square has a width of C +ϵ and is positioned at a distance of C/2 along the X-axis relative to the particle, one in each direction.We provide Code 1 in Appendix B, which shows how we generate the triangles from the particles' positions.

57We then launch four rays, all with the same length and direction, but positioned at the corners of the squares.Each ray is positioned at −C/2 from the center of the square and has a length of C + ϵ.The ϵ is used to ensure that when the source and target particles have the same x coordinate and their squares overlap, the rays cross the triangles.We provide 2D representation when the source and target are aligned, the source will be detected at r + l + epsilon.

582D representation with the four positions the farest from the rays.The source sphere intersect with both rays.

592D representation with multiple sources that have their spheres intersected with the rays.Fig. 4. 2D Spherical representation of the particles in three different cases.In the first one (left), what will be the position of the farthest source particle and how it will be detected by the ray.In the second one (center), we show the case where the source particle is the farthest from the rays (it also shows that in 2D the sphere radius could be smaller).In the last one (right), we show different source particles with their spheres and the rays that will intersect with them. in Fig. 5 the 2D representation of the particles using squares (which are lines in 2D).

60From this description, one particle can be seen as a box of sides (C + ϵ, C + ϵ, C) (see Fig. 6).The rays can be seen as the four edges of the box in the x direction, and the triangles composed the front and back faces.If any two boxes have an intersection, we will detect it as shown in Fig. 5.

61Potentially, the ray will intersect with the squares of the target particle, but this can easily be filtered by checking either the coordinates or the index of the geometric elements.Additionally, if the target and source particles are aligned on the y or z axis, two rays will intersect with the source's squares.To filter these intersections, we proceed as shown in Algorithm 2. We compare the coordinates between the source and the target and proceed as follows: If y and z are different, we perform the computation (only the current ray will intersect).If y is equal, we use the ray of index 0 if z is smaller, and the ray of index 2 if z is greater.If z is equal, we use the ray of index 0 if y is smaller, and the ray of index 1 if y is greater.Otherwise, only the ray of index 0 will be used for computation (all four rays will intersect).

D. Custom AABB

62In this strategy, a bounding box with a width equal to 2×C is created around each particle.OptiX treats these boxes as custom primitives, requiring us to implement a custom IS that is invoked when a ray enters an AABB.We do not perform any intersection tests within the IS, as our goal is not to compute ray-AABB or ray-surface intersections but to identify pairs of particles that are within a distance C of each other.To achieve this, rays are cast from the particles' positions with an infinitesimally short length, as illustrated in Fig. 7.

63The interaction between the source and target particles is computed directly within the IS callback.Consequently, the hit and miss callbacks are left empty, as there is no need to filter intersections.In the IS callback, OptiX provides information about the ray (specifically, the starting point, which corresponds to the position of the source particle) and the index of the AABB being tested.To obtain geometric information about the AABB, one could register a Primitive Geometry Acceleration Structure (PGAS) for each AABB during the OptiX scene build stage and retrieve this data in the IS callback.However, we observed that this approach significantly increased the scene build cost.Instead, we opted to access the global memory directly to retrieve the position of the target particle, which proved to be a more efficient solution.

V. PERFORMANCE STUDY

64This section presents a performance evaluation of the different methods under various configurations.The analysis begins with a description of the experimental setup, including 2D representation when the source and target are distant from C in X direction, their squares overlap.

652D representation when the source and target have the same X position, both of their squares overlap.

662D representation with multiple sources that have their squares intersected with the rays.Fig. 5. Double squares (line) representation of the particles.On the left, we show how the squares can overlap for particles that are too far, but which can be easily filtered with the distance.In the middle, we show how particles that have the same x coordinate can have their squares that overlap.On the right, we show different source particles with their squares and the rays that will intersect with them.the hardware and software used for implementation.Performance is then examined for two types of particle distributions: uniform and non-uniform.Differentiating these distributions allows for assessing the efficiency of grid-based methods like CUDA, which are optimized for uniform distributions but can encounter inefficiencies with sparse or highly localized data in non-uniform scenarios.

67A. Experimental Setup 1) Hardware: We have used two NVidia GPUs:

68• A100 Despite the lack of RT cores, the A100 is capable of executing ray tracing kernels, the GPU then use its other units to behave similarly.

692) Software: We have implemented the proposed approach in OptiX 8. 5 We use the GNU compiler 11.2.0 and the NVidia CUDA compiler 12.3.The source code is available online. 6he code was compiled with the following flags: -arch=sm_75 for the RTX8000, -arch=sm_80 for the A100 (and -O3 -DNDEBUG on both).We execute each kernel five times and take the average as reference.

70We provide in Fig. 8 the 3D rendering of the primitives using ray tracing: in Fig. 8a for the spheres and in Fig. 8b for the squares.These figures were drawn using the OptiX API and ray tracing from camera to the scene.

B. Uniform distribution

71In this test case, the particles are distributed uniformly within a unit box.Consequently, there are no (or very few) is ray f or compute ← (point.y̸ = q.yAND point.z̸ = q.z)

17

72OR ((point.z< q.z AND ray idx == 0) OR (point.z> q.z AND ray idx == 2))

18

73OR ((point.y< q.y AND ray idx == 0) OR (point.y> q.y AND ray idx == 1)) We present the results in Fig. 9.For all configurations, we measured the initialization step (light color) and the computation step (dark color).

74For the OptiX-based implementation, the initialization step involves building the scene by invoking the OptiX API to create the primitives.For the CUDA version, the initialization step involves constructing the grid of cells.Consequently, in the OptiX-based version, the computation step includes the time spent launching the rays, executing the callback functions, and performing the interactions.In the CUDA version, the computation step corresponds to the kernel time required to compute the interactions.

751) Comparison between triangles and spheres: First, we analyze the performance difference between triangles (blue) and spheres (green).On the A100 GPU, both models deliver similar performance, but the ratio of initialization time (light color) to computation time (dark color) is higher for spheres.This indicates that the computation step is more efficient for spheres than for triangles.This suggests that in scenarios where the initialization step is performed only once (e.g.static elements), spheres might be a better choice.However, on the RTX8000, triangles are faster than spheres across all configurations.Although the initialization step for spheres is quicker than for triangles in cases with fewer particles, this trend does not hold for larger configurations.

762) Comparison between custom AABB and built-in primitives: Next, we compare the Custom AABB method (orange/red) with the built-in primitives (triangles in blue and spheres in green).On the A100, the Custom AABB consistently outperforms the built-in primitives, and its advantage grows as the number of particles or cells increases.For β = 32 (Fig. 9i), the Custom AABB is up to four times faster than the triangle-or sphere-based methods.On the RTX8000, the Custom AABB performs similarly to triangles for small particle counts but becomes faster as the number of particles increases.Overall, the Custom AABB is the fastest method.This demonstrates that creating a custom Intersection Shader (IS) that is significantly simpler and lighter than the builtin ones, which compute actual intersections, can accelerate execution.

773) Benefit of sorting the particles in the custom AABB methods: Sorting the particles to position them closer in memory based on their spatial proximity in the simulation is expected to optimize memory accesses.However, sorting the particles also incurs a computational cost.We observe that the strategy without sorting (orange) is faster than the strategy with sorting (red) when there are few particles.However, as the number of particles increases, the benefits of sorting become significant.In our test case, for a given β, increasing the number of particles leads to an increase in neighboring particles and, consequently, the number of interactions.In such cases, optimizing memory access becomes critical.

4) GPU Performance comparison:

78We then compare the performance of the two GPUs.Results for the A100 are presented in Fig. 9a, 10c, 9e, 9g, and 9i, while results for the RTX8000 are shown in Fig. 9b, 9d, 9f, 9h, and 9j.Both GPUs exhibit comparable performance and a similar initializationto-computation time ratio.Although the A100 is expected to offer higher raw performance, the OptiX implementation is not fully optimized for this GPU, while the RTX8000 benefits from having more RT cores to accelerate computation.Additionally, we do not utilize the tensor cores of the A100, which represent a key differentiator between the two GPUs and could help approach theoretical performance.

5)

79Comparison between OptiX and CUDA implementations: Finally, we compare the OptiX triangles (blue), Op-tiX spheres (green), Custom AABB (orange), Custom sorted AABB (red), and CUDA implementation (green).The OptiXbased implementation is generally slower than the CUDA implementation for β values from 2 to 8, except in a few cases (e.g.β = 2 and N = 8).In these scenarios, the initialization step in the CUDA implementation is negligible, and the computation step dominates.Consequently, avoiding the grid of cells does not yield a significant advantage.For β = 8 (Fig. 9e and 9f), the CUDA computation step is shorter because the OptiX implementations include not only the interaction computation but also the intersection list computation using rays.Additionally, the memory access pattern in OptiX-based implementations differs, as spatially close particles in memory may not be close in space and may have varying neighbors.

80For β = 16 and β = 32, the Custom AABB performs better for configurations with few particles per cell (e.g. one or two particles per cell on average in the CUDA version).In these cases, the computation cost is low, and the CUDA version spends most of its time in the initialization step.Furthermore, the CUDA version incurs overhead for empty cells because it constructs a dense grid.For such configurations, the OptiXbased implementations allocate more time to the computation step, making the Custom AABB a suitable choice when the number of particles per cell is low, particularly in scenarios where moving particles require frequent grid rebuilding.

C. Non Uniform Distribution

81In this test case, we distribute the particles on the surface of a unit sphere.Consequently, most of the cells on the grid in the CUDA version are empty.With this aim, we use a coefficient α, which can be 8, 16, 32, 64 or 128.For a given α, the simulation grid consists of approximately 3 α nonempty cells.The number of particles N is then calculated as N = p × 3 α , where p represents the average number of particles per cell, taking values of 1, 2, 4, 8, 16, or 32.The cutoff radius is set such that each particle should have approximately 9 × p neighbor particles (it will be in general smaller than 2/α).In order to facilitate the reproducibility of our test case, we provide in Appendix, the Code 2 that generates the different configurations.All computations are performed in single-precision floating point.

82We present the results in Fig. 10.For all configurations, we measured both the initialization step (light color) and the computation step (dark color) for the first configuration.However, for the others, we directly present the total execution time using a logarithmic scale on the y-axis due to extreme differences.

83For the OptiX-based implementation, the initialization step involves building the scene by invoking the OptiX API to create the primitives.For the CUDA version, the initialization step involves constructing the grid of cells.Consequently, in the OptiX-based version, the computation step includes the time spent launching the rays, executing the callback functions, and performing the interactions.In the CUDA version, the computation step corresponds to the kernel time required to compute the interactions.

1) OptiX spheres:

84The OptiX spheres method is consistently the slowest (except for α = 2 and a small number of particles).It has a more expensive initialization step compared to the Custom AABB methods and a significantly larger computation step.This is because the built-in IS kernel for spheres is computationally intensive, as it calculates several values, such as the norm of the intersection, that we do not use since we are not rendering an image.

852) Custom AABB without and with sorting: For low α, sorting does not provide an advantage; it increases the cost of the initialization step too much relative to the gains in the computation step.However, for high α and a large number of particles, sorting the particles results in a performance improvement.This demonstrates that random access to global memory is so costly that the overhead of sorting the particles is worthwhile.The Custom AABB method with sorting performs comparably to the CUDA version.However, the Custom AABB methods are generally slower than both the CUDA version and the OptiX triangles method.

863) OptiX triangles: This strategy is the most efficient.For α = 8, its initialization step is comparable in cost to the OptiX spheres and Custom AABB methods.However, its computation step is significantly faster.We attribute this to two primary reasons.First, the built-in IS kernel for triangles is likely much simpler than that for spheres and is probably heavily optimized by NVIDIA, as triangles are the most commonly used primitive in 3D rendering.Second, the AABB bounding boxes around triangles are much smaller than those around spheres or the custom AABB primitives.This enables faster tree traversal and fewer false positives (i.e.cases where a ray intersects a bounding box but not the primitive inside it).

87Finally, the CUDA version includes several components in its implementation that rely on algorithms with complexity linear in the number of cells.Since the vast majority of these cells are empty, these steps become highly inefficient.This is particularly evident for α = 8, where the initialization step is notably prominent.Moreover, if we were to create a test case with α = 256 (not included in the current study), the GPU would run out of memory for the the CUDA version allocating an excessively large grid.This limitation makes alternative approaches based on a tree structure -such as our OptiXbased methods -the only viable options.

VI. CONCLUSION

88In this paper, we proposed leveraging ray tracing technology to compute particle interactions within a cutoff distance in a 3D environment.We introduced one method that uses custom primitives and a custom Intersection Shader (IS), similar to the state-of-the-art, and two methods that use built-in primitives and actual intersection computations.For the latter, we described geometric algorithms to build the interaction list based on ray intersections with spheres or triangles.

89Our results indicate that our approach provides a modest advantage in the preprocessing stage by avoiding the construction of a grid of cells.In addition, it is slower than the classical approach during the computation step when dealing with large numbers of uniformly distributed particles.However, when most cells are empty, our approach can provide a significant speedup.Therefore, we believe these methods have the potential to deliver better performance in the future or for specific applications, and we hope our work inspires the community to explore this direction further.

90As GPU architectures continue to evolve, with advancements such as NVIDIA's Ada Lovelace architecture featuring third-generation RT cores and AMD's RDNA 3 architecture incorporating second-generation ray-tracing accelerators, we anticipate that algorithms leveraging these capabilities will become increasingly effective and relevant.Consequently, our approach is prepared to benefit from these hardware improvements, enhancing its performance and applicability in future computational scenarios and we hope our work inspires the community to explore this direction further.

91We plan to evaluate our approach on other GPUs, such as AMD Radeon, and aim to port our method even in cases where the IS cannot be customized, thanks to our geometric algorithms.In a second step, we will take our best strategy and compare it with state-of-the-art particle interaction solvers that support GPUs.

APPENDICES A. DISCUSSION ON THE SPHERE MODEL

92The filtering algorithm presented in Section IV-B is based on the assumption that there is always at least one ray that is intersected once by the sphere and that it is the closest one to the center of the sphere.The following section is dedicated to demonstrating this hypothesis.

93In Fig. 11, we show the different possibilities depending on the radius r and ray's length l.As it can be seen, even if the sources located at a distance of C from the target could have their spheres that intersect with the rays when r > l, we must set l = r to ensure that the rays will intersect with the sphere in all cases, especially when the source and target are close.

94For the clarity of the proof, a demonstration is first provided in the plane, followed by a generalization to R 3 .1) 2D Case: Let us consider a cercle of radius r centered at (x c , y c ), and a cross7 centered at the origin with a length of r.We consider the cases where the cercle is located in the first quarter, i.e., 0 ≤ x s ≤ r and 0 ≤ y s ≤ r, but the demonstration remains valid for other quarters.

95The equation of a cercle is given by:

96(

97The coordinates of the intersection points of the cercle with the axis are given by:

98We provide the Fig. 12 that shows where these points are located on the sphere and the cross.

99x 0 and y 0 are the coordinates of the intersection points of the cercle that remain on the cross as the cercle get away from the origin.On the other hand, x 1 and y 1 are the coordinates of the intersection points of the cercle that are the farthest from the origin of the cross and that can potentially be too far to remain on the cross (they will be on the corresponding axis but behind l).

100Lemma 1.Given a circle C and let e x and e y be the two segments of the cross of length less than r, then the number of intersections of C with e x or with e y is strictly less than 2.

101Proof: As we consider that it is impossible that both x 1 and y 1 exist at the same time, we consider that these two equations cannot be true at the same time

102ending up with

103For our definition range of y c ∈ [0, r], this equation has no solution (see Fig. 13), which confirms that C will always intersect with the cross at most once for e x or e y .

104The second statement is to show that the ray that is intersected once is the closest to the center of the sphere.

105Lemma 2. Given a circle C and e one of the two segments of the cross of length less than r, such as the number of intersection of C with e is equal to 1, then the distance of e with C is smaller than the distance of the other bar to C.

106Proof: Consider that C intersects with e y twice and e x once, it means that y 1 < r and x 1 > r, i.e. y c + r 2 − x 2 c < r and x c + r 2 − y 2 c > r.We aim to demonstrate that the inequality

107holds if and only if x c > y c .

108We start with the inequality:

109Subtracting y c from both sides, we obtain:

110We can further simplify this to:

111The inequality now compares two quantities: r 2 − y 2 c − r 2 − x 2 c and x c − y c .

112• The term r 2 − y 2 c represents the horizontal distance from the point (x c , y c ) to the vertical axis.

113• The term r 2 − x 2 c represents the vertical distance from the point (x c , y c ) to the horizontal axis.

114Let's consider the case where x c > y c :

115• If x c > y c , then x c − y c > 0.

116• Additionally, r 2 − y 2 c > r 2 − x 2 c because y c < x c .This implies that the term r 2 − y 2 c − r 2 − x 2 c is positive, and it is less than x c − y c , proving that the inequality holds under this condition.

117Thus, for the inequality y c + r 2 − y 2 c < x c + r 2 − x 2 c to hold, it is necessary that x c > y c .So, the x axis is the closest axis to the center of the sphere and is intersected once.

118If r > l, the sphere might not intersect with the rays, even if the source and target a closer than the cutoff distance If l > r, the sphere might intersect twice with all rays, leading to difficulty to filter If r == l, the sphere cannot englobe the rays and there is always a ray that is intersected only once.2) 3D Case: To convert this proof from 2D to 3D, we need to extend the concepts from the circle and cross to a sphere and a three dimensional cross. 8Consider a sphere with radius r centered at (x c , y c , z c ) in 3D space, and a cross (or coordinate axes) centered at the origin with each axis extending from −l to l.We are interested in analyzing the intersection of the sphere with the axes, focusing particularly on the first octant where 0 ≤ x c ≤ l, 0 ≤ y c ≤ l, and 0 ≤ z c ≤ l.

119The equation of the sphere is given by:

120The coordinates of the intersection points of the sphere with the axes are found by setting two of the coordinates to zero in the sphere's equation:

121• Intersection with the x-axis (set y = 0 and z = 0):

1228 That is, three axis aligned orthogonal segments of the same size intersecting at their respective centers.

123• Intersection with the y-axis (set x = 0 and z = 0):

124• Intersection with the z-axis (set x = 0 and y = 0):

125Let's denote the intersection points on the positive half of the axes as:

126We need to analyze whether these points lie within the bounds of the cross, i.e. whether x 1 ≤ l, y 1 ≤ l, and z 1 ≤ l.

127Assume that one of these coordinates, say x 1 , exceeds l.This would mean that the intersection does not lie on the cross, i.e. x c + r 2 − y 2 c − z 2 c > l.Similarly, for y 1 and z 1 , we require that:

128These conditions cannot all be true simultaneously for x c , y c , and z c within the defined range, similar to the 2D case.Thus, a sphere will intersect the cross at most once per axis.

129Next, we determine the axis closest to the sphere's center.If x c > y c > z c , we aim to prove that the intersection on the x-axis occurs first (i.e. is the smallest).

130Starting with:

Fig. 2 .

131Fig. 2. Schematic view of the OptiX ray tracing workflow.

Fig. 3 .

132Fig. 3. 3D Spherical representation of a source and target particles distance from C = 1.The source sphere has a radius of √ 2 √ 3 and the rays, represented by segments, are of length 1 √ 3

Fig. 6 .Fig. 7 .

133Fig.6.3D Rectangular representation of a source and target particles.Some rays (thick lines) intersect with the squares.

134(a) 3D Rendering of sphere primitives.(b) 3D Rendering of square primitives.

Fig. 8 .

135Fig. 8. 3D Rendering of the primitives using conventional ray tracing.

Fig. 9 .

136Fig. 9. Performance results for the two GPUs for our approaches (OptiX spheres, OptiX triangles, and Custom AABB without and with sort) and the pure CUDA implementation that use a grid of cells β is the divisor coefficient of the simulation box.The cutoff distance is 1/β and there are β 3 cells in the grid in the Cuda version.The speedup against the CUDA version is shown above the bars for both the build and compute steps.

137A100 α = 16 (Log.).

138RTX8000 α = 16 (Log.).

139A100 α = 32 (Log.).

140RTX8000 α = 32 (Log.).

141A100 α = 64 (Log.).

142A100 α = 128 (Log.).

143RTX8000 α = 128 (Log.).

Fig. 10 .

144Fig.10.Performance results for the two GPUs for our approaches (OptiX spheres, OptiX triangles, and Custom AABB without and with sort) and the pure CUDA implementation that use a grid of cells (CUDA).α is the divisor coefficient of the simulation box.The cutoff distance is lower than 1/β and there are around α 3 non-empty cells in the grid in the Cuda version.The speedup against the CUDA version is shown above the bars for both the build and compute steps, or for the complete run.

x c + r 2 3 )Which can be simplified as x c < r − r 2 − y 2 c and r 2 − x 2 c ≤ r − y c r 2 − x 2 c ≤ r 2 − 2ry c + y 2 c x 2 c > 2ry c − y 2 c

145− y 2 c ≤ r and y c + r 2 − x 2 c ≤ r. (x c > 2ry c − y 2 c ,

Fig. 11 .Fig. 12 .

146Fig. 11.2D Spherical representation of the particles in three different cases with r > l, l > r and r == l.

Fig. 13 .

147Fig. 13.Plot of the equation 2ryc − y 2 c − r + r 2 − y 2 c , for r = 1.

참고문헌

참고문헌 정보가 없습니다.