TianZerL / pyanime4k

An easy way to use anime4k in python
MIT License
116 stars 17 forks source link

AC_ERROR_GPU_PROCESS #26

Open MikiP98 opened 4 months ago

MikiP98 commented 4 months ago

OS:

Windows

LIB Version:

newest as of now

Description:

When my loop:

current_factor = 1
while current_factor < factor:
    print(f"iteration: {current_factor}")

    parameters = pyanime4k.ac.Parameters()
    parameters.HDN = True
    a = pyanime4k.ac.AC(
        managerList=pyanime4k.ac.ManagerList([pyanime4k.ac.OpenCLACNetManager(pID=0, dID=0)]),
        type=pyanime4k.ac.ProcessorType.OpenCL_ACNet
    )

    a.load_image_from_numpy(np_image, input_type=pyanime4k.ac.AC_INPUT_RGB)

    a.process()
    current_factor *= 2

    np_image = a.save_image_to_numpy()

    # a = None  # REQUIRED, DO NOT DELETE! Else raises a GPU error!

runs for more then 1 iteration without the workaround the code will crash with:

  ...
  File "D:\...\MultiScaler-Plus\src\scaling\alghoritms\Anime4K.py", line 36, in scale
    a.process()
  File "C:\Users\...\AppData\Roaming\Python\Python312\site-packages\pyanime4k\ac.py", line 371, in process
    raise ACError(err)
pyanime4k.error.ACError: AC error: AC_ERROR_GPU_PROCESS

Running the whole function containing the loop 2 times does not result in a crash. The bug is present for a year now, but I did not have time to report it. The whole app in which the error manifests can be found here

Workaround:

Add line a = None at the end of an iteration