Update
This commit is contained in:
parent
5fcef73d3d
commit
ac6bc22edc
@ -32,7 +32,7 @@ async def main(a_start, b_end, sigma):
|
|||||||
|
|
||||||
# Uruchomienie głównej funkcji
|
# Uruchomienie głównej funkcji
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sigma = 510104288
|
sigma = 230531719
|
||||||
a = 1
|
a = 1
|
||||||
b = 7000
|
b = 10000
|
||||||
asyncio.run(main(a, b, sigma))
|
asyncio.run(main(a, b, sigma))
|
||||||
|
4
main.py
4
main.py
@ -27,7 +27,7 @@ async def compute(data: ComputeInput):
|
|||||||
b_end = int(data.b)
|
b_end = int(data.b)
|
||||||
sigma = data.sigma
|
sigma = data.sigma
|
||||||
|
|
||||||
num_chunks = 8
|
num_chunks = 16
|
||||||
|
|
||||||
chunk_size = (b_end - a_start + 1) // num_chunks
|
chunk_size = (b_end - a_start + 1) // num_chunks
|
||||||
ranges = [(a_start + i * chunk_size, min(a_start + (i + 1) * chunk_size - 1, b_end))
|
ranges = [(a_start + i * chunk_size, min(a_start + (i + 1) * chunk_size - 1, b_end))
|
||||||
@ -37,7 +37,7 @@ async def compute(data: ComputeInput):
|
|||||||
futures = [executor.submit(run_compute, a, b, sigma) for a, b in ranges]
|
futures = [executor.submit(run_compute, a, b, sigma) for a, b in ranges]
|
||||||
results = [f.result() for f in futures]
|
results = [f.result() for f in futures]
|
||||||
|
|
||||||
return sum(results)
|
return sum(results) % 999999937
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
uvicorn.run(app, host="0.0.0.0", port=8000)
|
uvicorn.run(app, host="0.0.0.0", port=8000)
|
||||||
|
Loading…
Reference in New Issue
Block a user