Hello All,
I am new to Python programming, and I can probably write a for-loop in Python, but not much else.
I would like to test the performance of a job scheduler on a high performance computer using Python, and I'm posting here to find out if someone can convert my Matlab function into Python. I know there are a couple of online coverters, but they're not capable of getting the job done. Here is the code:
Thanks
Edit: Note that isprime is a Matlab function that returns 1 if its arugment is prime, and 0 otherwise
I am new to Python programming, and I can probably write a for-loop in Python, but not much else.
I would like to test the performance of a job scheduler on a high performance computer using Python, and I'm posting here to find out if someone can convert my Matlab function into Python. I know there are a couple of online coverters, but they're not capable of getting the job done. Here is the code:
Quote:function total = matlab_prime (n,ncores)
% Returns the number of primes between 1 and n inclusive
tic;
total = 0;
parfor i = 2:n
total = total + isprime(i);
end
toc;
Thanks
Edit: Note that isprime is a Matlab function that returns 1 if its arugment is prime, and 0 otherwise