Skip to content

Commit d0416e5

Browse files
committed
* ~~integer~~float_data flag inversion
- better align with integer data being the default
1 parent 33e1f2d commit d0416e5

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

rawspec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ int main(int argc, char *argv[])
622622
fprintf(stderr, "OBSNCHAN = %d\n", raw_hdr.obsnchan);
623623
fprintf(stderr, "NANTS = %d\n", raw_hdr.nants);
624624
fprintf(stderr, "NBITS = %d\n", raw_hdr.nbits);
625-
fprintf(stderr, "INTEGER DATA = %d\n", raw_hdr.integer_data);
625+
fprintf(stderr, "FLOATDATA= %d\n", raw_hdr.float_data);
626626
fprintf(stderr, "NPOL = %d\n", raw_hdr.npol);
627627
fprintf(stderr, "OBSFREQ = %g\n", raw_hdr.obsfreq);
628628
fprintf(stderr, "OBSBW = %g\n", raw_hdr.obsbw);
@@ -757,7 +757,7 @@ int main(int argc, char *argv[])
757757
ctx.Ntpb = Ntpb;
758758
ctx.Nbps = Nbps;
759759
ctx.input_conjugated = input_conjugated;
760-
ctx.integer_data = raw_hdr.integer_data;
760+
ctx.float_data = raw_hdr.float_data;
761761

762762
// Initialize for new dimensions and/or conjugation
763763
ctx.Nb = 0; // auto-calculate

rawspec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ struct rawspec_context_s {
115115
int input_conjugated;
116116

117117
// Flag indicating that the input data is integer data (not floating point)
118-
int integer_data;
118+
int float_data;
119119

120120
// Flag indicating the concurrent output of the output data's incoherent-sum.
121121
int incoherently_sum;

rawspec_gpu.cu

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ int rawspec_initialize(rawspec_context * ctx)
498498
// and a warning is issued to stderr.
499499
if(ctx->Nbps == 0) {
500500
ctx->Nbps = 8;
501-
} else if(ctx->integer_data && ctx->Nbps != 8 && ctx->Nbps != 16) {
501+
} else if(!ctx->float_data && ctx->Nbps != 8 && ctx->Nbps != 16) {
502502
NbpsIsExpanded = ctx->Nbps == 4;
503503
fprintf(
504504
stderr,
@@ -508,7 +508,7 @@ int rawspec_initialize(rawspec_context * ctx)
508508
);
509509
fflush(stderr);
510510
ctx->Nbps = 8;
511-
} else if(!ctx->integer_data && ctx->Nbps != 16 && ctx->Nbps != 32) {
511+
} else if(ctx->float_data && ctx->Nbps != 16 && ctx->Nbps != 32) {
512512
fprintf(
513513
stderr,
514514
"Nbps cannot be %d for floating-point data, treating as 16.\n",
@@ -834,15 +834,15 @@ int rawspec_initialize(rawspec_context * ctx)
834834
}
835835
fflush(stderr);
836836

837-
fprintf(stderr, "Detected %s data.\n", ctx->integer_data ? "Integer" : "Float");
837+
fprintf(stdout, "Detected %s data.\n", ctx->float_data ? "Float" : "Integer");
838838

839839
// Create texture object for device input buffer
840840
// res_desc describes input resource
841841
// Width is 32K elements, height is buf_size/32K elements, pitch is 32K elements
842842
memset(&res_desc, 0, sizeof(res_desc));
843843
res_desc.resType = cudaResourceTypePitch2D;
844844
res_desc.res.pitch2D.devPtr = gpu_ctx->d_fft_in;
845-
res_desc.res.pitch2D.desc.f = ctx->integer_data ? cudaChannelFormatKindSigned : cudaChannelFormatKindFloat;
845+
res_desc.res.pitch2D.desc.f = ctx->float_data ? cudaChannelFormatKindFloat : cudaChannelFormatKindSigned;
846846
res_desc.res.pitch2D.desc.x = ctx->Nbps; // bits per sample
847847
res_desc.res.pitch2D.width = 1<<LOAD_TEXTURE_WIDTH_POWER; // elements
848848
res_desc.res.pitch2D.height = buf_size>>LOAD_TEXTURE_WIDTH_POWER; // elements
@@ -857,7 +857,7 @@ int rawspec_initialize(rawspec_context * ctx)
857857
// Not sure whether filter_mode matters for cudaReadModeNormalizedFloat
858858
tex_desc.filter_mode = cudaFilterModePoint;
859859
#endif // 0
860-
tex_desc.readMode = ctx->integer_data ? cudaReadModeNormalizedFloat : cudaReadModeElementType;
860+
tex_desc.readMode = ctx->float_data ? cudaReadModeElementType : cudaReadModeNormalizedFloat;
861861

862862
cuda_rc = cudaCreateTextureObject(&gpu_ctx->tex_obj,
863863
&res_desc, &tex_desc, NULL);

rawspec_rawutils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ void rawspec_raw_parse_header(const char * buf, rawspec_raw_hdr_t * raw_hdr)
172172
raw_hdr->nants = rawspec_raw_get_u32(buf, "NANTS", 1);
173173

174174
rawspec_raw_get_str(buf, "DATATYPE", "INTEGER", tmp, 80);
175-
raw_hdr->integer_data = strncmp(tmp, "INTEGER", 7) == 0;
175+
raw_hdr->float_data = strncmp(tmp, "FLOAT", 5) == 0;
176176

177177
rawspec_raw_get_str(buf, "RA_STR", "0.0", tmp, 80);
178178
raw_hdr->ra = rawspec_raw_hmsstr_to_h(tmp);

rawspec_rawutils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ typedef struct {
2424
char telescop[81];
2525
off_t hdr_pos; // Offset of start of header
2626
size_t hdr_size; // Size of header in bytes (not including DIRECTIO padding)
27-
int integer_data; // flag integer (not float) data
27+
int float_data; // flag integer (not float) data
2828
} rawspec_raw_hdr_t;
2929

3030
// Multiple of 80 and 512

0 commit comments

Comments
 (0)