<commit_before>//
// @author <EMAIL>
//

#ifndef LIBND4J_TYPE_CONVERSIONS_H
#define LIBND4J_TYPE_CONVERSIONS_H

#define ND4J_FLOAT8 0
#define ND4J_INT8 1
#define ND4J_UINT8 2
#define ND4J_FLOAT16 3
#define ND4J_INT16 4
#define ND4J_UINT16 5
#define ND4J_FLOAT32 6
#define ND4J_DOUBLE 7
#define ND4J_FLOAT24 119

#include <types/float16.h>
#include <types/float8.h>
#include <types/uint8.h>
#include <types/int8.h>
#include "types/int16.h"
#include "types/uint16.h"


#ifdef __CUDACC__
template<typename S, typename T>
__device__ inline void convertKernelGeneric(void *dx, long N, void *dz) {
    S *x = reinterpret_cast<S *> (dx);
    T *z = reinterpret_cast<T *> (dz);

    int tid = blockIdx.x * blockDim.x + threadIdx.x;

    for (Nd4jIndex i = tid; i < N; i+= blockDim.x * gridDim.x) {
        z[i] = (T) ((float) x[i]);
    }
};
#endif

template<typename S, typename T>
void convertGeneric(void *dx, long N, void *dz) {
    S *x = reinterpret_cast<S *> (dx);
    T *z = reinterpret_cast<T *> (dz);

    if (N < 8000) {

#pragma omp simd
        for (int i = 0; i < N; i++) {
            z[i] = (T) ((float) x[i]);
        }
    } else {

#pragma omp parallel for simd schedule(guided)
        for (int i = 0; i < N; i++) {
            z[i] = (T) ((float) x[i]);
        }
    }
};

/*
 * TypeDef:
 *     void convertTypes(Nd4jPointer *extras, int srcType, Nd4jPointer x, long N, int dstType, Nd4jPointer z);
 */
void NativeOps::convertTypes(Nd4jPointer *extras, int srcType, Nd4jPointer x, long N, int dstType, Nd4jPointer z) {
    void *dx = reinterpret_cast<void *> (x);
    void *dz = reinterpret_cast<void *> (z);

    if (srcType == ND4J_FLOAT8) {
        if (dstType == ND4J_FLOAT8) {
           // convertGeneric<double, nd4j::float8>(dx, N, dz);<commit_msg>no parallel for in type conv<commit_after>//
// @author <EMAIL>
//

#ifndef LIBND4J_TYPE_CONVERSIONS_H
#define LIBND4J_TYPE_CONVERSIONS_H

#define ND4J_FLOAT8 0
#define ND4J_INT8 1
#define ND4J_UINT8 2
#define ND4J_FLOAT16 3
#define ND4J_INT16 4
#define ND4J_UINT16 5
#define ND4J_FLOAT32 6
#define ND4J_DOUBLE 7
#define ND4J_FLOAT24 119

#include <types/float16.h>
#include <types/float8.h>
#include <types/uint8.h>
#include <types/int8.h>
#include "types/int16.h"
#include "types/uint16.h"


#ifdef __CUDACC__
template<typename S, typename T>
__device__ inline void convertKernelGeneric(void *dx, long N, void *dz) {
    S *x = reinterpret_cast<S *> (dx);
    T *z = reinterpret_cast<T *> (dz);

    int tid = blockIdx.x * blockDim.x + threadIdx.x;

    for (Nd4jIndex i = tid; i < N; i+= blockDim.x * gridDim.x) {
        z[i] = (T) ((float) x[i]);
    }
};
#endif

template<typename S, typename T>
void convertGeneric(void *dx, long N, void *dz) {
    S *x = reinterpret_cast<S *> (dx);
    T *z = reinterpret_cast<T *> (dz);

    if (N < 8000) {

#pragma omp simd
        for (int i = 0; i < N; i++) {
            z[i] = (T) ((float) x[i]);
        }
    } else {

#pragma omp simd
        for (int i = 0; i < N; i++) {
            z[i] = (T) ((float) x[i]);
        }
    }
};

/*
 * TypeDef:
 *     void convertTypes(Nd4jPointer *extras, int srcType, Nd4jPointer x, long N, int dstType, Nd4jPointer z);
 */
void NativeOps::convertTypes(Nd4jPointer *extras, int srcType, Nd4jPointer x, long N, int dstType, Nd4jPointer z) {
    void *dx = reinterpret_cast<void *> (x);
    void *dz = reinterpret_cast<void *> (z);

    if (srcType == ND4J_FLOAT8) {
        if (dstType == ND4J_FLOAT8) {
           // convertGeneric<double, nd4j::float8>(dx, N, dz);
{'fraction_non_alphanumeric': 0.14865248226950353, 'fraction_numerical': 0.03574468085106383, 'mean_word_length': 3.1826809015421116, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6243679', 'n_tokens_mistral': 1503, 'n_tokens_neox': 1413, 'n_words': 375}