DOI: https://doi.org/10.21468/scipostphyscodeb.66
تاريخ النشر: 2026-03-16
المؤلف: Stefan Seckmeyer وآخرون
الموضوع الرئيسي: طرق عددية للمعادلات التفاضلية
نظرة عامة
يقدم القسم FFTArray، مكتبة بايثون مصممة لتسهيل تفكيك تحويلات فورييه لحل المعادلات التفاضلية الجزئية (PDEs) في الأنظمة الفيزيائية. تواجه طرق الطيف الفوري التقليدية، على الرغم من فعاليتها، تحديات في تحويل تكاملات فورييه إلى تحويلات فورييه السريعة (FFTs) بسبب التعقيدات في اختيار الشبكة والعوامل المعتمدة على الإحداثيات. تعالج FFTArray هذه القضايا من خلال توفير إطار عمل آلي يبسط تنفيذ طرق فورييه شبه الطيفية، مما يسمح للباحثين بترجمة المعادلات المعقدة مباشرة إلى كود. يدعم تصميمها القابل للتعديل التوسع من بعد واحد إلى أبعاد متعددة ويتكامل بسلاسة مع الواجهات الخلفية الشائعة مثل NumPy وJAX وPyTorch، مما يمكّن تسريع GPU لتحسين الأداء.
في الختام، لا تعمل FFTArray فقط على تبسيط عملية تنفيذ تحويلات فورييه المفككة على شبكات الإحداثيات المختلفة، بل تقلل أيضًا بشكل كبير من العبء الحسابي المرتبط بمحاكاة النطاق الواسع. يعزز هيكل المكتبة من النمذجة السريعة للنماذج المعقدة، مما يسمح للباحثين بالتركيز على الاستفسارات العلمية بدلاً من التعقيدات التقنية. يشجع المؤلفون المجتمع العلمي على المساهمة في FFTArray وتوسيع قدراتها، مع تسليط الضوء على إمكاناتها لتطبيقات أوسع تتجاوز تنفيذاتها الحالية. تم التحقق من أداء FFTArray على أنظمة الحوسبة المتطورة، مما يثبت فعاليتها في المحاكاة على نطاق واسع في البحث العلمي.
مقدمة
تناقش المقدمة التحديات المتعلقة بنمذجة الأنظمة الفيزيائية المعقدة باستخدام المعادلات التفاضلية التي غالبًا ما لا تعطي حلولًا مغلقة. يتم تسليط الضوء على تكاملات فورييه كأداة قيمة لتقريب هذه الحلول. ينتقل القسم بعد ذلك إلى تحليل أداء خوارزميات المحاكاة، مع التركيز بشكل خاص على تعقيد الوقت المرتبط بتحويل فورييه السريع (FFT). يُلاحظ أن التعقيد هو $O(n_{\text{samples}} \log n_{\text{samples}})$، حيث يمثل $n_{\text{samples}}$ عدد العينات في كل بعد. ومع ذلك، يتأثر الأداء العملي بعوامل مختلفة، بما في ذلك تسلسل الذاكرة وأنماط الوصول.
تقيم الدراسة أداء تنفيذات مختلفة (FFTArray Direct وTorchGPE) عبر تكوينات شبكية متنوعة: 1D و2D و3D، وأشكال محددة ذات صلة بتطبيقات مثل تقسيم شعاع براج. تشير النتائج إلى أنه بينما تشير التعقيدات النظرية إلى توسيع لوغاريتمي، يبقى الأداء الفعلي تقريبًا خطيًا عبر الأجهزة المختلفة، باستثناء حالة 1D على وحدات المعالجة المركزية، التي تظهر توسيعًا غير مثالي. يشير هذا إلى أن عوامل أخرى، مثل أنماط الوصول إلى الذاكرة، تلعب دورًا كبيرًا في الكفاءة الحسابية، خاصة في الأبعاد الأعلى حيث يكون الأداء أكثر تجانسًا عبر التخطيطات.
طرق
في منهجية القياس الموضحة، سعى الباحثون إلى تقييم سرعة الحساب بدقة في المحاكاة التي تتضمن العديد من خطوات الوقت. بدأت الإجراءات برحلتين تمهيديتين، كل منهما تستخدم خطوتين زمنيتين، لتخفيف آثار التهيئة الناتجة عن استيراد الوحدات وذاكرات التجميع التي تختلف حسب تكوين النظام وإصدارات البرمجيات. تم التركيز فقط على توقيت الحلقة الداخلية للمحاكاة، مع استبعاد أي روتينات تهيئة أو تنظيف، مع ضمان أن النتائج المحسوبة على وحدة معالجة الرسوميات تم نقلها بنجاح إلى وحدة المعالجة المركزية.
لتقليل التباين الناتج عن تدخل العمليات الخارجية، تم تكرار كل قياس أربع مرات، وتم تسجيل الحد الأدنى من الوقت كقيمة تمثيلية. تفترض هذه الطريقة وجود سيناريو سرعة مثالي، حيث تُعزى تقلبات وقت التشغيل إلى الانقطاعات. استغل الباحثون التوسع الخطي لوقت المحاكاة بالنسبة لعدد خطوات الوقت، كما تم مناقشته في القسم A.3. بالنسبة للبيانات المقدمة في الأشكال 9 و11 إلى 13، تم إجراء المحاكاة مع ثلاثة أعداد مختلفة من خطوات الوقت، تم معايرتها لتحقيق وقت تشغيل أساسي يبلغ حوالي عشر ثوانٍ. تم ضبط المجموعتين الأخريين على مرتين وأربع مرات من هذا الأساس، مستهدفةً أوقات تشغيل تبلغ 20 و40 ثانية، على التوالي. تمثل كل نقطة بيانات في الأشكال ميل الملاءمة الخطية المستمدة من الحد الأدنى من أوقات التشغيل عبر ثلاث تغييرات في خطوات الوقت.
نقاش
يسلط قسم النقاش في الورقة الضوء على قيود الأطر البرمجية التقليدية التي تربط تعريف مشاكل الفيزياء، وحلول المعادلات التفاضلية المعتمدة على فورييه، وطرق التفكيك في هيكل موحد. غالبًا ما تؤدي هذه التعقيدات إلى مشكلات مثل نقص العمومية، وتكرار الكود، وزيادة تعقيد الكود، مما يجعل من الصعب الحفاظ على المحاكاة العلمية وتكييفها مع زيادة تعقيد الأنظمة. بالمقابل، تفصل مكتبة FFTArray هذه المكونات، مما يسمح للباحثين بالتركيز على الفيزياء الأساسية ومنطق الحلول دون عبء تفاصيل تنفيذ FFT على المستوى المنخفض. تعزز هذه التبسيط المعماري من قابلية صيانة الكود وإعادة استخدامه، مما يسهل النمذجة السريعة لنماذج فيزيائية متنوعة.
تم تصميم FFTArray لتوفير أداء متقدم، خاصة لحل معادلة شرودنغر في الأنظمة الكمومية الكبيرة، ويدعم تعددية الأبعاد بسلاسة. من خلال احتواء التقريب العددي لتحويلات فورييه على شبكات متعددة الأبعاد موضوعة بشكل عشوائي، يسمح FFTArray للمستخدمين بتخطيط المعادلات التحليلية مباشرة إلى كود، مما يبسط عملية المحاكاة. تم بناء المكتبة على معيار واجهة برمجة تطبيقات مصفوفة بايثون، مما يضمن التوافق مع المكتبات الشائعة مثل NumPy وJAX وPyTorch، بينما يمكّن أيضًا تسريع GPU. على الرغم من تطويرها مع التركيز على محاكاة تفاعلات الذرات مع الضوء ومجموعات الذرات فائقة البرودة، فإن مجموعة أدوات FFTArray القابلة للتعديل وإدارتها الفعالة للدوال المفككة تجعلها قابلة للتطبيق على نطاق واسع عبر مجالات مختلفة في الفيزياء الحاسوبية.
DOI: https://doi.org/10.21468/scipostphyscodeb.66
Publication Date: 2026-03-16
Author(s): Stefan Seckmeyer et al.
Primary Topic: Numerical methods for differential equations
Overview
The section presents FFTArray, a Python library designed to facilitate the discretization of Fourier transforms for solving partial differential equations (PDEs) in physical systems. Traditional Fourier spectral methods, while effective, face challenges in mapping Fourier integrals to discrete Fast Fourier Transforms (FFTs) due to complexities in grid selection and coordinate-dependent factors. FFTArray addresses these issues by providing an automated framework that simplifies the implementation of pseudo-spectral Fourier methods, allowing researchers to translate complex equations directly into code. Its modular design supports scaling from single to multiple dimensions and integrates seamlessly with popular array backends like NumPy, JAX, and PyTorch, enabling GPU acceleration for enhanced performance.
In conclusion, FFTArray not only streamlines the process of implementing discretized Fourier transforms on various coordinate grids but also significantly reduces the computational overhead associated with large-scale simulations. The library’s architecture promotes rapid prototyping of complex models, allowing researchers to concentrate on scientific inquiries rather than technical intricacies. The authors encourage the scientific community to contribute to FFTArray and expand its capabilities, highlighting its potential for broader applications beyond its current implementations. The performance of FFTArray has been validated on high-end computing systems, demonstrating its effectiveness for large-scale simulations in scientific research.
Introduction
The introduction discusses the challenges of modeling complex physical systems using differential equations that often do not yield closed-form solutions. Fourier integrals are highlighted as a valuable tool for approximating these solutions. The section then transitions to the performance analysis of simulation algorithms, specifically focusing on the time complexity associated with the Fast Fourier Transform (FFT). The complexity is noted as $O(n_{\text{samples}} \log n_{\text{samples}})$, where $n_{\text{samples}}$ represents the number of samples in each dimension. However, practical performance is influenced by various factors, including memory hierarchy and access patterns.
The study evaluates the performance of different implementations (FFTArray Direct and TorchGPE) across various grid configurations: 1D, 2D, 3D, and specific shapes relevant to applications like Bragg beam splitting. The results indicate that while the theoretical complexity suggests a logarithmic scaling, actual performance remains approximately linear across different hardware, with the exception of the 1D case on CPUs, which exhibits suboptimal scaling. This suggests that other factors, such as memory access patterns, play a significant role in computational efficiency, particularly in higher dimensions where performance is more uniform across layouts.
Methods
In the measurement methodology outlined, the researchers aimed to accurately assess computational speed in simulations involving numerous time steps. The procedure commenced with two preliminary runs, each utilizing two time steps, to mitigate initialization effects stemming from module imports and compilation caches that vary by system configuration and software versions. The focus was placed solely on timing the inner loop of the simulation, excluding any initialization or cleanup routines, while ensuring that results computed on the GPU were successfully transferred back to the CPU.
To minimize variability caused by external process interference, each measurement was repeated four times, with the minimum time recorded as the representative value. This approach presumes the existence of an optimal speed scenario, where runtime fluctuations are attributed to interruptions. The researchers leveraged the linear scaling of simulation time with respect to the number of time steps, as discussed in section A.3. For the data presented in figures 9 and 11 to 13, simulations were conducted with three distinct time step counts, calibrated to achieve a base runtime of approximately ten seconds. The other two groups were set to two and four times this base, targeting runtimes of 20 and 40 seconds, respectively. Each data point in the figures represents the slope of a linear fit derived from the minimum runtimes across the three time step variations.
Discussion
The discussion section of the paper highlights the limitations of traditional software frameworks that couple the definition of physics problems, Fourier-based differential equation solvers, and discretization methods into a monolithic structure. This complexity often leads to issues such as lack of generality, code duplication, and increased code complexity, making it challenging to maintain and adapt scientific simulations as systems grow in complexity. In contrast, the FFTArray library decouples these components, allowing researchers to focus on core physics and solver logic without the burden of low-level FFT implementation details. This architectural simplification enhances code maintainability and reusability, facilitating the rapid prototyping of diverse physical models.
FFTArray is designed to provide state-of-the-art performance, particularly for solving the Schrödinger equation in large quantum systems, and supports seamless multidimensionality. By encapsulating the numerical approximation of Fourier transforms on arbitrarily placed multi-dimensional grids, FFTArray allows users to directly map analytical equations to code, thereby streamlining the simulation process. The library is built on the Python Array API standard, ensuring compatibility with popular libraries like NumPy, JAX, and PyTorch, while also enabling GPU acceleration. Although developed with a focus on simulating atom-light interactions and ultracold atomic ensembles, FFTArray’s modular toolkit and efficient handling of discretized functions make it broadly applicable across various domains in computational physics.
