## 1 Introduction
Interestingly enough, the IoT-CDNN-FC convergence can allow the exploitation of both the local exits of the implemented CDNNs and the per-tier aggregation of the local processing performed by the supporting FC platforms. In addition, this convergence may also allow the acquisition and joint mining of data generated by _spatially scattered_ IoT device and may also enable energy and bandwidth-efficient data analytics by exploiting the _scalable_ nature of the CDNNs and supporting FC platforms [11]. According to these facts, to enable an energy-efficient and real-time exploitation of the FC technological platform, we need a flexible evaluation environment for the dynamic test of different distribution strategies of CDNNs under programmable (i.e., settable by the user) models for the energy-delay profiles of the virtualized computing and network blocks composing the considered FC platform of Figure 1b. The steps to be taken for the design, training, and execution of the CDNN with early exits of Figure 1a over the distributed Fog technological platform of Figure 1b are sketched in Figure 2. The first four steps of Figure 2 concern the training/setup of the considered CDNN with early exits. All these steps have been the focus of our previous contributions in Reference [7; 15], and will not be further considered in this paper. The last two steps of Figure 2 concern the inference phase of the CDNN's life-cycle and will be the _explicit_ focus of this contribution. Figure 1: (a) Sketch of the stack topology of a Conditional Neural Network (CDNN) with \(L\) layers and \(N_{EE}\) early exits; (b) sketch of a multi-tier networked Fog platform. Motivated by these considerations, in this paper, we propose _DeepFogSim_, a toolkit supporting virtualized technological platforms for the real-time distributed execution of the inference phase of CDNNs with early exits under IoT realms. In this perspective, _DeepFogSim_ is a new software toolbox that allows:  
1. the simulation atop a standard PC;
2. the dynamic optimization;
3. the dynamic tracking;
4. the comparison; and
5. the graphic rendering through an ad-hoc designed Graphic Use Interface (GUI),  
of the energy-vs.-delay performance of the underlying Fog-based technological platform supporting the execution of CDNNs with early exits. In particular, _DeepFogSim_ tackles the _joint_ CDNN inference and _dynamic_ resource allocation problems, under hard _real-time_ constraints on the overall (i.e., computing-plus-communication) execution time. Specifically, _DeepFogSim_ allows the users to:  
1. test their desired network topologies by customizing the simulation environment through the setting of the 34 input parameters of the simulator package (see Table 1);
2. dynamically track the energy-delay network performance in the presence of abrupt (possibly, unpredictable) changes of the simulated environment, like mobility-induced changes of the available communication bandwidths; and
3. optimize the obtained performance against a number of metrics, like total consumed energy, network consumed energy, network bandwidth, computing processing speeds, execution delays, just to name a few. The major peculiar features of the proposed _DeepFogSim_ toolbox are the following:  
1. it allows the numerical performance evaluation arising from the _delay-constrained_ minimization of the overall computing-plus-network energy consumed by the execution of the CDNN with early exits.