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

JSONDecodeError #113

Open
ATNoName opened this issue Feb 16, 2023 · 0 comments
Open

JSONDecodeError #113

ATNoName opened this issue Feb 16, 2023 · 0 comments

Comments

@ATNoName
Copy link

Issue Type

Bug

Source

source

Bifrost Version

0.8

Custom Code

No

OS Platform and Distribution

Windows 10 Home

Mobile device

No response

Python version

3.9

Current Behaviour?

Running bifrost_demo.py gives me a JSON Decode like this

image

the bifrost_demo.py is this:

# installing bifrost:
#   install Node.js 14 or 16 
#   pip install git+https://github.com/Distributive-Network/Bifrost


# DCP MODULE
from bifrost import dcp

# input_set : array containing arbitary, enumerable elements.
b_set = [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]

# work_function : function that will be mapped to each element in the input_set.
"Compute left Riemann sum of exp(-x^2) from 0 to b with N subintervals."
def riemann_sum(b,N=100000):

  # libraries required inside the work_function must be imported inside the work_function
  import numpy as np

  x = np.linspace(0,b,N+1)
  x_left_endpoints = x[:-1]
  Delta_x = b/N
  answer = Delta_x * np.sum(np.exp(-x_left_endpoints**2))

  return b, answer


# DCP Job definition, configuration, and execution
job = dcp.compute_for(b_set, riemann_sum)   # maps remann_sum to each element in b_set

job.requires('numpy')  # the work_function requires numpy
job.compute_groups = [{'joinKey': 'dan', 'joinSecret': 'dcp'}]  # open dcp.work/demo with join secret dcp to compute!
job.public['name'] = "My Numpy Riemann Sums Job, on DCP!"   # the job name that appears in the progress bars

results = job.exec(0.001)  # launch the job and debit 0.001 compute credits per slice (0.001 is the min)

# print the results
for result in results:
  print(result)

Standalone code to reproduce the issue

Just run bifrost_demo.py on the machine specified.

Relevant log output

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant