Example #1
0
if n_classes_hist < 2:
    n_classes_hist = 20  # default value
    print(
        "n_classes_hist should not be inferior than 2. Assigned to default value (20)."
    )

events = np.load('events_eruption_v8.npy', fix_imports=True, encoding='latin1')

#events=np.ones((7, 10),dtype=np.float32)

tiempos = np.zeros(1)

for i in range(1):
    start = time.time()
    xcm_pos, xclags_pos, xcm_neg, xclags_neg, max_hist, min_hist =\
        compute_correlation(events, 250, num_threads, chunk_size, threshold, n_classes_hist)
    diff_time = time.time() - start
    print("Execution finished in: " + str(diff_time))
    tiempos[i] = diff_time

print("Max: " + str(tiempos.max()) + " Mean: " + str(tiempos.mean()) +
      " Min: " + str(tiempos.min()))

xcm_pos = csr_matrix(xcm_pos, dtype=np.float32)
xclags_pos = csr_matrix(xclags_pos, dtype=np.int32)
xcm_neg = csr_matrix(xcm_neg, dtype=np.float32)
xclags_neg = csr_matrix(xclags_neg, dtype=np.int32)
max_hist = csr_matrix(max_hist, dtype=np.int32)
min_hist = csr_matrix(min_hist, dtype=np.int32)

save_npz('out_xcm_pos.npz', xcm_pos, compressed=True)
Example #2
0
num_threads = int(sys.argv[1])
threshold = float(sys.argv[2])

initialiseRunTime()

events = np.load('events_eruption_v8.npy', fix_imports=True, encoding='latin1')

#events=np.ones((7, 10),dtype=np.float32)
times_loop = 1
tiempos = np.zeros(times_loop)

print("The number of threads is: " + str(num_threads))

for i in range(times_loop):
    start = time.time()
    xcm_pos, xclags_pos, xcm_neg, xclags_neg = compute_correlation(
        events, 256, num_threads, threshold)
    diff_time = time.time() - start
    print("Execution finished in: " + str(diff_time))
    tiempos[i] = diff_time

print("Max: " + str(tiempos.max()) + " Mean: " + str(tiempos.mean()) +
      " Min: " + str(tiempos.min()))

xcm_pos = csr_matrix(xcm_pos, dtype=np.float32)
xclags_pos = csr_matrix(xclags_pos, dtype=np.int32)
xcm_neg = csr_matrix(xcm_neg, dtype=np.float32)
xclags_neg = csr_matrix(xclags_neg, dtype=np.int32)

save_npz('out_xcm_pos.npz', xcm_pos, compressed=True)
save_npz('out_xcl_pos.npz', xclags_pos, compressed=True)
save_npz('out_xcm_neg.npz', xcm_neg, compressed=True)
Example #3
0
nGPUS = int(sys.argv[1])
threshold = float(sys.argv[2])

initialiseRunTime(nGPUS)

events = np.load('events_eruption_v8.npy', fix_imports=True, encoding='latin1')

#events=np.ones((7, 10),dtype=np.float32)
times_loop = 1
tiempos = np.zeros(times_loop)

print("The number of gpus to use is: " + str(nGPUS))

for i in range(times_loop):
    start = time.time()
    xcm_pos, xclags_pos, xcm_neg, xclags_neg, python_time = compute_correlation(
        events, 256, nGPUS, threshold)
    diff_time = time.time() - start - python_time
    print("Execution finished in: " + str(diff_time))
    tiempos[i] = diff_time

print("Max: " + str(tiempos.max()) + " Mean: " + str(tiempos.mean()) +
      " Min: " + str(tiempos.min()))

xcm_pos = csr_matrix(xcm_pos, dtype=np.float32)
xclags_pos = csr_matrix(xclags_pos, dtype=np.int32)
xcm_neg = csr_matrix(xcm_neg, dtype=np.float32)
xclags_neg = csr_matrix(xclags_neg, dtype=np.int32)

save_npz('out_xcm_pos.npz', xcm_pos, compressed=True)
save_npz('out_xcl_pos.npz', xclags_pos, compressed=True)
save_npz('out_xcm_neg.npz', xcm_neg, compressed=True)
Example #4
0
import numpy as np

import time

from correlation_lib import compute_correlation

events = np.load('events_eruption_v8.npy', fix_imports=True, encoding='latin1')

#events=np.ones((128, 1500),dtype=np.float64)
num_threads = 4

tiempos = np.zeros(1)

for i in range(1):
    start = time.time()
    xcm_pos, xclags_pos, xcm_neg, xclags_neg = compute_correlation(
        events, 250, num_threads)
    diff_time = time.time() - start
    print("Execution finished in: " + str(diff_time))
    tiempos[i] = diff_time

print("Max: " + str(tiempos.max()) + " Mean: " + str(tiempos.mean()) +
      " Min: " + str(tiempos.min()))

np.savetxt('xcm_v1_neg.txt', xcm_neg, delimiter='\t', fmt='%6.3f')

np.savetxt('xcl_v1_neg.txt', xclags_neg, delimiter='\t', fmt='%6.0f')

np.savetxt('xcm_v1_pos.txt', xcm_pos, delimiter='\t', fmt='%6.3f')

np.savetxt('xcl_v1_pos.txt', xclags_pos, delimiter='\t', fmt='%6.0f')
Example #5
0
import numpy as np

import time

from correlation_lib import compute_correlation

events = np.load('events_eruption_v8.npy', fix_imports=True, encoding='latin1')

#events=np.ones((128, 1500),dtype=np.float64)

tiempos = np.zeros(1)

for i in range(1):
    start = time.time()
    xcm_pos, xclags_pos, xcm_neg, xclags_neg = compute_correlation(events, 250)
    diff_time = time.time() - start
    print("Execution finished in: " + str(diff_time))
    tiempos[i] = diff_time

print("Max: " + str(tiempos.max()) + " Mean: " + str(tiempos.mean()) +
      " Min: " + str(tiempos.min()))

np.savetxt('xcm_v1_neg.txt', xcm_neg, delimiter='\t', fmt='%6.3f')

np.savetxt('xcl_v1_neg.txt', xclags_neg, delimiter='\t', fmt='%6.0f')

np.savetxt('xcm_v1_pos.txt', xcm_pos, delimiter='\t', fmt='%6.3f')

np.savetxt('xcl_v1_pos.txt', xclags_pos, delimiter='\t', fmt='%6.0f')