diff --git a/dd/cudd.pyx b/dd/cudd.pyx index 49e96d2e..470bd1b3 100644 --- a/dd/cudd.pyx +++ b/dd/cudd.pyx @@ -279,12 +279,17 @@ cdef class BDD(object): if memory_estimate is None: memory_estimate = default_memory if memory_estimate >= total_memory: - print( + print(( 'Error in `dd.cudd`: ' 'total physical memory is {t} bytes, ' - 'but requested {r} bytes').format( + 'but requested {r} bytes. ' + 'Please pass an amount of memory to ' + 'the `BDD` constructor to avoid this error. ' + 'For example, by instantiating ' + 'the `BDD` manager as `BDD({q})`.').format( t=total_memory, - r=memory_estimate) + r=memory_estimate, + q=round(total_memory / 2))) assert memory_estimate < total_memory, ( memory_estimate, total_memory) if initial_cache_size is None: diff --git a/doc.md b/doc.md index 054b2d91..12f92d66 100644 --- a/doc.md +++ b/doc.md @@ -612,6 +612,9 @@ heuristics for deciding *when* to invoke reordering. CUDD is initialized with a `memory_estimate` of 1 GB. If the machine has les RAM, then `cudd.BDD` will raise an error. In this case, pass a smaller initial memory estimate, for example `cudd.BDD(memory_estimate=0.5 * 2**30)`. +The package [`humanize`](https://pypi.org/project/humanize/) is useful for +reading memory sizes, for example `humanize.naturalsize(1073741824, gnu=True)` +returns `'1.0G'`. ### Functions