Révision 259
| Pi/XPU/PiXPU.py (revision 259) | ||
|---|---|---|
| 3 | 3 |
# |
| 4 | 4 |
# Pi-by-MonteCarlo using PyCUDA/PyOpenCL |
| 5 | 5 |
# |
| 6 |
# performs an estimation of Pi using Monte Carlo method |
|
| 7 |
# a large amount of iterations is divided and distributed to compute units |
|
| 8 |
# a lot of options are provided to perform scalabilty tests |
|
| 9 |
# |
|
| 10 |
# use -h for complete set of options |
|
| 11 |
# |
|
| 6 | 12 |
# CC BY-NC-SA 2011 : Emmanuel QUEMENER <emmanuel.quemener@gmail.com> |
| 7 | 13 |
# Cecill v2 : Emmanuel QUEMENER <emmanuel.quemener@gmail.com> |
| 8 | 14 |
# |
| 15 |
|
|
| 9 | 16 |
# Thanks to Andreas Klockner for PyCUDA: |
| 10 | 17 |
# http://mathema.tician.de/software/pycuda |
| 11 | 18 |
# Thanks to Andreas Klockner for PyOpenCL: |
| ... | ... | |
| 665 | 672 |
|
| 666 | 673 |
# Set defaults values |
| 667 | 674 |
|
| 668 |
# Id of Device : 1 is for first find ! |
|
| 669 |
Device=1 |
|
| 670 | 675 |
# GPU style can be Cuda (Nvidia implementation) or OpenCL |
| 671 | 676 |
GpuStyle='OpenCL' |
| 672 | 677 |
# Iterations is integer |
| 673 |
Iterations=10000000 |
|
| 678 |
Iterations=1000000000
|
|
| 674 | 679 |
# BlocksBlocks in first number of Blocks to explore |
| 675 |
BlocksBegin=1 |
|
| 680 |
BlocksBegin=1024
|
|
| 676 | 681 |
# BlocksEnd is last number of Blocks to explore |
| 677 |
BlocksEnd=1 |
|
| 682 |
BlocksEnd=1024
|
|
| 678 | 683 |
# BlocksStep is the step of Blocks to explore |
| 679 | 684 |
BlocksStep=1 |
| 680 | 685 |
# ThreadsBlocks in first number of Blocks to explore |
| ... | ... | |
| 746 | 751 |
|
| 747 | 752 |
sys.exit() |
| 748 | 753 |
|
| 749 |
|
|
| 750 | 754 |
elif opt == '-o': |
| 751 | 755 |
OutMetrology=True |
| 752 | 756 |
Metrology='OutMetro' |
| ... | ... | |
| 781 | 785 |
elif opt in ("-r", "--redo"):
|
| 782 | 786 |
Redo = int(arg) |
| 783 | 787 |
|
| 788 |
# If no device has been specified, take the first one! |
|
| 789 |
if len(Devices)==0: |
|
| 790 |
Devices.append(0) |
|
| 791 |
|
|
| 784 | 792 |
print("Devices Identification : %s" % Devices)
|
| 785 | 793 |
print("GpuStyle used : %s" % GpuStyle)
|
| 786 | 794 |
print("Iterations : %s" % Iterations)
|
Formats disponibles : Unified diff