Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script stuck when using GPU with bend-cu but not when using CPU with bend or bend-c #498

Closed
2lian opened this issue May 25, 2024 · 2 comments
Labels
duplicate This issue or pull request already exists help wanted Extra attention is needed HVM About the HVM question Further information is requested

Comments

@2lian
Copy link

2lian commented May 25, 2024

Reproducing the behavior

I have this code that can only execute when using bend or bend-c (or their compiled equivalent). When using the GPU with bend-cu (or their compiled equivalent) it get stuck and use half of my GPU memory.

def BASE(): # global variable
  return 10

def pow_binary(number, power): # power of an int
  if power < 1:
    return 1
  else:
    bend x=power:
      when x>1:
        left = (x / 2)
        right = x - left
        mult = fork(left) * fork(right)
      else:
        mult = number
    return mult

def get_digit(number, Nth_digit):
  return (number / pow_binary(BASE(0), Nth_digit - 1)) % BASE(0)

def validate_narc(number, Nd): # Check if the number is a Narcissistic number
  bend Nth_digit = Nd:
    when Nth_digit > 1:
      digit = get_digit(number, Nth_digit)
      power_sum = pow_binary(digit, Nd) + fork(Nth_digit - 1)
    else:
      power_sum = pow_binary(number % BASE(0), Nd)
  return power_sum == number

def main:
  return validate_arm(407, 3)

The following functions work fine: get_digit(407, 1), get_digit(407, 2), get_digit(407, 3), get_digit(407, 4), pow_binary(10, 0), pow_binary(10, 1), ... Only validate_arm creates the bug.

Even more strange is that I have tried replacing number by the value 407 (while using bend-cu) like so:

def validate_narc(number, Nd): # Check if the number is a Narcissistic number
  bend Nth_digit = Nd:
    when Nth_digit > 1:
      digit = get_digit(407, Nth_digit)
      power_sum = pow_binary(digit, Nd) + fork(Nth_digit - 1)
    else:
      power_sum = pow_binary(number % BASE(0), Nd)
  return power_sum == number

And this did not get stuck.

(Other numbers than 407 also do not work)

System Settings

  • OS: WSL (Ubuntu 22.04)
  • CPU: Intel i5-12600K
  • GPU: GTX 1080Ti
  • Cuda Version 12.3
  • Updated version of bend+HVM 5 minutes ago

Additional context

No response

@developedby developedby added help wanted Extra attention is needed question Further information is requested HVM About the HVM labels May 26, 2024
@developedby
Copy link
Member

Hi, we're still working on support for older GPUs like the 1080Ti.
Honestly I don't know how it managed to even run, I expected some error messages to show.
We're tracking this HigherOrderCO/HVM#283 and here HigherOrderCO/HVM#314 .

@developedby developedby closed this as not planned Won't fix, can't repro, duplicate, stale May 26, 2024
@developedby developedby added the duplicate This issue or pull request already exists label May 26, 2024
@2lian
Copy link
Author

2lian commented May 27, 2024

I am the author of this rough fix, that's how I managed to run it: HigherOrderCO/HVM#314 (comment) .

I guess it's not that much of fix :'( , and I'll have to wait.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists help wanted Extra attention is needed HVM About the HVM question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants