0

I want to create a vector with sitze 10^15 with numpy and MPI.

I have no clue how to start. I tried to use

v = np.random.rand(10**15,1)

but it exceeds my memory.

1

2 Answers 2

3

You can't. This is thousands terabytes of data, too much even for storing on disk. Consider redesigning your program to reduce amount of data or processing data iteratively.

Sign up to request clarification or add additional context in comments.

Comments

0

Dask arrays coordinate many Numpy arrays, arranged into chunks within a grid. They support a large subset of the Numpy API.

Call .compute() when you want your result as a NumPy array.

%%time
import dask.array as da
answer_sum = da.random.random((10**15)).sum().compute()
answer_mean = da.random.random((10**15)).mean().compute()
print(answer_sum)
print(answer_mean )

Source: https://examples.dask.org/array.html#Create-Random-array

1 Comment

While this code may solve the question, including an explanation of how and why this solves the problem would really help to improve the quality of your post, and probably result in more up-votes. Remember that you are answering the question for readers in the future, not just the person asking now. Please edit your answer to add explanations and give an indication of what limitations and assumptions apply.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.