Dhairya Malhotra 7 lat temu
rodzic
commit
f67fc384d3
2 zmienionych plików z 4 dodań i 4 usunięć
  1. 0 1
      include/sctl/comm.txx
  2. 4 3
      include/sctl/fft_wrapper.hpp

+ 0 - 1
include/sctl/comm.txx

@@ -980,7 +980,6 @@ template <class Type> void Comm::HyperQuickSort(const Vector<Type>& arr_, Vector
 
   Long totSize, nelem = arr_.Dim();
   {                 // Local and global sizes. O(log p)
-    assert(nelem);  // TODO: Check if this is needed.
     Allreduce<Long>(Ptr2ConstItr<Long>(&nelem, 1), Ptr2Itr<Long>(&totSize, 1), 1, CommOp::SUM);
   }
 

+ 4 - 3
include/sctl/fft_wrapper.hpp

@@ -323,7 +323,7 @@ template <> class FFT<double> : public FFT_Generic<double, FFT<double>> {
   ~FFT() { if (this->Dim(0) && this->Dim(1)) fftw_destroy_plan(plan); }
 
   void Setup(FFT_Type fft_type_, Long howmany_, const Vector<Long>& dim_vec) {
-    if (Dim(0) && Dim(1)) fftw_destroy_plan(plan);
+    if (Dim(0) && Dim(1)) fftw_destroy_plan(plan); plan = NULL;
     this->fft_type = fft_type_;
     this->howmany = howmany_;
 
@@ -383,6 +383,7 @@ template <> class FFT<double> : public FFT_Generic<double, FFT<double>> {
   }
 
   void Execute(const Vector<ValueType>& in, Vector<ValueType>& out) const {
+    // TODO: check alignment of in and out
     Long N0 = this->Dim(0);
     Long N1 = this->Dim(1);
     if (!N0 || !N1) return;
@@ -429,7 +430,7 @@ template <> class FFT<float> : public FFT_Generic<float, FFT<float>> {
   ~FFT() { if (this->Dim(0) && this->Dim(1)) fftwf_destroy_plan(plan); }
 
   void Setup(FFT_Type fft_type_, Long howmany_, const Vector<Long>& dim_vec) {
-    if (Dim(0) && Dim(1)) fftwf_destroy_plan(plan);
+    if (Dim(0) && Dim(1)) fftwf_destroy_plan(plan); plan = NULL;
     this->fft_type = fft_type_;
     this->howmany = howmany_;
 
@@ -535,7 +536,7 @@ template <> class FFT<long double> : public FFT_Generic<long double, FFT<long do
   ~FFT() { if (this->Dim(0) && this->Dim(1)) fftwl_destroy_plan(plan); }
 
   void Setup(FFT_Type fft_type_, Long howmany_, const Vector<Long>& dim_vec) {
-    if (Dim(0) && Dim(1)) fftwl_destroy_plan(plan);
+    if (Dim(0) && Dim(1)) fftwl_destroy_plan(plan); plan = NULL;
     this->fft_type = fft_type_;
     this->howmany = howmany_;