Skip to content

Instantly share code, notes, and snippets.

[ Info: CUDA is on
[ Info: Epoch 1
ERROR: LoadError: Scalar indexing is disallowed.
Invocation of getindex resulted in scalar indexing of a GPU array.
This is typically caused by calling an iterating implementation of a method.
Such implementations *do not* execute on the GPU, but very slowly on the CPU,
and therefore are only permitted from the REPL for prototyping purposes.
If you did intend to index this array, annotate the caller with @allowscalar.
Stacktrace:
[1] error(s::String)
import numpy as np
import random as rand
from numpy.linalg import inv
from numpy.linalg import norm
from scipy.optimize import minimize
from scipy.optimize import linprog
import warnings
import time
import sys
from memory_profiler import profile
Line # Mem usage Increment Line Contents
================================================
320 37.2 MiB 0.0 MiB @profile
321 def func():
322 37.2 MiB 0.0 MiB n_products = input("Enter the number of products (that is add +1 to the actual number) : ")
323 37.2 MiB 0.0 MiB time_steps = input("Enter the number of time steps (should be equal to the above number of products) : ")
324 37.2 MiB 0.0 MiB demand_mat = input("Enter the demand matrix with time instance as columns and products as rows : ")
325 37.2 MiB 0.0 MiB max_price = input("Enter the maximum price for each product as an array : ")
326 37.2 MiB 0.0 MiB min_price = input("Enter the minimum price for each product as an array : ")
327 37.2 MiB 0.0 MiB print "Creating the pricing object "
import numpy as np
import random as rand
from numpy.linalg import inv
from numpy.linalg import norm
from scipy.optimize import minimize
from scipy.optimize import linprog
import warnings
import time
import sys
import numpy as np
import random as rand
from numpy.linalg import inv
from numpy.linalg import norm
from scipy.optimize import minimize
from scipy.optimize import linprog
import warnings
import time
import sys
import numpy as np
import random as rand
from numpy.linalg import inv
from numpy.linalg import norm
from scipy.optimize import minimize
from scipy.optimize import linprog
import warnings
import time
import sys
import numpy as np
import random as rand
from numpy.linalg import inv
from numpy.linalg import norm
from scipy.optimize import minimize
from scipy.optimize import linprog
import warnings
import time
import sys
import numpy as np
import random as rand
import multiprocessing
import logging
import warnings
import os
import time
import sys
from numpy.linalg import inv
from numpy.linalg import norm
import numpy as np
import random as rand
from numpy.linalg import inv
from numpy.linalg import norm
from scipy.optimize import minimize
from scipy.optimize import linprog
import warnings
import time
import sys
import numpy as np
import random as rand
from numpy.linalg import inv
from numpy.linalg import norm
from scipy.optimize import minimize
from scipy.optimize import linprog
import warnings
import time
import sys