private void LogUnDisposedCudaArrays(AllocationStats allocationStats) { if (allocationStats.ActiveAllocations.Count == 0) { return; } _logger.Warn("found {numUnDisposedCudaArrays} CudaArray's left un-disposed at context cleanup, totalling {unDisposedMb:F3} MB [{unDisposedCudaArrays}]", new { unDisposedCudaArrays = string.Join("", allocationStats.ActiveAllocations.Select(a => a.GetShortDescription() + "\n")), numUnDisposedCudaArrays = allocationStats.ActiveAllocations.Count, unDisposedMb = allocationStats.ActiveAllocations.Sum(a => a.NumBytes) / 1024.0 / 1024.0, }); }
private void TeardownForThread() { Current = null; AllocationStats = null; }
private void SetupForThread() { AllocationStats = new AllocationStats(); Current = this; }