Commit 0be69ecd authored by Laanait, Nouamane's avatar Laanait, Nouamane
Browse files

minor bugs in context creation/deletion

parent 98a9a267
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -338,9 +338,10 @@ class MSAHybrid(MSA):
    @staticmethod
    def clean_up(ctx):
        ctx.pop()
        ctx.detach()
        ctx = None
        from pycuda.tools import clear_context_caches
        clear_context_caches()
        ctx.detach()
        
    def plan_simulation(self, num_probes=None):
        if num_probes is None:
@@ -750,6 +751,14 @@ class MSAGPU(MSAHybrid):
            simplefilter('ignore')
            catch_warn()
            self.probes = self.probes.astype(np.float32) # discard imaginary
        # clean up device variables
        self.pot_dev_ptr.free()
        mask_d.free()
        propag_d.free()
        psi_k_d.free()
        grid_range_d.free()
        grid_steps_d.free()
        ones_d.free()

    def __propagate_beams(self, num_probes, batch, psi_pos_d, propag_d, psi_k_d,
                        norm_const_d, grid_steps_d, grid_range_d,