Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ras-devel
FLAG
Commits
933d4754
Commit
933d4754
authored
May 23, 2019
by
Mark Ruzindana
Browse files
Writing to unmodified binary file in flag_beamsave_thread.c
parent
296a69d0
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
126 additions
and
10 deletions
+126
-10
versions/scalloping/lib/beamformer/src/cublas_beamformer.cu
versions/scalloping/lib/beamformer/src/cublas_beamformer.cu
+1
-3
versions/scalloping/lib/beamformer/src/cublas_beamformer_pinned.cu
...scalloping/lib/beamformer/src/cublas_beamformer_pinned.cu
+1
-3
versions/scalloping/lib/hashpipe/src/null_output_thread.c
versions/scalloping/lib/hashpipe/src/null_output_thread.c
+2
-0
versions/scalloping/lib/pfb/src/main
versions/scalloping/lib/pfb/src/main
+0
-0
versions/scalloping/lib/xGPU/src/xgpu_version.h
versions/scalloping/lib/xGPU/src/xgpu_version.h
+1
-1
versions/scalloping/src/flag_beamsave_thread.c
versions/scalloping/src/flag_beamsave_thread.c
+5
-2
versions/scalloping/src/flag_beamsave_thread_bin.c
versions/scalloping/src/flag_beamsave_thread_bin.c
+112
-0
versions/scalloping/src/flag_net_thread.c
versions/scalloping/src/flag_net_thread.c
+3
-1
versions/scalloping/src/flag_transpose_beamform_thread.c
versions/scalloping/src/flag_transpose_beamform_thread.c
+1
-0
No files found.
versions/scalloping/lib/beamformer/src/cublas_beamformer.cu
View file @
933d4754
...
@@ -57,7 +57,7 @@ void update_weights(char * filename){
...
@@ -57,7 +57,7 @@ void update_weights(char * filename){
//weights_dc = (float complex *)malloc(BN_WEIGHTS*sizeof(float complex *));
//weights_dc = (float complex *)malloc(BN_WEIGHTS*sizeof(float complex *));
//weights_dc_n = (float complex *)malloc(BN_WEIGHTS*sizeof(float complex *));
//weights_dc_n = (float complex *)malloc(BN_WEIGHTS*sizeof(float complex *));
// For pinned memory ////////////////////////////////////////////////////
// For pinned memory ////////////////////////////////////////////////////
// Weights do
es
n't need pinned memory implemented because it is less than 16 MB ///////////
// Weights don't need pinned memory implemented because it is less than 16 MB ///////////
cudaMallocHost
((
void
**
)
&
bf_weights
,
2
*
BN_WEIGHTS
*
sizeof
(
float
complex
*
));
cudaMallocHost
((
void
**
)
&
bf_weights
,
2
*
BN_WEIGHTS
*
sizeof
(
float
complex
*
));
cudaMallocHost
((
void
**
)
&
weights_dc
,
BN_WEIGHTS
*
sizeof
(
float
complex
*
));
cudaMallocHost
((
void
**
)
&
weights_dc
,
BN_WEIGHTS
*
sizeof
(
float
complex
*
));
cudaMallocHost
((
void
**
)
&
weights_dc_n
,
BN_WEIGHTS
*
sizeof
(
float
complex
*
));
cudaMallocHost
((
void
**
)
&
weights_dc_n
,
BN_WEIGHTS
*
sizeof
(
float
complex
*
));
...
@@ -728,7 +728,6 @@ void rtbfCleanup() {
...
@@ -728,7 +728,6 @@ void rtbfCleanup() {
if
(
d_data1
!=
NULL
)
{
if
(
d_data1
!=
NULL
)
{
cudaFree
(
d_data1
);
cudaFree
(
d_data1
);
//cudaFreeHost(d_data1); // Clean up pinned memory (use cudaFreeHost() with cudaMallocHost())
}
}
if
(
d_data2
!=
NULL
)
{
if
(
d_data2
!=
NULL
)
{
...
@@ -741,7 +740,6 @@ void rtbfCleanup() {
...
@@ -741,7 +740,6 @@ void rtbfCleanup() {
if
(
d_weights
!=
NULL
)
{
if
(
d_weights
!=
NULL
)
{
cudaFree
(
d_weights
);
cudaFree
(
d_weights
);
//cudaFreeHost(d_weights); // Clean up pinned memory (use cudaFreeHost() with cudaMallocHost())
}
}
if
(
d_arr_A
!=
NULL
)
{
if
(
d_arr_A
!=
NULL
)
{
...
...
versions/scalloping/lib/beamformer/src/cublas_beamformer_pinned.cu
View file @
933d4754
...
@@ -57,7 +57,7 @@ void update_weights(char * filename){
...
@@ -57,7 +57,7 @@ void update_weights(char * filename){
//weights_dc = (float complex *)malloc(BN_WEIGHTS*sizeof(float complex *));
//weights_dc = (float complex *)malloc(BN_WEIGHTS*sizeof(float complex *));
//weights_dc_n = (float complex *)malloc(BN_WEIGHTS*sizeof(float complex *));
//weights_dc_n = (float complex *)malloc(BN_WEIGHTS*sizeof(float complex *));
// For pinned memory ////////////////////////////////////////////////////
// For pinned memory ////////////////////////////////////////////////////
// Weights do
es
n't need pinned memory implemented because it is less than 16 MB ///////////
// Weights don't need pinned memory implemented because it is less than 16 MB ///////////
cudaMallocHost
((
void
**
)
&
bf_weights
,
2
*
BN_WEIGHTS
*
sizeof
(
float
complex
*
));
cudaMallocHost
((
void
**
)
&
bf_weights
,
2
*
BN_WEIGHTS
*
sizeof
(
float
complex
*
));
cudaMallocHost
((
void
**
)
&
weights_dc
,
BN_WEIGHTS
*
sizeof
(
float
complex
*
));
cudaMallocHost
((
void
**
)
&
weights_dc
,
BN_WEIGHTS
*
sizeof
(
float
complex
*
));
cudaMallocHost
((
void
**
)
&
weights_dc_n
,
BN_WEIGHTS
*
sizeof
(
float
complex
*
));
cudaMallocHost
((
void
**
)
&
weights_dc_n
,
BN_WEIGHTS
*
sizeof
(
float
complex
*
));
...
@@ -728,7 +728,6 @@ void rtbfCleanup() {
...
@@ -728,7 +728,6 @@ void rtbfCleanup() {
if
(
d_data1
!=
NULL
)
{
if
(
d_data1
!=
NULL
)
{
cudaFree
(
d_data1
);
cudaFree
(
d_data1
);
//cudaFreeHost(d_data1); // Clean up pinned memory (use cudaFreeHost() with cudaMallocHost())
}
}
if
(
d_data2
!=
NULL
)
{
if
(
d_data2
!=
NULL
)
{
...
@@ -741,7 +740,6 @@ void rtbfCleanup() {
...
@@ -741,7 +740,6 @@ void rtbfCleanup() {
if
(
d_weights
!=
NULL
)
{
if
(
d_weights
!=
NULL
)
{
cudaFree
(
d_weights
);
cudaFree
(
d_weights
);
//cudaFreeHost(d_weights); // Clean up pinned memory (use cudaFreeHost() with cudaMallocHost())
}
}
if
(
d_arr_A
!=
NULL
)
{
if
(
d_arr_A
!=
NULL
)
{
...
...
versions/scalloping/lib/hashpipe/src/null_output_thread.c
View file @
933d4754
...
@@ -69,6 +69,8 @@ static void *run(hashpipe_thread_args_t * args)
...
@@ -69,6 +69,8 @@ static void *run(hashpipe_thread_args_t * args)
hputi4
(
st
.
buf
,
"NULBLKIN"
,
block_idx
);
hputi4
(
st
.
buf
,
"NULBLKIN"
,
block_idx
);
hashpipe_status_unlock_safe
(
&
st
);
hashpipe_status_unlock_safe
(
&
st
);
fprintf
(
stderr
,
"Writing to /dev/null
\n
"
);
// Mark block as free
// Mark block as free
hashpipe_databuf_set_free
(
db
,
block_idx
);
hashpipe_databuf_set_free
(
db
,
block_idx
);
...
...
versions/scalloping/lib/pfb/src/main
View file @
933d4754
No preview for this file type
versions/scalloping/lib/xGPU/src/xgpu_version.h
View file @
933d4754
#define XGPU_VERSION 0.1+18
2
@g
6ce42de
-dirty
#define XGPU_VERSION 0.1+18
3
@g
296a69d
-dirty
versions/scalloping/src/flag_beamsave_thread.c
View file @
933d4754
...
@@ -71,8 +71,11 @@ static void * run(hashpipe_thread_args_t * args) {
...
@@ -71,8 +71,11 @@ static void * run(hashpipe_thread_args_t * args) {
hashpipe_status_unlock_safe
(
&
st
);
hashpipe_status_unlock_safe
(
&
st
);
char
filename
[
256
];
char
filename
[
256
];
sprintf
(
filename
,
"%s/TGBT16A_508_01/TMP/BF/beamformer_%s_mcnt_%lld.out"
,
data_dir
,
BANK
,
(
long
long
)
start_mcnt
);
//sprintf(filename, "%s/TGBT16A_508_01/TMP/BF/beamformer_%s_mcnt_%lld.out", data_dir, BANK, (long long)start_mcnt);
fprintf
(
stderr
,
"Saving to %s
\n
"
,
filename
);
//fprintf(stderr, "Saving to %s\n", filename);
//sprintf(filename, "/dev/null");
sprintf
(
filename
,
"%s/TGBT16A_508_01/TMP/BF/beamformer_%s.out"
,
data_dir
,
BANK
);
fprintf
(
stderr
,
"Saving to %s at mcnt %lld
\n
"
,
filename
,
(
long
long
)
start_mcnt
);
//printf("RTBF: mcnt: %lld\n", (long long)start_mcnt);
//printf("RTBF: mcnt: %lld\n", (long long)start_mcnt);
if
(
SAVE
)
{
if
(
SAVE
)
{
float
*
p
=
(
float
*
)
db_in
->
block
[
curblock_in
].
data
;
float
*
p
=
(
float
*
)
db_in
->
block
[
curblock_in
].
data
;
...
...
versions/scalloping/src/flag_beamsave_thread_bin.c
0 → 100644
View file @
933d4754
/* flag_beamsave_thread.c
*
* Routine to save total power outputs to file for data verification
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
#include "hashpipe.h"
#include "flag_databuf.h"
#include <xgpu.h>
// #include "total_power.h"
// Create thread status buffer
static
hashpipe_status_t
*
st_p
;
// Run method for the thread
static
void
*
run
(
hashpipe_thread_args_t
*
args
)
{
// Local aliases to shorten access to args fields
flag_gpu_beamformer_output_databuf_t
*
db_in
=
(
flag_gpu_beamformer_output_databuf_t
*
)
args
->
ibuf
;
hashpipe_status_t
st
=
args
->
st
;
const
char
*
status_key
=
args
->
thread_desc
->
skey
;
st_p
=
&
st
;
// allow global (this source file) access to the status buffer
//int instance_id = args[0].instance_id;
char
data_dir
[
128
];
hashpipe_status_lock_safe
(
&
st
);
hgets
(
st
.
buf
,
"DATADIR"
,
127
,
data_dir
);
hashpipe_status_unlock_safe
(
&
st
);
if
(
data_dir
==
NULL
)
{
printf
(
"SAV: DATADIR = .
\n
"
);
}
else
{
printf
(
"SAV: DATADIR = %s
\n
"
,
data_dir
);
}
// Mark thread as ready to run
hashpipe_status_lock_safe
(
&
st
);
hputi4
(
st
.
buf
,
"SAVEREADY"
,
1
);
hashpipe_status_unlock_safe
(
&
st
);
int
rv
;
int
curblock_in
=
0
;
while
(
run_threads
())
{
// Wait for input buffer block to be filled
while
((
rv
=
flag_gpu_beamformer_output_databuf_wait_filled
(
db_in
,
curblock_in
))
!=
HASHPIPE_OK
)
{
if
(
rv
==
HASHPIPE_TIMEOUT
)
{
hashpipe_status_lock_safe
(
&
st
);
hputs
(
st
.
buf
,
status_key
,
"waiting for free block"
);
hashpipe_status_unlock_safe
(
&
st
);
}
else
{
hashpipe_error
(
__FUNCTION__
,
"error waiting for filled databuf block"
);
pthread_exit
(
NULL
);
break
;
}
}
uint64_t
start_mcnt
=
db_in
->
block
[
curblock_in
].
header
.
mcnt
;
int
good_data
=
(
int
)(
db_in
->
block
[
curblock_in
].
header
.
good_data
);
char
BANK
[
5
];
hashpipe_status_lock_safe
(
&
st
);
hgets
(
st
.
buf
,
"DATADIR"
,
127
,
data_dir
);
hgets
(
st
.
buf
,
"BANKNAM"
,
4
,
BANK
);
hashpipe_status_unlock_safe
(
&
st
);
char
filename
[
256
];
//sprintf(filename, "%s/TGBT16A_508_01/TMP/BF/beamformer_%s_mcnt_%lld.out", data_dir, BANK, (long long)start_mcnt);
//fprintf(stderr, "Saving to %s\n", filename);
//sprintf(filename, "/dev/null");
sprintf
(
filename
,
"%s/TGBT16A_508_01/TMP/BF/beamformer_%s.out"
,
data_dir
,
BANK
);
fprintf
(
stderr
,
"Saving to %s at mcnt %lld
\n
"
,
filename
,
(
long
long
)
start_mcnt
);
//printf("RTBF: mcnt: %lld\n", (long long)start_mcnt);
if
(
SAVE
)
{
float
*
p
=
(
float
*
)
db_in
->
block
[
curblock_in
].
data
;
FILE
*
filePtr
=
fopen
(
filename
,
"w"
);
fwrite
(
p
,
sizeof
(
float
),
N_BEAM_SAMPS
,
filePtr
);
fwrite
(
&
good_data
,
sizeof
(
int
),
1
,
filePtr
);
fclose
(
filePtr
);
}
// Mark input block as free and wait for next block
flag_gpu_beamformer_output_databuf_set_free
(
db_in
,
curblock_in
);
curblock_in
=
(
curblock_in
+
1
)
%
db_in
->
header
.
n_block
;
// Check if program killed
pthread_testcancel
();
}
// Thread terminates after loop
return
NULL
;
}
// Thread description
static
hashpipe_thread_desc_t
bsave_thread
=
{
name:
"flag_beamsave_thread"
,
skey:
"BEAMSAVE"
,
init:
NULL
,
run:
run
,
ibuf_desc:
{
flag_gpu_beamformer_output_databuf_create
},
obuf_desc:
{
NULL
}
};
static
__attribute__
((
constructor
))
void
ctor
()
{
register_hashpipe_thread
(
&
bsave_thread
);
}
versions/scalloping/src/flag_net_thread.c
View file @
933d4754
...
@@ -292,7 +292,7 @@ static inline int64_t process_packet(flag_input_databuf_t * db, struct hashpipe_
...
@@ -292,7 +292,7 @@ static inline int64_t process_packet(flag_input_databuf_t * db, struct hashpipe_
while
((
rv
=
flag_input_databuf_wait_free
(
db
,
get_block_idx
(
b
)))
!=
HASHPIPE_OK
)
{
while
((
rv
=
flag_input_databuf_wait_free
(
db
,
get_block_idx
(
b
)))
!=
HASHPIPE_OK
)
{
if
(
rv
==
HASHPIPE_TIMEOUT
)
{
if
(
rv
==
HASHPIPE_TIMEOUT
)
{
printf
(
"NET: HANGING HERE!!!!!!!!!!
\n
"
);
printf
(
"NET:
Initializing next block,
HANGING HERE!!!!!!!!!!
\n
"
);
continue
;
continue
;
}
}
else
{
else
{
...
@@ -365,6 +365,7 @@ static inline int64_t process_packet(flag_input_databuf_t * db, struct hashpipe_
...
@@ -365,6 +365,7 @@ static inline int64_t process_packet(flag_input_databuf_t * db, struct hashpipe_
int
rv
;
int
rv
;
while
((
rv
=
flag_input_databuf_wait_free
(
db
,
dest_block_idx
))
!=
HASHPIPE_OK
)
{
while
((
rv
=
flag_input_databuf_wait_free
(
db
,
dest_block_idx
))
!=
HASHPIPE_OK
)
{
if
(
rv
==
HASHPIPE_TIMEOUT
)
{
if
(
rv
==
HASHPIPE_TIMEOUT
)
{
printf
(
"NET: Calculating starting points, HANGING HERE!!!!!!!!!!
\n
"
);
continue
;
continue
;
}
}
else
{
else
{
...
@@ -525,6 +526,7 @@ static void *run(hashpipe_thread_args_t * args) {
...
@@ -525,6 +526,7 @@ static void *run(hashpipe_thread_args_t * args) {
// Wait until block semaphore is free
// Wait until block semaphore is free
while
((
rv
=
flag_input_databuf_wait_free
(
db
,
i
))
!=
HASHPIPE_OK
)
{
while
((
rv
=
flag_input_databuf_wait_free
(
db
,
i
))
!=
HASHPIPE_OK
)
{
if
(
rv
==
HASHPIPE_TIMEOUT
)
{
if
(
rv
==
HASHPIPE_TIMEOUT
)
{
printf
(
"NET: Waiting until semaphore is free, HANGING HERE!!!!!!!!!!
\n
"
);
continue
;
continue
;
}
}
if
(
errno
==
EINTR
)
{
// Interrupt occurred
if
(
errno
==
EINTR
)
{
// Interrupt occurred
...
...
versions/scalloping/src/flag_transpose_beamform_thread.c
View file @
933d4754
...
@@ -196,6 +196,7 @@ static void * run(hashpipe_thread_args_t * args) {
...
@@ -196,6 +196,7 @@ static void * run(hashpipe_thread_args_t * args) {
// Wait for output block to become free
// Wait for output block to become free
while
((
rv
=
flag_gpu_beamformer_output_databuf_wait_free
(
db_out
,
curblock_out
))
!=
HASHPIPE_OK
)
{
while
((
rv
=
flag_gpu_beamformer_output_databuf_wait_free
(
db_out
,
curblock_out
))
!=
HASHPIPE_OK
)
{
if
(
rv
==
HASHPIPE_TIMEOUT
)
{
if
(
rv
==
HASHPIPE_TIMEOUT
)
{
printf
(
"RTBF: Waiting for output block to be free, HANGING HERE!!!!!!!!!!
\n
"
);
continue
;
continue
;
}
else
{
}
else
{
hashpipe_error
(
__FUNCTION__
,
"error waiting for free databuf"
);
hashpipe_error
(
__FUNCTION__
,
"error waiting for free databuf"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment